1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Ivory Google Map package. |
5
|
|
|
* |
6
|
|
|
* (c) Eric GELOEN <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please read the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Ivory\GoogleMap\Service\Direction\Response; |
13
|
|
|
|
14
|
|
|
use Ivory\GoogleMap\Base\Coordinate; |
15
|
|
|
use Ivory\GoogleMap\Overlay\EncodedPolyline; |
16
|
|
|
use Ivory\GoogleMap\Service\Base\Distance; |
17
|
|
|
use Ivory\GoogleMap\Service\Base\Duration; |
18
|
|
|
use Ivory\GoogleMap\Service\Direction\Response\Transit\DirectionTransitDetails; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @see http://code.google.com/apis/maps/documentation/javascript/reference.html#DirectionStep |
22
|
|
|
* |
23
|
|
|
* @author GeLo <[email protected]> |
24
|
|
|
*/ |
25
|
|
|
class DirectionStep |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
|
|
* @var Distance|null |
29
|
|
|
*/ |
30
|
|
|
private $distance; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var Duration|null |
34
|
|
|
*/ |
35
|
|
|
private $duration; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var Coordinate|null |
39
|
|
|
*/ |
40
|
|
|
private $endLocation; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var string|null |
44
|
|
|
*/ |
45
|
|
|
private $instructions; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var EncodedPolyline|null |
49
|
|
|
*/ |
50
|
|
|
private $encodedPolyline; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var Coordinate|null |
54
|
|
|
*/ |
55
|
|
|
private $startLocation; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var string|null |
59
|
|
|
*/ |
60
|
|
|
private $travelMode; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var DirectionTransitDetails|null |
64
|
|
|
*/ |
65
|
|
|
private $transitDetails; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return bool |
69
|
|
|
*/ |
70
|
|
|
public function hasDistance() |
71
|
|
|
{ |
72
|
|
|
return $this->distance !== null; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @return Distance|null |
77
|
|
|
*/ |
78
|
|
|
public function getDistance() |
79
|
|
|
{ |
80
|
|
|
return $this->distance; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @param Distance|null $distance |
85
|
|
|
*/ |
86
|
|
|
public function setDistance(Distance $distance = null) |
87
|
|
|
{ |
88
|
|
|
$this->distance = $distance; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return bool |
93
|
|
|
*/ |
94
|
|
|
public function hasDuration() |
95
|
|
|
{ |
96
|
|
|
return $this->duration !== null; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return Duration|null |
101
|
|
|
*/ |
102
|
|
|
public function getDuration() |
103
|
|
|
{ |
104
|
|
|
return $this->duration; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @param Duration|null $duration |
109
|
|
|
*/ |
110
|
|
|
public function setDuration(Duration $duration = null) |
111
|
|
|
{ |
112
|
|
|
$this->duration = $duration; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @return bool |
117
|
|
|
*/ |
118
|
|
|
public function hasEndLocation() |
119
|
|
|
{ |
120
|
|
|
return $this->endLocation !== null; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @return Coordinate|null |
125
|
|
|
*/ |
126
|
|
|
public function getEndLocation() |
127
|
|
|
{ |
128
|
|
|
return $this->endLocation; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @param Coordinate|null $endLocation |
133
|
|
|
*/ |
134
|
|
|
public function setEndLocation(Coordinate $endLocation = null) |
135
|
|
|
{ |
136
|
|
|
$this->endLocation = $endLocation; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @return bool |
141
|
|
|
*/ |
142
|
|
|
public function hasInstructions() |
143
|
|
|
{ |
144
|
|
|
return $this->instructions !== null; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @return string|null |
149
|
|
|
*/ |
150
|
|
|
public function getInstructions() |
151
|
|
|
{ |
152
|
|
|
return $this->instructions; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @param string|null $instructions |
157
|
|
|
*/ |
158
|
|
|
public function setInstructions($instructions = null) |
159
|
|
|
{ |
160
|
|
|
$this->instructions = $instructions; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @return bool |
165
|
|
|
*/ |
166
|
|
|
public function hasEncodedPolyline() |
167
|
|
|
{ |
168
|
|
|
return $this->encodedPolyline !== null; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* @return EncodedPolyline|null |
173
|
|
|
*/ |
174
|
|
|
public function getEncodedPolyline() |
175
|
|
|
{ |
176
|
|
|
return $this->encodedPolyline; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @param EncodedPolyline|null $encodedPolyline |
181
|
|
|
*/ |
182
|
|
|
public function setEncodedPolyline(EncodedPolyline $encodedPolyline = null) |
183
|
|
|
{ |
184
|
|
|
$this->encodedPolyline = $encodedPolyline; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* @return bool |
189
|
|
|
*/ |
190
|
|
|
public function hasStartLocation() |
191
|
|
|
{ |
192
|
|
|
return $this->startLocation !== null; |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* @return Coordinate|null |
197
|
|
|
*/ |
198
|
|
|
public function getStartLocation() |
199
|
|
|
{ |
200
|
|
|
return $this->startLocation; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* @param Coordinate|null $startLocation |
205
|
|
|
*/ |
206
|
|
|
public function setStartLocation(Coordinate $startLocation = null) |
207
|
|
|
{ |
208
|
|
|
$this->startLocation = $startLocation; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @return bool |
213
|
|
|
*/ |
214
|
|
|
public function hasTravelMode() |
215
|
|
|
{ |
216
|
|
|
return $this->travelMode !== null; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* @return string|null |
221
|
|
|
*/ |
222
|
|
|
public function getTravelMode() |
223
|
|
|
{ |
224
|
|
|
return $this->travelMode; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* @param string|null $travelMode |
229
|
|
|
*/ |
230
|
|
|
public function setTravelMode($travelMode = null) |
231
|
|
|
{ |
232
|
|
|
$this->travelMode = $travelMode; |
233
|
|
|
} |
234
|
|
|
|
235
|
|
|
/** |
236
|
|
|
* @return bool |
237
|
|
|
*/ |
238
|
|
|
public function hasTransitDetails() |
239
|
|
|
{ |
240
|
|
|
return $this->transitDetails !== null; |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
/** |
244
|
|
|
* @return DirectionTransitDetails|null |
245
|
|
|
*/ |
246
|
|
|
public function getTransitDetails() |
247
|
|
|
{ |
248
|
|
|
return $this->transitDetails; |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
/** |
252
|
|
|
* @param DirectionTransitDetails|null $transitDetails |
253
|
|
|
*/ |
254
|
|
|
public function setTransitDetails(DirectionTransitDetails $transitDetails = null) |
255
|
|
|
{ |
256
|
|
|
$this->transitDetails = $transitDetails; |
257
|
|
|
} |
258
|
|
|
} |
259
|
|
|
|