コード例 #1
0
ファイル: bounds_test.php プロジェクト: joeymetal/v1
 function test_creation_from_circle()
 {
     $bounds = Bounds::from_point_and_radius(array(32.939829, -96.951176), 2.5);
     $inside = new LatLng(32.969527, -96.99015900000001);
     $outside = new LatLng(32.895155, -96.958444);
     $this->assertTrue($bounds->contains($inside));
     $this->assertFalse($bounds->contains($outside));
 }
コード例 #2
0
ファイル: acts_as_mappable.php プロジェクト: joeymetal/v1
 private function formulate_bounds_from_distance($options, $origin, $units)
 {
     if (array_key_exists('within', $options)) {
         $distance = $options['within'];
     }
     if (array_key_exists('range', $options)) {
         $distance = $options['range']->last - ($options['range']->exclude_end ? 1 : 0);
     }
     if (isset($distance)) {
         $options = array('units' => $units);
         $res = Bounds::from_point_and_radius($origin, $distance, $options);
     } else {
         $res = null;
     }
     return $res;
 }