Location\Polygon::addPoint PHP Method

addPoint() public method

public addPoint ( Coordinate $point )
$point Coordinate
    public function addPoint(Coordinate $point)
    {
        $this->points[] = $point;
    }

Usage Example

Beispiel #1
0
 /**
  * @covers Location\Formatter\Coordinate\DecimalDegrees::format
  */
 public function testFormatDefault()
 {
     $polygon = new Polygon();
     $polygon->addPoint(new Coordinate(10, 20));
     $polygon->addPoint(new Coordinate(20, 40));
     $polygon->addPoint(new Coordinate(30, 40));
     $polygon->addPoint(new Coordinate(30, 20));
     $json = '{ "type" : "Polygon" , "coordinates" : [ [ 20, 10 ], [ 40, 20 ], [ 40, 30 ], [ 20, 30] ] }';
     $this->assertJsonStringEqualsJsonString($json, $this->formatter->format($polygon));
 }
All Usage Examples Of Location\Polygon::addPoint