PHP Class PMA\libraries\gis\GISPolygon

Inheritance: extends PMA\libraries\gis\GISGeometry
Show file Open project: phpmyadmin/phpmyadmin Class Usage Examples

Public Methods

Method Description
area ( array $ring ) : float Calculates the area of a closed simple polygon.
generateParams ( string $value, integer $index ) : array Generate parameters for the GIS data editor from the value of the GIS column.
generateWkt ( array $gis_data, integer $index, string $empty = '' ) : string Generate the WKT with the set of parameters passed by the GIS editor.
getPointOnSurface ( array $ring ) : array | void Returns a point that is guaranteed to be on the surface of the ring.
isOuterRing ( array $ring ) : boolean Determines whether a set of points represents an outer ring.
isPointInsidePolygon ( array $point, array $polygon ) : boolean Determines whether a given point is inside a given polygon.
prepareRowAsOl ( string $spatial, integer $srid, string $label, string $fill_color, array $scale_data ) : string Prepares JavaScript related to a row in the GIS dataset to visualize it with OpenLayers.
prepareRowAsPdf ( string $spatial, string $label, string $fill_color, array $scale_data, TCPDF $pdf ) : TCPDF Adds to the TCPDF instance, the data related to a row in the GIS dataset.
prepareRowAsPng ( string $spatial, string $label, string $fill_color, array $scale_data, object $image ) : object Adds to the PNG image object, the data related to a row in the GIS dataset.
prepareRowAsSvg ( string $spatial, string $label, string $fill_color, array $scale_data ) : string Prepares and returns the code related to a row in the GIS dataset as SVG.
scaleRow ( string $spatial ) : array Scales each row.
singleton ( ) : GISPolygon Returns the singleton.

Private Methods

Method Description
__construct ( ) A private constructor; prevents direct creation of object.
_drawPath ( string $polygon, array $scale_data ) : string Draws a ring of the polygon using SVG path element.

Method Details

area() public static method

Calculates the area of a closed simple polygon.
public static area ( array $ring ) : float
$ring array array of points forming the ring
return float the area of a closed simple polygon

generateParams() public method

Generate parameters for the GIS data editor from the value of the GIS column.
public generateParams ( string $value, integer $index ) : array
$value string Value of the GIS column
$index integer Index of the geometry
return array params for the GIS data editor from the value of the GIS column

generateWkt() public method

Generate the WKT with the set of parameters passed by the GIS editor.
public generateWkt ( array $gis_data, integer $index, string $empty = '' ) : string
$gis_data array GIS data
$index integer Index into the parameter object
$empty string Value for empty points
return string WKT with the set of parameters passed by the GIS editor

getPointOnSurface() public static method

(for simple closed rings)
public static getPointOnSurface ( array $ring ) : array | void
$ring array array of points forming the ring
return array | void a point on the surface of the ring

isOuterRing() public static method

If points are in clockwise orientation then, they form an outer ring.
public static isOuterRing ( array $ring ) : boolean
$ring array array of points forming the ring
return boolean whether a set of points represents an outer ring

isPointInsidePolygon() public static method

Determines whether a given point is inside a given polygon.
public static isPointInsidePolygon ( array $point, array $polygon ) : boolean
$point array x, y coordinates of the point
$polygon array array of points forming the ring
return boolean whether a given point is inside a given polygon

prepareRowAsOl() public method

Prepares JavaScript related to a row in the GIS dataset to visualize it with OpenLayers.
public prepareRowAsOl ( string $spatial, integer $srid, string $label, string $fill_color, array $scale_data ) : string
$spatial string GIS POLYGON object
$srid integer Spatial reference ID
$label string Label for the GIS POLYGON object
$fill_color string Color for the GIS POLYGON object
$scale_data array Array containing data related to scaling
return string JavaScript related to a row in the GIS dataset

prepareRowAsPdf() public method

Adds to the TCPDF instance, the data related to a row in the GIS dataset.
public prepareRowAsPdf ( string $spatial, string $label, string $fill_color, array $scale_data, TCPDF $pdf ) : TCPDF
$spatial string GIS POLYGON object
$label string Label for the GIS POLYGON object
$fill_color string Color for the GIS POLYGON object
$scale_data array Array containing data related to scaling
$pdf TCPDF TCPDF instance
return TCPDF the modified TCPDF instance

prepareRowAsPng() public method

Adds to the PNG image object, the data related to a row in the GIS dataset.
public prepareRowAsPng ( string $spatial, string $label, string $fill_color, array $scale_data, object $image ) : object
$spatial string GIS POLYGON object
$label string Label for the GIS POLYGON object
$fill_color string Color for the GIS POLYGON object
$scale_data array Array containing data related to scaling
$image object Image object
return object the modified image object

prepareRowAsSvg() public method

Prepares and returns the code related to a row in the GIS dataset as SVG.
public prepareRowAsSvg ( string $spatial, string $label, string $fill_color, array $scale_data ) : string
$spatial string GIS POLYGON object
$label string Label for the GIS POLYGON object
$fill_color string Color for the GIS POLYGON object
$scale_data array Array containing data related to scaling
return string the code related to a row in the GIS dataset

scaleRow() public method

Scales each row.
public scaleRow ( string $spatial ) : array
$spatial string spatial data of a row
return array an array containing the min, max values for x and y coordinates

singleton() public static method

Returns the singleton.
public static singleton ( ) : GISPolygon
return GISPolygon the singleton