PHP Класс Location\Polygon

Автор: Paul Vidal ([email protected])
Автор: Marcus Jaschen ([email protected])
Наследование: implements location\GeometryInterface
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$points array

Открытые методы

Метод Описание
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

Описание методов

addPoint() публичный Метод

public addPoint ( Coordinate $point )
$point Coordinate

contains() публичный Метод

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.
См. также: 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
Результат boolean

containsGeometry() публичный Метод

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
Результат boolean

format() публичный Метод

public format ( Location\Formatter\Polygon\FormatterInterface $formatter ) : mixed
$formatter Location\Formatter\Polygon\FormatterInterface
Результат mixed

getArea() публичный Метод

Calculates the polygon area.
public getArea ( ) : float
Результат float

getLats() публичный Метод

Return all polygon point's latitudes.
public getLats ( ) : float[]
Результат float[]

getLngs() публичный Метод

Return all polygon point's longitudes.
public getLngs ( ) : float[]
Результат float[]

getNumberOfPoints() публичный Метод

public getNumberOfPoints ( ) : integer
Результат integer

getPerimeter() публичный Метод

Calculates the polygon perimeter.
public getPerimeter ( Location\Distance\DistanceInterface $calculator ) : float
$calculator Location\Distance\DistanceInterface instance of distance calculation class
Результат float

getPoints() публичный Метод

public getPoints ( ) : array
Результат array

getReverse() публичный Метод

Create a new polygon with reversed order of points, i. e. reversed polygon direction.
public getReverse ( ) : Polygon
Результат Polygon

getSegments() публичный Метод

public getSegments ( ) : array
Результат array

Описание свойств

$points защищенное свойство

protected array $points
Результат array