1 | <?php |
||
20 | class Location extends BaseElement { |
||
21 | |||
22 | /** |
||
23 | * @since 3.0 |
||
24 | * |
||
25 | * @var LatLongValue |
||
26 | */ |
||
27 | protected $coordinates; |
||
28 | |||
29 | /** |
||
30 | * @since 0.7.1 |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $address; |
||
35 | |||
36 | /** |
||
37 | * @since 0.7.2 |
||
38 | * |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $icon = ''; |
||
42 | |||
43 | /** |
||
44 | * @since 2.0 |
||
45 | * |
||
46 | * @var string |
||
47 | */ |
||
48 | protected $group = ''; |
||
49 | |||
50 | /** |
||
51 | * @var string |
||
52 | * @since 2.0 |
||
53 | */ |
||
54 | protected $inlineLabel = ''; |
||
55 | |||
56 | /** |
||
57 | * @var string |
||
58 | * @since 2.0 |
||
59 | */ |
||
60 | protected $visitedIcon = ''; |
||
61 | |||
62 | /** |
||
63 | * Creates and returns a new instance of a Location from a latitude and longitude. |
||
64 | * |
||
65 | * @since 1.0 |
||
66 | * |
||
67 | * @param float $lat |
||
68 | * @param float $lon |
||
69 | * |
||
70 | * @return Location |
||
71 | */ |
||
72 | public static function newFromLatLon( $lat, $lon ) { |
||
75 | |||
76 | |||
77 | /** |
||
78 | * Creates and returns a new instance of a Location with title from a latitude and longitude. |
||
79 | * |
||
80 | * @since 3.7 |
||
81 | * |
||
82 | * @param float $lat |
||
83 | * @param float $lon |
||
84 | * |
||
85 | * @return Location |
||
86 | */ |
||
87 | public static function newTitledFromLatLon( $lat, $lon ) { |
||
92 | |||
93 | /** |
||
94 | * Creates and returns a new instance of a Location from an address. |
||
95 | * |
||
96 | * @since 1.0 |
||
97 | * |
||
98 | * @param string $address |
||
99 | * @deprecated |
||
100 | * |
||
101 | * @return Location |
||
102 | * @throws MWException |
||
103 | */ |
||
104 | public static function newFromAddress( $address ) { |
||
113 | |||
114 | /** |
||
115 | * Constructor. |
||
116 | * |
||
117 | * @param LatLongValue $coordinates |
||
118 | * |
||
119 | * @since 3.0 |
||
120 | */ |
||
121 | public function __construct( LatLongValue $coordinates ) { |
||
125 | |||
126 | /** |
||
127 | * Sets the location to a set of coordinates. You can provide a string |
||
128 | * of raw coordinates, an array with lat and lon values and false. |
||
129 | * |
||
130 | * @since 3.0 |
||
131 | * |
||
132 | * @param LatLongValue $coordinates |
||
133 | */ |
||
134 | public function setCoordinates( LatLongValue $coordinates ) { |
||
137 | |||
138 | /** |
||
139 | * Sets the location to an address. |
||
140 | * |
||
141 | * @since 0.7.1 |
||
142 | * |
||
143 | * @param string $address |
||
144 | * @param boolean $asActualLocation When set to false, the location is not changed, only the address string is. |
||
145 | * |
||
146 | * @return boolean Success indicator |
||
147 | */ |
||
148 | public function setAddress( $address, $asActualLocation = true ) { |
||
163 | |||
164 | /** |
||
165 | * Returns the locations coordinates. |
||
166 | * |
||
167 | * @since 3.0 |
||
168 | * |
||
169 | * @return LatLongValue |
||
170 | */ |
||
171 | public function getCoordinates() { |
||
174 | |||
175 | /** |
||
176 | * Returns the address corresponding to this location. |
||
177 | * If there is none, and empty sting is returned. |
||
178 | * |
||
179 | * @since 0.7.1 |
||
180 | * |
||
181 | * @return string |
||
182 | */ |
||
183 | public function getAddress() { |
||
190 | |||
191 | |||
192 | /** |
||
193 | * Returns if there is any icon. |
||
194 | * |
||
195 | * @since 1.0 |
||
196 | * |
||
197 | * @return boolean |
||
198 | */ |
||
199 | public function hasIcon() { |
||
202 | |||
203 | /** |
||
204 | * Sets the icon |
||
205 | * |
||
206 | * @since 0.7.2 |
||
207 | * |
||
208 | * @param string $icon |
||
209 | */ |
||
210 | public function setIcon( $icon ) { |
||
213 | |||
214 | /** |
||
215 | * Sets the group |
||
216 | * |
||
217 | * @since 2.0 |
||
218 | * |
||
219 | * @param string $group |
||
220 | */ |
||
221 | public function setGroup( $group ) { |
||
224 | |||
225 | /** |
||
226 | * Returns the icon. |
||
227 | * |
||
228 | * @since 0.7.2 |
||
229 | * |
||
230 | * @return string |
||
231 | */ |
||
232 | public function getIcon() { |
||
235 | |||
236 | /** |
||
237 | * Returns the group. |
||
238 | * |
||
239 | * @since 2.0 |
||
240 | * |
||
241 | * @return string |
||
242 | */ |
||
243 | public function getGroup() { |
||
246 | |||
247 | /** |
||
248 | * Returns whether Location is assigned to a group. |
||
249 | * |
||
250 | * @since 2.0 |
||
251 | * |
||
252 | * @return string |
||
253 | */ |
||
254 | public function hasGroup() { |
||
257 | |||
258 | /** |
||
259 | * @return string |
||
260 | * @since 2.0 |
||
261 | */ |
||
262 | public function getInlineLabel(){ |
||
265 | |||
266 | /** |
||
267 | * @param $label |
||
268 | * @since 2.0 |
||
269 | */ |
||
270 | public function setInlineLabel($label){ |
||
273 | |||
274 | /** |
||
275 | * @return bool |
||
276 | * @since 2.0 |
||
277 | */ |
||
278 | public function hasInlineLabel(){ |
||
281 | |||
282 | /** |
||
283 | * @return string |
||
284 | * @since 2.0 |
||
285 | */ |
||
286 | public function getVisitedIcon() { |
||
289 | |||
290 | /** |
||
291 | * @param $visitedIcon |
||
292 | * @since 2.0 |
||
293 | */ |
||
294 | public function setVisitedIcon( $visitedIcon ) { |
||
297 | |||
298 | /** |
||
299 | * @return bool |
||
300 | * @since 2.0 |
||
301 | */ |
||
302 | public function hasVisitedIcon(){ |
||
305 | |||
306 | /** |
||
307 | * Returns an object that can directly be converted to JS using json_encode or similar. |
||
308 | * |
||
309 | * FIXME: complexity |
||
310 | * |
||
311 | * @since 1.0 |
||
312 | * |
||
313 | * @param string $defText |
||
314 | * @param string $defTitle |
||
315 | * @param string $defIconUrl |
||
316 | * @param string $defGroup |
||
317 | * @param string $defInlineLabel |
||
318 | * @param string $defVisitedIcon |
||
319 | * |
||
320 | * @return array |
||
321 | */ |
||
322 | public function getJSONObject( $defText = '', $defTitle = '', $defIconUrl = '', $defGroup = '', $defInlineLabel = '', $defVisitedIcon = '' ) { |
||
338 | |||
339 | } |
||
340 |
This method has been deprecated.