Пример #1
0
 /**
  * @expectedException Exception
  */
 public function testInsufficientPoly()
 {
     $point = new Point(50, 50);
     $polygon = new Polygon();
     $polygon->addVertex($point);
     new Inclusion($polygon, $point);
 }
Пример #2
0
 public function isWithinServiceArea()
 {
     $applicablePolygons = $this->kml->getApplicablePolygons();
     if ($applicablePolygons['outer']) {
         /** @var string $coordinateString Coordinate String*/
         foreach ($applicablePolygons['outer'] as $outerCoordinateString) {
             $polygon = Polygon::createPolyFromCoordinateString($outerCoordinateString);
             $inclusion = new Inclusion($polygon, $this->point);
             if ($inclusion->isWithinPolygon()) {
                 //The point is within the Outer Polygon - need to check all inner polygons.
                 foreach ($applicablePolygons['inner'] as $innerPolygonCoordinateString) {
                     $innerPolygon = Polygon::createPolyFromCoordinateString($innerPolygonCoordinateString);
                     $innerInclusion = new Inclusion($innerPolygon, $this->point);
                     if ($innerInclusion->isWithinPolygon()) {
                         return false;
                     }
                 }
                 return true;
             }
         }
     }
     return false;
 }