@@ -20,13 +20,13 @@ |
||
| 20 | 20 | |
| 21 | 21 | // Get route manifest |
| 22 | 22 | $params = array( |
| 23 | - "directions" => 1, |
|
| 24 | - "route_id" => $route_id |
|
| 23 | + "directions" => 1, |
|
| 24 | + "route_id" => $route_id |
|
| 25 | 25 | ); |
| 26 | 26 | |
| 27 | 27 | $route = Route::getRoutes($params); |
| 28 | 28 | |
| 29 | 29 | foreach ($route->addresses as $addr1) { |
| 30 | - Route4Me::simplePrint((array)$addr1, true); |
|
| 31 | - echo "<br>"; |
|
| 30 | + Route4Me::simplePrint((array)$addr1, true); |
|
| 31 | + echo "<br>"; |
|
| 32 | 32 | } |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | if (isset($addressRand['is_depot'])) |
| 27 | 27 | { |
| 28 | - if ($addressRand['is_depot']) { |
|
| 29 | - echo "Random choosed address is depot, it can't be marked!.. Try again."; |
|
| 30 | - return; |
|
| 31 | - } |
|
| 28 | + if ($addressRand['is_depot']) { |
|
| 29 | + echo "Random choosed address is depot, it can't be marked!.. Try again."; |
|
| 30 | + return; |
|
| 31 | + } |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | $address_id = $addressRand['route_destination_id']; |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | // Mark the address as detected as visited |
| 39 | 39 | $addressParameters = (array)Address::fromArray(array( |
| 40 | - "route_id" => $routeId, |
|
| 41 | - "route_destination_id" => $address_id, |
|
| 42 | - "is_visited" => TRUE |
|
| 40 | + "route_id" => $routeId, |
|
| 41 | + "route_destination_id" => $address_id, |
|
| 42 | + "is_visited" => TRUE |
|
| 43 | 43 | )); |
| 44 | 44 | |
| 45 | 45 | $address = new Address(); |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | if (isset($addressRand['is_depot'])) |
| 27 | 27 | { |
| 28 | - if ($addressRand['is_depot']) { |
|
| 29 | - echo "Random choosed address is depot, it can't be marked!.. Try again."; |
|
| 30 | - return; |
|
| 31 | - } |
|
| 28 | + if ($addressRand['is_depot']) { |
|
| 29 | + echo "Random choosed address is depot, it can't be marked!.. Try again."; |
|
| 30 | + return; |
|
| 31 | + } |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // Get random address's id from selected route above |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | // Mark the address as detected as deoarted |
| 41 | 41 | $addressParameters = (array)Address::fromArray(array( |
| 42 | - "route_id" => $routeId, |
|
| 43 | - "route_destination_id" => $route_destination_id, |
|
| 44 | - "is_departed" => TRUE |
|
| 42 | + "route_id" => $routeId, |
|
| 43 | + "route_destination_id" => $route_destination_id, |
|
| 44 | + "is_departed" => TRUE |
|
| 45 | 45 | )); |
| 46 | 46 | |
| 47 | 47 | $address = new Address(); |
@@ -19,8 +19,8 @@ |
||
| 19 | 19 | assert(!is_null($route_id), "Can't retrieve a random route ID"); |
| 20 | 20 | |
| 21 | 21 | $params = array( |
| 22 | - 'device_tracking_history' => true, |
|
| 23 | - 'route_id' => $route_id |
|
| 22 | + 'device_tracking_history' => true, |
|
| 23 | + 'route_id' => $route_id |
|
| 24 | 24 | ); |
| 25 | 25 | |
| 26 | 26 | // Get route tracking |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root=realpath(dirname(__FILE__).'/../'); |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../'); |
|
| 5 | 5 | require $root.'/vendor/autoload.php'; |
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | $route = new Route(); |
| 16 | 16 | |
| 17 | 17 | // Get a random route ID |
| 18 | -$route_id=$route->getRandomRouteId(0, 10); |
|
| 18 | +$route_id = $route->getRandomRouteId(0, 10); |
|
| 19 | 19 | assert(!is_null($route_id), "Can't retrieve a random route ID"); |
| 20 | 20 | |
| 21 | 21 | $params = array( |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root=realpath(dirname(__FILE__).'/../../'); |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | 5 | require $root.'/vendor/autoload.php'; |
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | // Select a route with more than 4 addresses. |
| 20 | 20 | $routesParams = array( |
| 21 | - "offset" => 0, |
|
| 22 | - "limit" => 20 |
|
| 21 | + "offset" => 0, |
|
| 22 | + "limit" => 20 |
|
| 23 | 23 | ); |
| 24 | 24 | |
| 25 | 25 | $routes = $route->getRoutes($routesParams); |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | $selectedRoute = null; |
| 28 | 28 | |
| 29 | 29 | foreach ($routes as $route1) { |
| 30 | - if (isset($route1->destination_count)) { |
|
| 31 | - if ($route1->destination_count>4) { |
|
| 32 | - $selectedRoute = $route->getRoutes(array('route_id' => $route1->route_id)); |
|
| 33 | - break; |
|
| 34 | - } |
|
| 35 | - } |
|
| 30 | + if (isset($route1->destination_count)) { |
|
| 31 | + if ($route1->destination_count>4) { |
|
| 32 | + $selectedRoute = $route->getRoutes(array('route_id' => $route1->route_id)); |
|
| 33 | + break; |
|
| 34 | + } |
|
| 35 | + } |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | assert(!is_null($selectedRoute), "Can't select a route with more than 4 addresses"); |
@@ -44,19 +44,19 @@ discard block |
||
| 44 | 44 | echo "Route ID-> $routeID, Route destination ID -> $routeDestinationID <br>"; |
| 45 | 45 | |
| 46 | 46 | $params = array( |
| 47 | - "route_id" => $routeID, |
|
| 48 | - "route_destination_id" => $routeDestinationID, |
|
| 49 | - "addresses" => array( |
|
| 50 | - "0" => array( |
|
| 51 | - "route_destination_id" => $routeDestinationID, |
|
| 52 | - "sequence_no" => 3 |
|
| 53 | - ) |
|
| 54 | - ) |
|
| 47 | + "route_id" => $routeID, |
|
| 48 | + "route_destination_id" => $routeDestinationID, |
|
| 49 | + "addresses" => array( |
|
| 50 | + "0" => array( |
|
| 51 | + "route_destination_id" => $routeDestinationID, |
|
| 52 | + "sequence_no" => 3 |
|
| 53 | + ) |
|
| 54 | + ) |
|
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | 57 | $response = $route->resequenceRoute($params); |
| 58 | 58 | |
| 59 | 59 | foreach ($response['addresses'] as $address) { |
| 60 | - Route4Me::simplePrint($address); |
|
| 61 | - echo "<br>"; |
|
| 60 | + Route4Me::simplePrint($address); |
|
| 61 | + echo "<br>"; |
|
| 62 | 62 | } |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root=realpath(dirname(__FILE__).'/../../'); |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | 5 | require $root.'/vendor/autoload.php'; |
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root=realpath(dirname(__FILE__).'/../../'); |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | 5 | require $root.'/vendor/autoload.php'; |
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
@@ -23,25 +23,25 @@ |
||
| 23 | 23 | |
| 24 | 24 | // Get a route with the path points |
| 25 | 25 | $params = array( |
| 26 | - "route_path_output" => "Points", |
|
| 27 | - "route_id" => $route_id |
|
| 26 | + "route_path_output" => "Points", |
|
| 27 | + "route_id" => $route_id |
|
| 28 | 28 | ); |
| 29 | 29 | |
| 30 | 30 | $routeResults = (array)$route->getRoutePoints($params); |
| 31 | 31 | |
| 32 | 32 | if (isset($routeResults['addresses'])) { |
| 33 | - foreach ($routeResults['addresses'] as $key => $address) { |
|
| 34 | - $araddress = (array)$address; |
|
| 33 | + foreach ($routeResults['addresses'] as $key => $address) { |
|
| 34 | + $araddress = (array)$address; |
|
| 35 | 35 | |
| 36 | - if (isset($araddress['route_destination_id'])) { |
|
| 37 | - echo "route_destination_id=".$araddress['route_destination_id']."<br>"; |
|
| 38 | - } |
|
| 36 | + if (isset($araddress['route_destination_id'])) { |
|
| 37 | + echo "route_destination_id=".$araddress['route_destination_id']."<br>"; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - if (isset($araddress['path_to_next'])) { |
|
| 41 | - echo "path_to_next:<br>"; |
|
| 42 | - Route4Me::simplePrint($araddress['path_to_next']); |
|
| 43 | - } |
|
| 40 | + if (isset($araddress['path_to_next'])) { |
|
| 41 | + echo "path_to_next:<br>"; |
|
| 42 | + Route4Me::simplePrint($araddress['path_to_next']); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - echo "<br>"; |
|
| 46 | - } |
|
| 45 | + echo "<br>"; |
|
| 46 | + } |
|
| 47 | 47 | } |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root=realpath(dirname(__FILE__).'/../../'); |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | 5 | require $root.'/vendor/autoload.php'; |
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
@@ -23,26 +23,26 @@ |
||
| 23 | 23 | |
| 24 | 24 | // Get a route with the path points |
| 25 | 25 | $params = array( |
| 26 | - "route_path_output" => "Points", |
|
| 27 | - "compress_path_points" => TRUE, |
|
| 28 | - "route_id" => $route_id |
|
| 26 | + "route_path_output" => "Points", |
|
| 27 | + "compress_path_points" => TRUE, |
|
| 28 | + "route_id" => $route_id |
|
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | 31 | $routeResults = (array)$route->getRoutePoints($params); |
| 32 | 32 | |
| 33 | 33 | if (isset($routeResults['addresses'])) { |
| 34 | - foreach ($routeResults['addresses'] as $key => $address) { |
|
| 35 | - $araddress = (array)$address; |
|
| 34 | + foreach ($routeResults['addresses'] as $key => $address) { |
|
| 35 | + $araddress = (array)$address; |
|
| 36 | 36 | |
| 37 | - if (isset($araddress['route_destination_id'])) { |
|
| 38 | - echo "route_destination_id=".$araddress['route_destination_id']."<br>"; |
|
| 39 | - } |
|
| 37 | + if (isset($araddress['route_destination_id'])) { |
|
| 38 | + echo "route_destination_id=".$araddress['route_destination_id']."<br>"; |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - if (isset($araddress['path_to_next'])) { |
|
| 42 | - echo "path_to_next:<br>"; |
|
| 43 | - Route4Me::simplePrint((array)$araddress['path_to_next']); |
|
| 44 | - } |
|
| 41 | + if (isset($araddress['path_to_next'])) { |
|
| 42 | + echo "path_to_next:<br>"; |
|
| 43 | + Route4Me::simplePrint((array)$araddress['path_to_next']); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - echo "<br>"; |
|
| 47 | - } |
|
| 46 | + echo "<br>"; |
|
| 47 | + } |
|
| 48 | 48 | } |
@@ -23,8 +23,8 @@ |
||
| 23 | 23 | |
| 24 | 24 | // Get a route with the directions |
| 25 | 25 | $params = array( |
| 26 | - "directions" => 1, |
|
| 27 | - "route_id" => $route_id |
|
| 26 | + "directions" => 1, |
|
| 27 | + "route_id" => $route_id |
|
| 28 | 28 | ); |
| 29 | 29 | |
| 30 | 30 | $routeResults = (array)$route->getRoutePoints($params); |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root=realpath(dirname(__FILE__).'/../../'); |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | 5 | require $root.'/vendor/autoload.php'; |
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |