Location\Polygon::getLngs PHP Method

getLngs() public method

Return all polygon point's longitudes.
public getLngs ( ) : float[]
return float[]
    public function getLngs()
    {
        $lngs = [];
        foreach ($this->points as $point) {
            $lngs[] = $point->getLng();
        }
        return $lngs;
    }

Usage Example

Beispiel #1
0
 public function testIfGetLngsWorksAsExpected()
 {
     $polygon = new Polygon();
     $polygon->addPoint(new Coordinate(10, 20));
     $polygon->addPoint(new Coordinate(10, 40));
     $polygon->addPoint(new Coordinate(30, 40));
     $polygon->addPoint(new Coordinate(30, 20));
     $expected = array(20, 40, 40, 20);
     $this->assertEquals($expected, $polygon->getLngs());
 }