@@ -192,24 +192,24 @@ public function testDistance()
192192 $ loc3 ->location = new Point (3 , 3 ); // Distance from loc1: 2.8284271247462
193193 $ loc3 ->save ();
194194
195- $ a = GeometryModel::distance (2 , $ loc1 ->location , ' location ' )->get ();
195+ $ a = GeometryModel::distance (' location ' , $ loc1 ->location , 2 )->get ();
196196 $ this ->assertCount (2 , $ a );
197- $ this ->assertTrue ($ a ->contains ($ loc1 ));
198- $ this ->assertTrue ($ a ->contains ($ loc2 ));
199- $ this ->assertFalse ($ a ->contains ($ loc3 ));
197+ $ this ->assertTrue ($ a ->contains (' location ' , $ loc1-> location ));
198+ $ this ->assertTrue ($ a ->contains (' location ' , $ loc2-> location ));
199+ $ this ->assertFalse ($ a ->contains (' location ' , $ loc3-> location ));
200200
201201 // Excluding self
202- $ b = GeometryModel::distance (2 , $ loc1 ->location , ' location ' , true )->get ();
202+ $ b = GeometryModel::distance (' location ' , $ loc1 ->location , 2 , true )->get ();
203203 $ this ->assertCount (1 , $ b );
204- $ this ->assertFalse ($ b ->contains ($ loc1 ));
205- $ this ->assertTrue ($ b ->contains ($ loc2 ));
206- $ this ->assertFalse ($ b ->contains ($ loc3 ));
204+ $ this ->assertFalse ($ b ->contains (' location ' , $ loc1-> location ));
205+ $ this ->assertTrue ($ b ->contains (' location ' , $ loc2-> location ));
206+ $ this ->assertFalse ($ b ->contains (' location ' , $ loc3-> location ));
207207
208- $ c = GeometryModel::distance (1 , $ loc1 ->location , ' location ' )->get ();
208+ $ c = GeometryModel::distance (' location ' , $ loc1 ->location , 1 )->get ();
209209 $ this ->assertCount (1 , $ c );
210- $ this ->assertTrue ($ c ->contains ($ loc1 ));
211- $ this ->assertFalse ($ c ->contains ($ loc2 ));
212- $ this ->assertFalse ($ c ->contains ($ loc3 ));
210+ $ this ->assertTrue ($ c ->contains (' location ' , $ loc1-> location ));
211+ $ this ->assertFalse ($ c ->contains (' location ' , $ loc2-> location ));
212+ $ this ->assertFalse ($ c ->contains (' location ' , $ loc3-> location ));
213213 }
214214
215215 public function testDistanceSphere ()
@@ -226,24 +226,24 @@ public function testDistanceSphere()
226226 $ loc3 ->location = new Point (40.761434 , -73.977619 ); // Distance from loc1: 870.06424066202
227227 $ loc3 ->save ();
228228
229- $ a = GeometryModel::distanceSphere (200 , $ loc1 ->location , ' location ' )->get ();
229+ $ a = GeometryModel::distanceSphere (' location ' , $ loc1 ->location , 200 )->get ();
230230 $ this ->assertCount (2 , $ a );
231- $ this ->assertTrue ($ a ->contains ($ loc1 ));
232- $ this ->assertTrue ($ a ->contains ($ loc2 ));
233- $ this ->assertFalse ($ a ->contains ($ loc3 ));
231+ $ this ->assertTrue ($ a ->contains (' location ' , $ loc1-> location ));
232+ $ this ->assertTrue ($ a ->contains (' location ' , $ loc2-> location ));
233+ $ this ->assertFalse ($ a ->contains (' location ' , $ loc3-> location ));
234234
235235 // Excluding self
236- $ b = GeometryModel::distanceSphere (200 , $ loc1 ->location , ' location ' , true )->get ();
236+ $ b = GeometryModel::distanceSphere (' location ' , $ loc1 ->location , 200 , true )->get ();
237237 $ this ->assertCount (1 , $ b );
238- $ this ->assertFalse ($ b ->contains ($ loc1 ));
239- $ this ->assertTrue ($ b ->contains ($ loc2 ));
240- $ this ->assertFalse ($ b ->contains ($ loc3 ));
238+ $ this ->assertFalse ($ b ->contains (' location ' , $ loc1-> location ));
239+ $ this ->assertTrue ($ b ->contains (' location ' , $ loc2-> location ));
240+ $ this ->assertFalse ($ b ->contains (' location ' , $ loc3-> location ));
241241
242- $ c = GeometryModel::distanceSphere (44.741406484587 , $ loc1 ->location , ' location ' )->get ();
242+ $ c = GeometryModel::distanceSphere (' location ' , $ loc1 ->location , 44.741406484587 )->get ();
243243 $ this ->assertCount (1 , $ c );
244- $ this ->assertTrue ($ c ->contains ($ loc1 ));
245- $ this ->assertFalse ($ c ->contains ($ loc2 ));
246- $ this ->assertFalse ($ c ->contains ($ loc3 ));
244+ $ this ->assertTrue ($ c ->contains (' location ' , $ loc1-> location ));
245+ $ this ->assertFalse ($ c ->contains (' location ' , $ loc2-> location ));
246+ $ this ->assertFalse ($ c ->contains (' location ' , $ loc3-> location ));
247247 }
248248
249249 public function testDistanceValue ()
@@ -256,7 +256,7 @@ public function testDistanceValue()
256256 $ loc2 ->location = new Point (2 , 2 ); // Distance from loc1: 1.4142135623731
257257 $ loc2 ->save ();
258258
259- $ a = GeometryModel::distanceValue ($ loc1 ->location , ' location ' )->get ();
259+ $ a = GeometryModel::distanceValue (' location ' , $ loc1 ->location )->get ();
260260 $ this ->assertCount (2 , $ a );
261261 $ this ->assertEquals (0 , $ a [0 ]->distance );
262262 $ this ->assertEquals (1.4142135623 , $ a [1 ]->distance ); // PHP floats' 11th+ digits don't matter
@@ -271,41 +271,41 @@ public function testDistanceSphereValue() {
271271 $ loc2 ->location = new Point (40.767664 , -73.971271 ); // Distance from loc1: 44.741406484588
272272 $ loc2 ->save ();
273273
274- $ a = GeometryModel::distanceSphereValue ($ loc1 ->location , ' location ' )->get ();
274+ $ a = GeometryModel::distanceSphereValue (' location ' , $ loc1 ->location )->get ();
275275 $ this ->assertCount (2 , $ a );
276276 $ this ->assertEquals (0 , $ a [0 ]->distance );
277277 $ this ->assertEquals (44.7414064845 , $ a [1 ]->distance ); // PHP floats' 11th+ digits don't matter
278278 }
279279
280- public function testBounding () {
281- $ point = new Point (0 , 0 );
282-
283- $ linestring1 = \Grimzy \LaravelMysqlSpatial \Types \LineString::fromWkt ("LINESTRING(1 1, 2 2) " );
284- $ linestring2 = \Grimzy \LaravelMysqlSpatial \Types \LineString::fromWkt ("LINESTRING(20 20, 24 24) " );
285- $ linestring3 = \Grimzy \LaravelMysqlSpatial \Types \LineString::fromWkt ("LINESTRING(0 10, 10 10) " );
286-
287- $ geo1 = new GeometryModel ();
288- $ geo1 ->location = $ point ;
289- $ geo1 ->line = $ linestring1 ;
290- $ geo1 ->save ();
291-
292- $ geo2 = new GeometryModel ();
293- $ geo2 ->location = $ point ;
294- $ geo2 ->line = $ linestring2 ;
295- $ geo2 ->save ();
296-
297- $ geo3 = new GeometryModel ();
298- $ geo3 ->location = $ point ;
299- $ geo3 ->line = $ linestring3 ;
300- $ geo3 ->save ();
301-
302- $ polygon = Polygon::fromWKT ("POLYGON((0 10,10 10,10 0,0 0,0 10)) " );
303-
304- $ result = GeometryModel::Bounding ($ polygon , 'line ' )->get ();
305- $ this ->assertCount (2 , $ result );
306- $ this ->assertTrue ($ result ->contains ($ geo1 ));
307- $ this ->assertFalse ($ result ->contains ($ geo2 ));
308- $ this ->assertTrue ($ result ->contains ($ geo3 ));
309-
310- }
280+ // public function testBounding() {
281+ // $point = new Point(0, 0);
282+ //
283+ // $linestring1 = \Grimzy\LaravelMysqlSpatial\Types\LineString::fromWkt("LINESTRING(1 1, 2 2)");
284+ // $linestring2 = \Grimzy\LaravelMysqlSpatial\Types\LineString::fromWkt("LINESTRING(20 20, 24 24)");
285+ // $linestring3 = \Grimzy\LaravelMysqlSpatial\Types\LineString::fromWkt("LINESTRING(0 10, 10 10)");
286+ //
287+ // $geo1 = new GeometryModel();
288+ // $geo1->location = $point;
289+ // $geo1->line = $linestring1;
290+ // $geo1->save();
291+ //
292+ // $geo2 = new GeometryModel();
293+ // $geo2->location = $point;
294+ // $geo2->line = $linestring2;
295+ // $geo2->save();
296+ //
297+ // $geo3 = new GeometryModel();
298+ // $geo3->location = $point;
299+ // $geo3->line = $linestring3;
300+ // $geo3->save();
301+ //
302+ // $polygon = Polygon::fromWKT("POLYGON((0 10,10 10,10 0,0 0,0 10))");
303+ //
304+ // $result = GeometryModel::Bounding($polygon, 'line')->get();
305+ // $this->assertCount(2, $result);
306+ // $this->assertTrue($result->contains($geo1));
307+ // $this->assertFalse($result->contains($geo2));
308+ // $this->assertTrue($result->contains($geo3));
309+ //
310+ // }
311311}
0 commit comments