1 | <?php |
||
25 | class BoundingBox implements BoundingBoxInterface |
||
26 | { |
||
27 | /** |
||
28 | * The latitude of the north coordinate |
||
29 | * |
||
30 | * @var float|string|integer |
||
31 | */ |
||
32 | private $north; |
||
33 | |||
34 | /** |
||
35 | * The longitude of the east coordinate |
||
36 | * |
||
37 | * @var float|string|integer |
||
38 | */ |
||
39 | private $east; |
||
40 | |||
41 | /** |
||
42 | * The latitude of the south coordinate |
||
43 | * |
||
44 | * @var float|string|integer |
||
45 | */ |
||
46 | private $south; |
||
47 | |||
48 | /** |
||
49 | * The longitude of the west coordinate |
||
50 | * |
||
51 | * @var float|string|integer |
||
52 | */ |
||
53 | private $west; |
||
54 | |||
55 | /** |
||
56 | * @var boolean |
||
57 | */ |
||
58 | private $hasCoordinate = false; |
||
59 | |||
60 | /** |
||
61 | * @var Ellipsoid |
||
62 | */ |
||
63 | private $ellipsoid; |
||
64 | |||
65 | /** |
||
66 | * @var integer |
||
67 | */ |
||
68 | private $precision = 8; |
||
69 | |||
70 | /** |
||
71 | * @param PolygonInterface|CoordinateInterface $object |
||
72 | */ |
||
73 | 38 | public function __construct($object = null) |
|
83 | |||
84 | 38 | private function createBoundingBoxForPolygon(PolygonInterface $polygon) |
|
92 | |||
93 | /** |
||
94 | * @param CoordinateInterface $coordinate |
||
95 | */ |
||
96 | 32 | private function addCoordinate(CoordinateInterface $coordinate) |
|
129 | |||
130 | /** |
||
131 | * @param CoordinateInterface $coordinate |
||
132 | * @return bool |
||
133 | */ |
||
134 | 4 | public function pointInBoundingBox(CoordinateInterface $coordinate) |
|
146 | |||
147 | /** |
||
148 | * @return PolygonInterface |
||
149 | */ |
||
150 | 3 | public function getAsPolygon() |
|
171 | |||
172 | /** |
||
173 | * @param PolygonInterface $polygon |
||
174 | * @return $this |
||
175 | */ |
||
176 | 38 | public function setPolygon(PolygonInterface $polygon) |
|
182 | |||
183 | /** |
||
184 | * {@inheritDoc} |
||
185 | */ |
||
186 | 18 | public function getNorth() |
|
190 | |||
191 | /** |
||
192 | * @param float|string|integer $north |
||
193 | * @return $this |
||
194 | */ |
||
195 | 32 | public function setNorth($north) |
|
201 | |||
202 | /** |
||
203 | * {@inheritDoc} |
||
204 | */ |
||
205 | 18 | public function getEast() |
|
209 | |||
210 | /** |
||
211 | * @param float|string|integer $east |
||
212 | * @return $this |
||
213 | */ |
||
214 | 32 | public function setEast($east) |
|
220 | |||
221 | /** |
||
222 | * {@inheritDoc} |
||
223 | */ |
||
224 | 18 | public function getSouth() |
|
228 | |||
229 | /** |
||
230 | * @param float|string|integer $south |
||
231 | * @return $this |
||
232 | */ |
||
233 | 32 | public function setSouth($south) |
|
239 | |||
240 | /** |
||
241 | * {@inheritDoc} |
||
242 | */ |
||
243 | 18 | public function getWest() |
|
247 | |||
248 | /** |
||
249 | * @param float|string|integer $west |
||
250 | * @return $this |
||
251 | */ |
||
252 | 32 | public function setWest($west) |
|
258 | |||
259 | /** |
||
260 | * @return integer |
||
261 | */ |
||
262 | 18 | public function getPrecision() |
|
266 | |||
267 | /** |
||
268 | * @param integer $precision |
||
269 | * @return $this |
||
270 | */ |
||
271 | 1 | public function setPrecision($precision) |
|
277 | |||
278 | /** |
||
279 | * @param BoundingBoxInterface $boundingBox |
||
280 | * @return BoundingBoxInterface |
||
281 | */ |
||
282 | 2 | public function merge(BoundingBoxInterface $boundingBox) |
|
293 | } |
||
294 |