class GisPolygon extends GisGeometry

Handles actions related to GIS POLYGON objects

Methods

string
prepareRowAsSvg(string $spatial, string $label, string $fill_color, array $scale_data)

Prepares and returns the code related to a row in the GIS dataset as SVG.

resource
prepareRowAsPng(string $spatial, string|null $label, string $fill_color, array $scale_data, resource $image)

Adds to the PNG image object, the data related to a row in the GIS dataset.

TCPDF
prepareRowAsPdf(string $spatial, string|null $label, string $fill_color, array $scale_data, TCPDF $pdf)

Adds to the TCPDF instance, the data related to a row in the GIS dataset.

string
prepareRowAsOl(string $spatial, int $srid, string $label, string $fill_color, array $scale_data)

Prepares JavaScript related to a row in the GIS dataset to visualize it with OpenLayers.

array
scaleRow(string $spatial)

Scales each row.

string
generateWkt(array $gis_data, int $index, string $empty = '')

Generate the WKT with the set of parameters passed by the GIS editor.

string
getBoundsForOl(string $srid, array $scale_data)

Returns OpenLayers.Bounds object that correspond to the bounds of GIS data.

array
setMinMax(string $point_set, array $min_max)

Updates the min, max values with the given point set.

array
generateParams(string $value, int $index = -1)

Generate parameters for the GIS data editor from the value of the GIS column.

array
extractPoints(string $point_set, array|null $scale_data, boolean $linear = false)

Extracts points, scales and returns them as an array.

string
getPolygonArrayForOpenLayers(array $polygons, string $srid)

Generates JavaScript for adding an array of polygons to OpenLayers.

string
getPolygonForOpenLayers(array $polygon, string $srid)

Generates JavaScript for adding points for OpenLayers polygon.

string
getLineArrayForOpenLayers(array $lines, string $srid, bool $is_line_string = true)

Generates JavaScript for adding an array of LineString or LineRing to OpenLayers.

string
getLineForOpenLayers(array $points_arr, string $srid, bool $is_line_string = true)

Generates JavaScript for adding a LineString or LineRing to OpenLayers.

string
getPointsArrayForOpenLayers(array $points_arr, string $srid)

Generates JavaScript for adding an array of points to OpenLayers.

string
getPointForOpenLayers(array $point, string $srid)

Generates JavaScript for adding a point to OpenLayers.

static GisPolygon
singleton()

Returns the singleton.

static float
area(array $ring)

Calculates the area of a closed simple polygon.

static bool
isOuterRing(array $ring)

Determines whether a set of points represents an outer ring.

static bool
isPointInsidePolygon(array $point, array $polygon)

Determines whether a given point is inside a given polygon.

static array|bool
getPointOnSurface(array $ring)

Returns a point that is guaranteed to be on the surface of the ring.

Details

at line 218
string prepareRowAsSvg(string $spatial, string $label, string $fill_color, array $scale_data)

Prepares and returns the code related to a row in the GIS dataset as SVG.

Parameters

string $spatial GIS data object
string $label label for the GIS data object
string $fill_color Color for the GIS POLYGON object
array $scale_data data related to scaling

Return Value

string the code related to a row in the GIS dataset

at line 88
resource prepareRowAsPng(string $spatial, string|null $label, string $fill_color, array $scale_data, resource $image)

Adds to the PNG image object, the data related to a row in the GIS dataset.

Parameters

string $spatial GIS POLYGON object
string|null $label Label for the GIS POLYGON object
string $fill_color Color for the GIS POLYGON object
array $scale_data Array containing data related to scaling
resource $image Image object

Return Value

resource the modified image object

at line 157
TCPDF prepareRowAsPdf(string $spatial, string|null $label, string $fill_color, array $scale_data, TCPDF $pdf)

Adds to the TCPDF instance, the data related to a row in the GIS dataset.

Parameters

string $spatial GIS data object
string|null $label label for the GIS data object
string $fill_color Color for the GIS POLYGON object
array $scale_data array containing data related to scaling
TCPDF $pdf TCPDF instance

Return Value

TCPDF the modified TCPDF instance

at line 279
string prepareRowAsOl(string $spatial, int $srid, string $label, string $fill_color, array $scale_data)

Prepares JavaScript related to a row in the GIS dataset to visualize it with OpenLayers.

Parameters

string $spatial GIS data object
int $srid spatial reference ID
string $label label for the GIS data object
string $fill_color Color for the GIS POLYGON object
array $scale_data array containing data related to scaling

Return Value

string the JavaScript related to a row in the GIS dataset

at line 55
array scaleRow(string $spatial)

Scales each row.

Parameters

string $spatial spatial data of a row

Return Value

array array containing the min, max values for x and y coordinates

at line 345
string generateWkt(array $gis_data, int $index, string $empty = '')

Generate the WKT with the set of parameters passed by the GIS editor.

Parameters

array $gis_data GIS data
int $index index into the parameter object
string $empty value for empty points

Return Value

string WKT with the set of parameters passed by the GIS editor

in GisGeometry at line 126
protected string getBoundsForOl(string $srid, array $scale_data)

Returns OpenLayers.Bounds object that correspond to the bounds of GIS data.

Parameters

string $srid spatial reference ID
array $scale_data data related to scaling

Return Value

string OpenLayers.Bounds object that correspond to the bounds of GIS data

in GisGeometry at line 148
protected array setMinMax(string $point_set, array $min_max)

Updates the min, max values with the given point set.

Parameters

string $point_set point set
array $min_max existing min, max values

Return Value

array the updated min, max values

at line 578
array generateParams(string $value, int $index = -1)

Generate parameters for the GIS data editor from the value of the GIS column.

Parameters

string $value value of the GIS column
int $index Index of the geometry

Return Value

array parameters for the GIS editor from the value of the GIS column

in GisGeometry at line 217
protected array extractPoints(string $point_set, array|null $scale_data, boolean $linear = false)

Extracts points, scales and returns them as an array.

Parameters

string $point_set string of comma separated points
array|null $scale_data data related to scaling
boolean $linear if true, as a 1D array, else as a 2D array

Return Value

array scaled points

in GisGeometry at line 266
protected string getPolygonArrayForOpenLayers(array $polygons, string $srid)

Generates JavaScript for adding an array of polygons to OpenLayers.

Parameters

array $polygons x and y coordinates for each polygon
string $srid spatial reference id

Return Value

string JavaScript for adding an array of polygons to OpenLayers

in GisGeometry at line 294
protected string getPolygonForOpenLayers(array $polygon, string $srid)

Generates JavaScript for adding points for OpenLayers polygon.

Parameters

array $polygon x and y coordinates for each line
string $srid spatial reference id

Return Value

string JavaScript for adding points for OpenLayers polygon

in GisGeometry at line 313
protected string getLineArrayForOpenLayers(array $lines, string $srid, bool $is_line_string = true)

Generates JavaScript for adding an array of LineString or LineRing to OpenLayers.

Parameters

array $lines x and y coordinates for each line
string $srid spatial reference id
bool $is_line_string whether it's an array of LineString

Return Value

string JavaScript for adding an array of LineString or LineRing to OpenLayers

in GisGeometry at line 350
protected string getLineForOpenLayers(array $points_arr, string $srid, bool $is_line_string = true)

Generates JavaScript for adding a LineString or LineRing to OpenLayers.

Parameters

array $points_arr x and y coordinates for each point
string $srid spatial reference id
bool $is_line_string whether it's a LineString

Return Value

string JavaScript for adding a LineString or LineRing to OpenLayers

in GisGeometry at line 370
protected string getPointsArrayForOpenLayers(array $points_arr, string $srid)

Generates JavaScript for adding an array of points to OpenLayers.

Parameters

array $points_arr x and y coordinates for each point
string $srid spatial reference id

Return Value

string JavaScript for adding an array of points to OpenLayers

in GisGeometry at line 397
protected string getPointForOpenLayers(array $point, string $srid)

Generates JavaScript for adding a point to OpenLayers.

Parameters

array $point array containing the x and y coordinates of the point
string $srid spatial reference id

Return Value

string JavaScript for adding points to OpenLayers

at line 38
static GisPolygon singleton()

Returns the singleton.

Return Value

GisPolygon the singleton

at line 399
static float area(array $ring)

Calculates the area of a closed simple polygon.

Parameters

array $ring array of points forming the ring

Return Value

float the area of a closed simple polygon

at line 437
static bool isOuterRing(array $ring)

Determines whether a set of points represents an outer ring.

If points are in clockwise orientation then, they form an outer ring.

Parameters

array $ring array of points forming the ring

Return Value

bool whether a set of points represents an outer ring

at line 454
static bool isPointInsidePolygon(array $point, array $polygon)

Determines whether a given point is inside a given polygon.

Parameters

array $point x, y coordinates of the point
array $polygon array of points forming the ring

Return Value

bool whether a given point is inside a given polygon

at line 511
static array|bool getPointOnSurface(array $ring)

Returns a point that is guaranteed to be on the surface of the ring.

(for simple closed rings)

Parameters

array $ring array of points forming the ring

Return Value

array|bool a point on the surface of the ring