Exemplo n.º 1
0
 public function testVertex()
 {
     $this->initialize();
     $point = new Point(-82, 39);
     $inclusion = new Inclusion($this->polygon, $point);
     $this->assertTrue($inclusion->isWithinPolygon());
 }
Exemplo n.º 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;
 }