@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | // Select a terriotry with the addresses from the list |
19 | 19 | $params = array( |
20 | - "offset" => 0, |
|
21 | - "limit" => 50, |
|
22 | - "addresses" => 1 |
|
20 | + "offset" => 0, |
|
21 | + "limit" => 50, |
|
22 | + "addresses" => 1 |
|
23 | 23 | ); |
24 | 24 | |
25 | 25 | $results = $territory->getTerritories($params); |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | $territory1 = null; |
29 | 29 | |
30 | 30 | foreach ($results as $terr) { |
31 | - if (isset($terr['addresses'])) { |
|
32 | - if (sizeof($terr['addresses'])>0) { |
|
33 | - $territory1 = $terr; |
|
34 | - break; |
|
35 | - } |
|
36 | - } |
|
31 | + if (isset($terr['addresses'])) { |
|
32 | + if (sizeof($terr['addresses'])>0) { |
|
33 | + $territory1 = $terr; |
|
34 | + break; |
|
35 | + } |
|
36 | + } |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | assert(isset($territory1['territory_id']), "Can't retrieve a random territory ID"); |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | |
44 | 44 | // Get a territory with the addresses |
45 | 45 | $params = array( |
46 | - "territory_id" => $territory_id, |
|
47 | - "addresses" => 1 |
|
46 | + "territory_id" => $territory_id, |
|
47 | + "addresses" => 1 |
|
48 | 48 | ); |
49 | 49 | |
50 | 50 | $result1 = $territory->getTerritory($params); |
@@ -20,14 +20,14 @@ |
||
20 | 20 | $territory = new Territory(); |
21 | 21 | $territory->type = TerritoryTypes::CIRCLE; |
22 | 22 | $territory->data = array ( |
23 | - "37.569752822786455,-77.47833251953125", |
|
24 | - "5000" |
|
23 | + "37.569752822786455,-77.47833251953125", |
|
24 | + "5000" |
|
25 | 25 | ); |
26 | 26 | |
27 | 27 | $TerritoryParameters = Territory::fromArray(array( |
28 | - "territory_name" => "Test Territory ".strval(rand(10000,99999)), |
|
29 | - "territory_color" => "ff7700", |
|
30 | - "territory" => $territory |
|
28 | + "territory_name" => "Test Territory ".strval(rand(10000,99999)), |
|
29 | + "territory_color" => "ff7700", |
|
30 | + "territory" => $territory |
|
31 | 31 | )); |
32 | 32 | |
33 | 33 | $territory = new Territory(); |
@@ -13,13 +13,13 @@ |
||
13 | 13 | $territory = new Territory(); |
14 | 14 | |
15 | 15 | $queryparameters = array ( |
16 | - "offset" => 0, |
|
17 | - "limit" => 20 |
|
16 | + "offset" => 0, |
|
17 | + "limit" => 20 |
|
18 | 18 | ); |
19 | 19 | |
20 | 20 | $response = $territory->getTerritories($queryparameters); |
21 | 21 | |
22 | 22 | foreach ($response as $terr1) { |
23 | 23 | Route4Me::simplePrint($terr1, true); |
24 | - echo "<br>"; |
|
24 | + echo "<br>"; |
|
25 | 25 | } |
@@ -20,9 +20,9 @@ |
||
20 | 20 | ); |
21 | 21 | |
22 | 22 | $TerritoryParameters = Territory::fromArray(array( |
23 | - "territory_name" => "Test Rectangular Territory ".strval(rand(10000,99999)), |
|
24 | - "territory_color" => "ff7700", |
|
25 | - "territory" => $territory |
|
23 | + "territory_name" => "Test Rectangular Territory ".strval(rand(10000,99999)), |
|
24 | + "territory_color" => "ff7700", |
|
25 | + "territory" => $territory |
|
26 | 26 | )); |
27 | 27 | |
28 | 28 | $territory=new Territory(); |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | $territory = new Territory(); |
18 | 18 | $territory->type = TerritoryTypes::CIRCLE; |
19 | 19 | $territory->data = array ( |
20 | - "37.569752822786455,-77.47833251953125", |
|
21 | - "5000" |
|
20 | + "37.569752822786455,-77.47833251953125", |
|
21 | + "5000" |
|
22 | 22 | ); |
23 | 23 | |
24 | 24 | $TerritoryParameters=Territory::fromArray(array( |
25 | - "territory_name" => "Test Territory ".strval(rand(10000,99999)), |
|
26 | - "territory_color" => "ff7700", |
|
27 | - "territory" => $territory |
|
25 | + "territory_name" => "Test Territory ".strval(rand(10000,99999)), |
|
26 | + "territory_color" => "ff7700", |
|
27 | + "territory" => $territory |
|
28 | 28 | )); |
29 | 29 | |
30 | 30 | $result = (array)$territory->addTerritory($TerritoryParameters); |
@@ -37,18 +37,18 @@ discard block |
||
37 | 37 | |
38 | 38 | // Update territory |
39 | 39 | $territoryParameters = array ( |
40 | - "type" => TerritoryTypes::RECT, |
|
41 | - "data" => array( |
|
42 | - "29.6600127358956,-95.6593322753906", |
|
43 | - "29.8966150753098,-95.3146362304688" |
|
44 | - ) |
|
40 | + "type" => TerritoryTypes::RECT, |
|
41 | + "data" => array( |
|
42 | + "29.6600127358956,-95.6593322753906", |
|
43 | + "29.8966150753098,-95.3146362304688" |
|
44 | + ) |
|
45 | 45 | ); |
46 | 46 | |
47 | 47 | $TerritoryParameters = Territory::fromArray(array( |
48 | - "territory_id" => $territory_id, |
|
49 | - "territory_name" => "Test Territory Updated as rectangle", |
|
50 | - "territory_color" => "ff5500", |
|
51 | - "territory" => $territoryParameters |
|
48 | + "territory_id" => $territory_id, |
|
49 | + "territory_name" => "Test Territory Updated as rectangle", |
|
50 | + "territory_color" => "ff5500", |
|
51 | + "territory" => $territoryParameters |
|
52 | 52 | )); |
53 | 53 | |
54 | 54 | $result1 = $territory->updateTerritory($TerritoryParameters); |
@@ -15,21 +15,21 @@ |
||
15 | 15 | $territory = new Territory(); |
16 | 16 | $territory->type = TerritoryTypes::POLY; |
17 | 17 | $territory->data = array ( |
18 | - "37.769752822786455,-77.67833251953125", |
|
19 | - "37.75886716305343,-77.68974800109863", |
|
20 | - "37.74763966054455,-77.6917221069336", |
|
21 | - "37.74655084306813,-77.68863220214844", |
|
22 | - "37.7502255383101,-77.68125076293945", |
|
23 | - "37.74797991274437,-77.67498512268066", |
|
24 | - "37.73327960206065,-77.6411678314209", |
|
25 | - "37.74430510679532,-77.63172645568848", |
|
26 | - "37.76641925847049,-77.66846199035645" |
|
18 | + "37.769752822786455,-77.67833251953125", |
|
19 | + "37.75886716305343,-77.68974800109863", |
|
20 | + "37.74763966054455,-77.6917221069336", |
|
21 | + "37.74655084306813,-77.68863220214844", |
|
22 | + "37.7502255383101,-77.68125076293945", |
|
23 | + "37.74797991274437,-77.67498512268066", |
|
24 | + "37.73327960206065,-77.6411678314209", |
|
25 | + "37.74430510679532,-77.63172645568848", |
|
26 | + "37.76641925847049,-77.66846199035645" |
|
27 | 27 | ); |
28 | 28 | |
29 | 29 | $TerritoryParameters=Territory::fromArray(array( |
30 | - "territory_name" => "Test Polygonian Territory ".strval(rand(10000,99999)), |
|
31 | - "territory_color" => "ff7700", |
|
32 | - "territory" => $territory |
|
30 | + "territory_name" => "Test Polygonian Territory ".strval(rand(10000,99999)), |
|
31 | + "territory_color" => "ff7700", |
|
32 | + "territory" => $territory |
|
33 | 33 | )); |
34 | 34 | |
35 | 35 | $territory = new Territory(); |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | $territory = new Territory(); |
18 | 18 | $territory->type = TerritoryTypes::CIRCLE; |
19 | 19 | $territory->data = array ( |
20 | - "37.569752822786455,-77.47833251953125", |
|
21 | - "5000" |
|
20 | + "37.569752822786455,-77.47833251953125", |
|
21 | + "5000" |
|
22 | 22 | ); |
23 | 23 | |
24 | 24 | $TerritoryParameters = Territory::fromArray(array( |
25 | - "territory_name" => "Test Territory ".strval(rand(10000,99999)), |
|
26 | - "territory_color" => "ff7700", |
|
27 | - "territory" => $territory |
|
25 | + "territory_name" => "Test Territory ".strval(rand(10000,99999)), |
|
26 | + "territory_color" => "ff7700", |
|
27 | + "territory" => $territory |
|
28 | 28 | )); |
29 | 29 | |
30 | 30 | $territory = new Territory(); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | echo "------------------------------------------------------------------------<br><br>"; |
41 | 41 | |
42 | 42 | $params = array( |
43 | - "territory_id" => $territory_id |
|
43 | + "territory_id" => $territory_id |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | $result1 = $territory->getTerritory($params); |
@@ -13,14 +13,14 @@ |
||
13 | 13 | $territory = new Territory(); |
14 | 14 | $territory->type = TerritoryTypes::CIRCLE; |
15 | 15 | $territory->data = array ( |
16 | - "37.569752822786455,-77.47833251953125", |
|
17 | - "5000" |
|
16 | + "37.569752822786455,-77.47833251953125", |
|
17 | + "5000" |
|
18 | 18 | ); |
19 | 19 | |
20 | 20 | $TerritoryParameters= Territory::fromArray(array( |
21 | - "territory_name" => "Test Territory ".strval(rand(10000,99999)), |
|
22 | - "territory_color" => "ff7700", |
|
23 | - "territory" => $territory |
|
21 | + "territory_name" => "Test Territory ".strval(rand(10000,99999)), |
|
22 | + "territory_color" => "ff7700", |
|
23 | + "territory" => $territory |
|
24 | 24 | )); |
25 | 25 | |
26 | 26 | $territory = new Territory(); |
@@ -26,23 +26,23 @@ discard block |
||
26 | 26 | |
27 | 27 | $addresses = array(); |
28 | 28 | foreach($json as $address) { |
29 | - $addresses[] = Address::fromArray($address); |
|
29 | + $addresses[] = Address::fromArray($address); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $parameters = RouteParameters::fromArray(array( |
33 | - "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
|
34 | - "route_name" => "Multiple Depot, Multiple Driver, Time Window", |
|
35 | - "route_date" => time() + 24*60*60, |
|
36 | - "route_time" => 60 * 60 * 7, |
|
37 | - "rt" => TRUE, |
|
38 | - "distance_unit" => DistanceUnit::MILES, |
|
39 | - "device_type" => DeviceType::WEB, |
|
40 | - "optimize" => OptimizationType::TIME, |
|
41 | - "metric" => Metric::GEODESIC, |
|
42 | - "route_max_duration" => 86400 * 3, |
|
43 | - "travel_mode" => TravelMode::DRIVING, |
|
44 | - "vehicle_capacity" => 99, |
|
45 | - "vehicle_max_distance_mi" => 99999 |
|
33 | + "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
|
34 | + "route_name" => "Multiple Depot, Multiple Driver, Time Window", |
|
35 | + "route_date" => time() + 24*60*60, |
|
36 | + "route_time" => 60 * 60 * 7, |
|
37 | + "rt" => TRUE, |
|
38 | + "distance_unit" => DistanceUnit::MILES, |
|
39 | + "device_type" => DeviceType::WEB, |
|
40 | + "optimize" => OptimizationType::TIME, |
|
41 | + "metric" => Metric::GEODESIC, |
|
42 | + "route_max_duration" => 86400 * 3, |
|
43 | + "travel_mode" => TravelMode::DRIVING, |
|
44 | + "vehicle_capacity" => 99, |
|
45 | + "vehicle_max_distance_mi" => 99999 |
|
46 | 46 | )); |
47 | 47 | |
48 | 48 | $optimizationParams = new OptimizationProblemParams; |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | $problem = OptimizationProblem::optimize($optimizationParams); |
53 | 53 | |
54 | 54 | foreach ((array)$problem as $key => $value) { |
55 | - if (is_string($value)) { |
|
56 | - echo $key." --> ".$value."<br>"; |
|
57 | - } else { |
|
58 | - echo "************ $key ************* <br>"; |
|
59 | - Route4Me::simplePrint((array)$value, true); |
|
60 | - echo "******************************* <br>"; |
|
61 | - } |
|
55 | + if (is_string($value)) { |
|
56 | + echo $key." --> ".$value."<br>"; |
|
57 | + } else { |
|
58 | + echo "************ $key ************* <br>"; |
|
59 | + Route4Me::simplePrint((array)$value, true); |
|
60 | + echo "******************************* <br>"; |
|
61 | + } |
|
62 | 62 | } |
63 | 63 |