PHP Class Location\Polygon

Author: Paul Vidal ([email protected])
Author: Marcus Jaschen ([email protected])
Inheritance: implements location\GeometryInterface
Afficher le fichier Open project: mjaschen/phpgeo Class Usage Examples

Protected Properties

Свойство Type Description
$points array

Méthodes publiques

Méthode Description
addPoint ( Coordinate $point )
contains ( Coordinate $point ) : boolean Determine if given point is contained inside the polygon. Uses the PNPOLY algorithm by W. Randolph Franklin. Therfore some edge cases may not give the expected results, e. g. if the point resides on the polygon boundary.
containsGeometry ( location\GeometryInterface $geometry ) : boolean Determine if given geometry is contained inside the polygon. This is assumed to be true, if each point of the geometry is inside the polygon.
format ( Location\Formatter\Polygon\FormatterInterface $formatter ) : mixed
getArea ( ) : float Calculates the polygon area.
getLats ( ) : float[] Return all polygon point's latitudes.
getLngs ( ) : float[] Return all polygon point's longitudes.
getNumberOfPoints ( ) : integer
getPerimeter ( Location\Distance\DistanceInterface $calculator ) : float Calculates the polygon perimeter.
getPoints ( ) : array
getReverse ( ) : Polygon Create a new polygon with reversed order of points, i. e. reversed polygon direction.
getSegments ( ) : array

Method Details

addPoint() public méthode

public addPoint ( Coordinate $point )
$point Coordinate

contains() public méthode

Determine if given point is contained inside the polygon. Uses the PNPOLY algorithm by W. Randolph Franklin. Therfore some edge cases may not give the expected results, e. g. if the point resides on the polygon boundary.
See also: http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html For special cases this calculation leads to wrong results: - if the polygons spans over the longitude boundaries at 180/-180 degrees
public contains ( Coordinate $point ) : boolean
$point Coordinate
Résultat boolean

containsGeometry() public méthode

Edge cases: - it's not detected when a line between two points is outside the polygon - @see contains() for more restrictions
public containsGeometry ( location\GeometryInterface $geometry ) : boolean
$geometry location\GeometryInterface
Résultat boolean

format() public méthode

public format ( Location\Formatter\Polygon\FormatterInterface $formatter ) : mixed
$formatter Location\Formatter\Polygon\FormatterInterface
Résultat mixed

getArea() public méthode

Calculates the polygon area.
public getArea ( ) : float
Résultat float

getLats() public méthode

Return all polygon point's latitudes.
public getLats ( ) : float[]
Résultat float[]

getLngs() public méthode

Return all polygon point's longitudes.
public getLngs ( ) : float[]
Résultat float[]

getNumberOfPoints() public méthode

public getNumberOfPoints ( ) : integer
Résultat integer

getPerimeter() public méthode

Calculates the polygon perimeter.
public getPerimeter ( Location\Distance\DistanceInterface $calculator ) : float
$calculator Location\Distance\DistanceInterface instance of distance calculation class
Résultat float

getPoints() public méthode

public getPoints ( ) : array
Résultat array

getReverse() public méthode

Create a new polygon with reversed order of points, i. e. reversed polygon direction.
public getReverse ( ) : Polygon
Résultat Polygon

getSegments() public méthode

public getSegments ( ) : array
Résultat array

Property Details

$points protected_oe property

protected array $points
Résultat array