@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | class OptimizationType |
5 | 5 | { |
6 | - const DISTANCE = 'Distance'; |
|
7 | - const TIME = 'Time'; |
|
8 | - const TIME_WITH_TRAFFIC = 'timeWithTraffic'; |
|
6 | + const DISTANCE = 'Distance'; |
|
7 | + const TIME = 'Time'; |
|
8 | + const TIME_WITH_TRAFFIC = 'timeWithTraffic'; |
|
9 | 9 | } |
@@ -3,10 +3,10 @@ |
||
3 | 3 | |
4 | 4 | class OptimizationStates |
5 | 5 | { |
6 | - const INITIAL = 1; |
|
7 | - const MATRIX_PROCESSING = 2; |
|
8 | - const OPTIMIZING = 3; |
|
9 | - const OPTIMIZED = 4; |
|
10 | - const ERROR = 5; |
|
11 | - const COMPUTING_DIRECTIONS = 6; |
|
6 | + const INITIAL = 1; |
|
7 | + const MATRIX_PROCESSING = 2; |
|
8 | + const OPTIMIZING = 3; |
|
9 | + const OPTIMIZED = 4; |
|
10 | + const ERROR = 5; |
|
11 | + const COMPUTING_DIRECTIONS = 6; |
|
12 | 12 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | class TerritoryTypes |
5 | 5 | { |
6 | - const CIRCLE = 'circle'; |
|
7 | - const POLY = 'poly'; |
|
8 | - const RECT = 'rect'; |
|
6 | + const CIRCLE = 'circle'; |
|
7 | + const POLY = 'poly'; |
|
8 | + const RECT = 'rect'; |
|
9 | 9 | } |
@@ -44,18 +44,18 @@ |
||
44 | 44 | const ORDER_V4 = '/api.v4/order.php'; |
45 | 45 | |
46 | 46 | const ROUTE_V4 = '/api.v4/route.php'; |
47 | - const ROUTE_DUPLICATE ='/actions/duplicate_route.php'; |
|
48 | - const ROUTES_DELETE ='/actions/delete_routes.php'; |
|
49 | - const REOPTIMIZE_V3_2 ='/api.v3/route/reoptimize_2.php'; |
|
50 | - const ROUTES_MERGE ='/actions/merge_routes.php'; |
|
51 | - const ROUTE_SHARE ='/actions/route/share_route.php'; |
|
52 | - const ROUTE_NOTES_ADD ='/actions/addRouteNotes.php'; |
|
53 | - const STATUS_V4 ='/api.v4/status.php'; |
|
54 | - const GET_DEVICE_LOCATION ='/api/track/get_device_location.php'; |
|
55 | - |
|
56 | - const TRACK_SET ='/track/set.php'; |
|
57 | - |
|
58 | - const NOTE_CUSTOM_TYPES_V4 ='/api.v4/note_custom_types.php'; |
|
47 | + const ROUTE_DUPLICATE = '/actions/duplicate_route.php'; |
|
48 | + const ROUTES_DELETE = '/actions/delete_routes.php'; |
|
49 | + const REOPTIMIZE_V3_2 = '/api.v3/route/reoptimize_2.php'; |
|
50 | + const ROUTES_MERGE = '/actions/merge_routes.php'; |
|
51 | + const ROUTE_SHARE = '/actions/route/share_route.php'; |
|
52 | + const ROUTE_NOTES_ADD = '/actions/addRouteNotes.php'; |
|
53 | + const STATUS_V4 = '/api.v4/status.php'; |
|
54 | + const GET_DEVICE_LOCATION = '/api/track/get_device_location.php'; |
|
55 | + |
|
56 | + const TRACK_SET = '/track/set.php'; |
|
57 | + |
|
58 | + const NOTE_CUSTOM_TYPES_V4 = '/api.v4/note_custom_types.php'; |
|
59 | 59 | |
60 | 60 | const VEHICLE_V4 = '/api/vehicles'; |
61 | 61 | } |
@@ -3,13 +3,13 @@ |
||
3 | 3 | |
4 | 4 | class AlgorithmType |
5 | 5 | { |
6 | - const TSP = 1; |
|
7 | - const VRP = 2; |
|
8 | - const CVRP_TW_SD = 3; |
|
9 | - const CVRP_TW_MD = 4; |
|
10 | - const TSP_TW = 5; |
|
11 | - const TSP_TW_CR = 6; |
|
12 | - const BBCVRP = 7; |
|
13 | - const ALG_NONE = 100; |
|
14 | - const ALG_LEGACY_DISTRIBUTED = 101; |
|
6 | + const TSP = 1; |
|
7 | + const VRP = 2; |
|
8 | + const CVRP_TW_SD = 3; |
|
9 | + const CVRP_TW_MD = 4; |
|
10 | + const TSP_TW = 5; |
|
11 | + const TSP_TW_CR = 6; |
|
12 | + const BBCVRP = 7; |
|
13 | + const ALG_NONE = 100; |
|
14 | + const ALG_LEGACY_DISTRIBUTED = 101; |
|
15 | 15 | } |
@@ -10,6 +10,6 @@ |
||
10 | 10 | const TSP_TW = 5; |
11 | 11 | const TSP_TW_CR = 6; |
12 | 12 | const BBCVRP = 7; |
13 | - const ALG_NONE = 100; |
|
13 | + const ALG_NONE = 100; |
|
14 | 14 | const ALG_LEGACY_DISTRIBUTED = 101; |
15 | 15 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | class AvoidanceZone extends Common |
9 | 9 | { |
10 | - public $territory_id; // Avoidance zone id |
|
10 | + public $territory_id; // Avoidance zone id |
|
11 | 11 | public $territory_name; |
12 | 12 | public $territory_color; |
13 | 13 | public $orders; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | $avoidanceZoneParameters = new AvoidanceZone(); |
32 | 32 | |
33 | - foreach($params as $key => $value) { |
|
33 | + foreach ($params as $key => $value) { |
|
34 | 34 | if (property_exists($avoidanceZoneParameters, $key)) { |
35 | 35 | $avoidanceZoneParameters->{$key} = $value; |
36 | 36 | } |
@@ -7,111 +7,111 @@ |
||
7 | 7 | |
8 | 8 | class AvoidanceZone extends Common |
9 | 9 | { |
10 | - public $territory_id; // Avoidance zone id |
|
11 | - public $territory_name; |
|
12 | - public $territory_color; |
|
13 | - public $orders; |
|
14 | - public $member_id; |
|
15 | - public $territory; // Territory parameters |
|
10 | + public $territory_id; // Avoidance zone id |
|
11 | + public $territory_name; |
|
12 | + public $territory_color; |
|
13 | + public $orders; |
|
14 | + public $member_id; |
|
15 | + public $territory; // Territory parameters |
|
16 | 16 | |
17 | - public static function fromArray(array $params) |
|
18 | - { |
|
19 | - if (!isset($params['territory_name'])) { |
|
20 | - throw new BadParam('Territory name must be provided'); |
|
21 | - } |
|
17 | + public static function fromArray(array $params) |
|
18 | + { |
|
19 | + if (!isset($params['territory_name'])) { |
|
20 | + throw new BadParam('Territory name must be provided'); |
|
21 | + } |
|
22 | 22 | |
23 | - if (!isset($params['territory_color'])) { |
|
24 | - throw new BadParam('Territory color must be provided'); |
|
25 | - } |
|
23 | + if (!isset($params['territory_color'])) { |
|
24 | + throw new BadParam('Territory color must be provided'); |
|
25 | + } |
|
26 | 26 | |
27 | - if (!isset($params['territory'])) { |
|
28 | - throw new BadParam('Territory must be provided'); |
|
29 | - } |
|
27 | + if (!isset($params['territory'])) { |
|
28 | + throw new BadParam('Territory must be provided'); |
|
29 | + } |
|
30 | 30 | |
31 | - $avoidanceZoneParameters = new AvoidanceZone(); |
|
31 | + $avoidanceZoneParameters = new AvoidanceZone(); |
|
32 | 32 | |
33 | - foreach($params as $key => $value) { |
|
34 | - if (property_exists($avoidanceZoneParameters, $key)) { |
|
35 | - $avoidanceZoneParameters->{$key} = $value; |
|
36 | - } |
|
37 | - } |
|
33 | + foreach($params as $key => $value) { |
|
34 | + if (property_exists($avoidanceZoneParameters, $key)) { |
|
35 | + $avoidanceZoneParameters->{$key} = $value; |
|
36 | + } |
|
37 | + } |
|
38 | 38 | |
39 | - return $avoidanceZoneParameters; |
|
40 | - } |
|
39 | + return $avoidanceZoneParameters; |
|
40 | + } |
|
41 | 41 | |
42 | - public static function getAvoidanceZone($territory_id) |
|
43 | - { |
|
44 | - $avoidanceZone = Route4Me::makeRequst(array( |
|
45 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
46 | - 'method' => 'GET', |
|
47 | - 'query' => array( |
|
48 | - 'territory_id' => $territory_id |
|
49 | - ) |
|
50 | - )); |
|
42 | + public static function getAvoidanceZone($territory_id) |
|
43 | + { |
|
44 | + $avoidanceZone = Route4Me::makeRequst(array( |
|
45 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
46 | + 'method' => 'GET', |
|
47 | + 'query' => array( |
|
48 | + 'territory_id' => $territory_id |
|
49 | + ) |
|
50 | + )); |
|
51 | 51 | |
52 | - return $avoidanceZone; |
|
53 | - } |
|
52 | + return $avoidanceZone; |
|
53 | + } |
|
54 | 54 | |
55 | - public static function getAvoidanceZones($params) |
|
56 | - { |
|
57 | - $avoidanceZones = Route4Me::makeRequst(array( |
|
58 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
59 | - 'method' => 'GET', |
|
60 | - 'query' => array( |
|
61 | - 'offset' => isset($params->offset) ? $params->offset : null, |
|
62 | - 'limit' => isset($params->limit) ? $params->limit : null, |
|
63 | - ) |
|
64 | - )); |
|
55 | + public static function getAvoidanceZones($params) |
|
56 | + { |
|
57 | + $avoidanceZones = Route4Me::makeRequst(array( |
|
58 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
59 | + 'method' => 'GET', |
|
60 | + 'query' => array( |
|
61 | + 'offset' => isset($params->offset) ? $params->offset : null, |
|
62 | + 'limit' => isset($params->limit) ? $params->limit : null, |
|
63 | + ) |
|
64 | + )); |
|
65 | 65 | |
66 | - return $avoidanceZones; |
|
67 | - } |
|
66 | + return $avoidanceZones; |
|
67 | + } |
|
68 | 68 | |
69 | - public static function addAvoidanceZone($params) |
|
70 | - { |
|
71 | - $terParams = array(); |
|
69 | + public static function addAvoidanceZone($params) |
|
70 | + { |
|
71 | + $terParams = array(); |
|
72 | 72 | |
73 | - if (isset($params->territory['type'])) { |
|
74 | - $terParams['type'] = $params->territory['type']; |
|
75 | - } |
|
73 | + if (isset($params->territory['type'])) { |
|
74 | + $terParams['type'] = $params->territory['type']; |
|
75 | + } |
|
76 | 76 | |
77 | - if (isset($params->territory['data'])) { |
|
78 | - $terParams['data'] = $params->territory['data']; |
|
79 | - } |
|
77 | + if (isset($params->territory['data'])) { |
|
78 | + $terParams['data'] = $params->territory['data']; |
|
79 | + } |
|
80 | 80 | |
81 | - $abContacts = Route4Me::makeRequst(array( |
|
82 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
83 | - 'method' => 'POST', |
|
84 | - 'body' => array( |
|
85 | - 'territory_name' => isset($params->territory_name) ? $params->territory_name : null, |
|
86 | - 'territory_color' => isset($params->territory_color) ? $params->territory_color : null, |
|
87 | - 'territory' => $terParams |
|
88 | - ) |
|
89 | - )); |
|
81 | + $abContacts = Route4Me::makeRequst(array( |
|
82 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
83 | + 'method' => 'POST', |
|
84 | + 'body' => array( |
|
85 | + 'territory_name' => isset($params->territory_name) ? $params->territory_name : null, |
|
86 | + 'territory_color' => isset($params->territory_color) ? $params->territory_color : null, |
|
87 | + 'territory' => $terParams |
|
88 | + ) |
|
89 | + )); |
|
90 | 90 | |
91 | - return $abContacts; |
|
92 | - } |
|
91 | + return $abContacts; |
|
92 | + } |
|
93 | 93 | |
94 | - public function deleteAvoidanceZone($territory_id) |
|
95 | - { |
|
96 | - $result = Route4Me::makeRequst(array( |
|
97 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
98 | - 'method' => 'DELETEARRAY', |
|
99 | - 'query' => array( |
|
100 | - 'territory_id' => $territory_id |
|
101 | - ) |
|
102 | - )); |
|
94 | + public function deleteAvoidanceZone($territory_id) |
|
95 | + { |
|
96 | + $result = Route4Me::makeRequst(array( |
|
97 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
98 | + 'method' => 'DELETEARRAY', |
|
99 | + 'query' => array( |
|
100 | + 'territory_id' => $territory_id |
|
101 | + ) |
|
102 | + )); |
|
103 | 103 | |
104 | - return $result; |
|
105 | - } |
|
104 | + return $result; |
|
105 | + } |
|
106 | 106 | |
107 | - public function updateAvoidanceZone($params) |
|
108 | - { |
|
109 | - $avoidanceZone = Route4Me::makeRequst(array( |
|
110 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
111 | - 'method' => 'PUT', |
|
112 | - 'body' => $params, |
|
113 | - )); |
|
107 | + public function updateAvoidanceZone($params) |
|
108 | + { |
|
109 | + $avoidanceZone = Route4Me::makeRequst(array( |
|
110 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
111 | + 'method' => 'PUT', |
|
112 | + 'body' => $params, |
|
113 | + )); |
|
114 | 114 | |
115 | - return $avoidanceZone; |
|
116 | - } |
|
115 | + return $avoidanceZone; |
|
116 | + } |
|
117 | 117 | } |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | Route4Me::setApiKey('11111111111111111111111111111111'); |
15 | 15 | |
16 | 16 | $activityParameters = ActivityParameters::fromArray(array( |
17 | - "limit" => 10, |
|
18 | - "offset" => 0 |
|
17 | + "limit" => 10, |
|
18 | + "offset" => 0 |
|
19 | 19 | )); |
20 | 20 | |
21 | 21 | $activities = new ActivityParameters(); |
@@ -23,6 +23,6 @@ discard block |
||
23 | 23 | $results = $activities->getValue($actresults, "results"); |
24 | 24 | |
25 | 25 | foreach ($results as $result) { |
26 | - Route4Me::simplePrint($result); |
|
27 | - echo "<br>"; |
|
26 | + Route4Me::simplePrint($result); |
|
27 | + echo "<br>"; |
|
28 | 28 | } |
@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | Route4Me::setApiKey('11111111111111111111111111111111'); |
17 | 17 | |
18 | 18 | $activityParameters = ActivityParameters::fromArray(array( |
19 | - "limit" => 10, |
|
20 | - "offset" => 0, |
|
21 | - "start" => strtotime("-1 week") |
|
19 | + "limit" => 10, |
|
20 | + "offset" => 0, |
|
21 | + "start" => strtotime("-1 week") |
|
22 | 22 | )); |
23 | 23 | |
24 | 24 | $activities = new ActivityParameters(); |
@@ -26,6 +26,6 @@ discard block |
||
26 | 26 | $results = $activities->getValue($actresults, "results"); |
27 | 27 | |
28 | 28 | foreach ($results as $result) { |
29 | - Route4Me::simplePrint($result); |
|
30 | - echo "<br>"; |
|
29 | + Route4Me::simplePrint($result); |
|
30 | + echo "<br>"; |
|
31 | 31 | } |
@@ -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\Enum\DeviceType; |
@@ -27,16 +27,16 @@ discard block |
||
27 | 27 | // Set GPS postion to the selected route |
28 | 28 | // Set right member_id corresponding to the API key |
29 | 29 | $params = TrackSetParams::fromArray(array( |
30 | - 'format' => Format::SERIALIZED, |
|
31 | - 'route_id' => $routeId, |
|
32 | - 'member_id' => 105323, |
|
33 | - 'course' => 3, |
|
34 | - 'speed' => 100, |
|
35 | - 'lat' => 41.8927521, |
|
36 | - 'lng' => -109.0803888, |
|
37 | - 'device_type' => DeviceType::IPHONE, |
|
38 | - 'device_guid' => 'qweqweqwe', |
|
39 | - 'device_timestamp' => date('Y-m-d H:i:s') |
|
30 | + 'format' => Format::SERIALIZED, |
|
31 | + 'route_id' => $routeId, |
|
32 | + 'member_id' => 105323, |
|
33 | + 'course' => 3, |
|
34 | + 'speed' => 100, |
|
35 | + 'lat' => 41.8927521, |
|
36 | + 'lng' => -109.0803888, |
|
37 | + 'device_type' => DeviceType::IPHONE, |
|
38 | + 'device_guid' => 'qweqweqwe', |
|
39 | + 'device_timestamp' => date('Y-m-d H:i:s') |
|
40 | 40 | )); |
41 | 41 | |
42 | 42 | $status = Track::set($params); |
@@ -46,24 +46,24 @@ discard block |
||
46 | 46 | assert($status['status'], "Can't send GPS position to the selected route"); |
47 | 47 | |
48 | 48 | if (!$status) { |
49 | - echo "Setting of GPS position failed"; |
|
50 | - return; |
|
49 | + echo "Setting of GPS position failed"; |
|
50 | + return; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | $params = array( |
54 | - 'route_id' => $routeId, |
|
55 | - 'device_tracking_history' => '1' |
|
54 | + 'route_id' => $routeId, |
|
55 | + 'device_tracking_history' => '1' |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | $result = $route->GetLastLocation($params); |
59 | 59 | |
60 | 60 | if (isset($result->tracking_history)) { |
61 | - foreach ($result->tracking_history as $history) { |
|
62 | - echo "Speed --> ".$history['s']."<br>"; |
|
63 | - echo "course --> ".$history['d']."<br>"; |
|
64 | - echo "Timestamp --> ".$history['ts_friendly']."<br>"; |
|
65 | - echo "Latitude --> ".$history['lt']."<br>"; |
|
66 | - echo "Longitude --> ".$history['lg']."<br>"; |
|
67 | - echo "========================================<br><br>"; |
|
68 | - } |
|
61 | + foreach ($result->tracking_history as $history) { |
|
62 | + echo "Speed --> ".$history['s']."<br>"; |
|
63 | + echo "course --> ".$history['d']."<br>"; |
|
64 | + echo "Timestamp --> ".$history['ts_friendly']."<br>"; |
|
65 | + echo "Latitude --> ".$history['lt']."<br>"; |
|
66 | + echo "Longitude --> ".$history['lg']."<br>"; |
|
67 | + echo "========================================<br><br>"; |
|
68 | + } |
|
69 | 69 | } |