final class shapeObj (View source)

Properties

rectObj $bounds read-only
int $classindex
int $index
int $numlines read-only
int $numvalues read-only
int $tileindex read-only
string $text
int $type read-only
array $values read-only

Methods

__construct(int $type)

'type' is one of MS_SHAPE_POINT, MS_SHAPE_LINE, MS_SHAPE_POLYGON or MS_SHAPE_NULL Creates new shape object from WKT string.

ShapeObj
ms_shapeObjFromWkt(string $wkt)

Old style constructor

int
add(lineObj $line)

Add a line (i.e. a part) to the shape.

boundary()

Returns the boundary of the shape.

int
containsShape(shapeObj $shape2)

Returns true if shape2 passed as argument is entirely within the shape.

convexhull()

Returns a shape object representing the convex hull of shape.

bool
contains(pointObj $point)

Returns MS_TRUE if the point is inside the shape, MS_FALSE otherwise.

int
crosses(shapeObj $shape)

Returns true if the shape passed as argument crosses the shape.

difference(shapeObj $shape)

Returns a shape object representing the difference of the shape object with the one passed as parameter.

int
disjoint(shapeObj $shape)

Returns true if the shape passed as argument is disjoint to the shape. Else return false.

int
draw(mapObj $map, layerObj $layer, imageObj $img)

Draws the individual shape using layer.

int
equals(shapeObj $shape)

Returns true if the shape passed as argument is equal to the shape (geometry only). Else return false.

void
free()

Free the object properties and break the internal references.

float
getArea()

Returns the area of the shape (if applicable).

getCentroid()

Returns a point object representing the centroid of the shape.

getLabelPoint()

Returns a point object with coordinates suitable for labelling the shape.

float
getLength()

Returns the length (or perimeter) of the shape.

getPointUsingMeasure(float $m)

Apply only on Measured shape files. Given a measure m, retun the corresponding XY location on the shapeobject.

string
getValue(layerObj $layer, string $filedname)

Returns the value for a given field name.

intersection(shapeObj $shape)

Returns a shape object representing the intersection of the shape object with the one passed as parameter.

bool
intersects(shapeObj $shape)

Returns MS_TRUE if the two shapes intersect, MS_FALSE otherwise.

line(int $i)

Returns a reference to line number i.

int
overlaps(shapeObj $shape)

Returns true if the shape passed as argument overlaps the shape.

int
project(projectionObj $in, projectionObj $out)

Project the shape from "in" projection (1st argument) to "out" projection (2nd argument). Returns MS_SUCCESS/MS_FAILURE.

int
set(string $property_name, $new_value)

Set object property to a new value.

int
setBounds()

Updates the bounds property of the shape.

shapeObj|null
simplify(float $tolerance)

Given a tolerance, returns a simplified shape object or NULL on error. Only available if php/mapscript is built with GEOS library (>=3.0).

symdifference(shapeObj $shape)

Returns the computed symmetric difference of the supplied and existing shape.

shapeObj|null
topologyPreservingSimplify(float $tolerance)

Given a tolerance, returns a simplified shape object or NULL on error. Only available if php/mapscript is built with GEOS library (>=3.0).

int
touches(shapeObj $shape)

Returns true if the shape passed as argument touches the shape.

string
toWkt()

Returns WKT representation of the shape's geometry.

union(shapeObj $shape)

Returns a shape object representing the union of the shape object with the one passed as parameter.

int
within(shapeObj $shape2)

Returns true if the shape is entirely within the shape2 passed as argument.

Details

final __construct(int $type)

'type' is one of MS_SHAPE_POINT, MS_SHAPE_LINE, MS_SHAPE_POLYGON or MS_SHAPE_NULL Creates new shape object from WKT string.

Parameters

int $type

final ShapeObj ms_shapeObjFromWkt(string $wkt)

Old style constructor

Parameters

string $wkt

Return Value

ShapeObj

final int add(lineObj $line)

Add a line (i.e. a part) to the shape.

Parameters

lineObj $line

Return Value

int

final shapeObj boundary()

Returns the boundary of the shape.

Only available if php/mapscript is built with GEOS library. shapeObj buffer(width) Returns a new buffered shapeObj based on the supplied distance (given in the coordinates of the existing shapeObj). Only available if php/mapscript is built with GEOS library.

Return Value

shapeObj

final int containsShape(shapeObj $shape2)

Returns true if shape2 passed as argument is entirely within the shape.

Else return false. Only available if php/mapscript is built with GEOS library.

Parameters

shapeObj $shape2

Return Value

int

final shapeObj convexhull()

Returns a shape object representing the convex hull of shape.

Only available if php/mapscript is built with GEOS library.

Return Value

shapeObj

final bool contains(pointObj $point)

Returns MS_TRUE if the point is inside the shape, MS_FALSE otherwise.

Parameters

pointObj $point

Return Value

bool

final int crosses(shapeObj $shape)

Returns true if the shape passed as argument crosses the shape.

Else return false. Only available if php/mapscript is built with GEOS library.

Parameters

shapeObj $shape

Return Value

int

final shapeObj difference(shapeObj $shape)

Returns a shape object representing the difference of the shape object with the one passed as parameter.

Only available if php/mapscript is built with GEOS library.

Parameters

shapeObj $shape

Return Value

shapeObj

final int disjoint(shapeObj $shape)

Returns true if the shape passed as argument is disjoint to the shape. Else return false.

Only available if php/mapscript is built with GEOS library.

Parameters

shapeObj $shape

Return Value

int

final int draw(mapObj $map, layerObj $layer, imageObj $img)

Draws the individual shape using layer.

Returns MS_SUCCESS/MS_FAILURE.

Parameters

mapObj $map
layerObj $layer
imageObj $img

Return Value

int

final int equals(shapeObj $shape)

Returns true if the shape passed as argument is equal to the shape (geometry only). Else return false.

Only available if php/mapscript is built with GEOS library.

Parameters

shapeObj $shape

Return Value

int

final void free()

Free the object properties and break the internal references.

Note that you have to unset the php variable to free totally the resources.

Return Value

void

final float getArea()

Returns the area of the shape (if applicable).

Only available if php/mapscript is built with GEOS library.

Return Value

float

final pointObj getCentroid()

Returns a point object representing the centroid of the shape.

Only available if php/mapscript is built with GEOS library.

Return Value

pointObj

final pointObj getLabelPoint()

Returns a point object with coordinates suitable for labelling the shape.

Return Value

pointObj

final float getLength()

Returns the length (or perimeter) of the shape.

Only available if php/mapscript is built with GEOS library. pointObj getMeasureUsingPoint(pointObj point) Apply only on Measured shape files. Given an XY Location, find the nearest point on the shape object. Return a point object of this point with the m value set.

Return Value

float

final pointObj getPointUsingMeasure(float $m)

Apply only on Measured shape files. Given a measure m, retun the corresponding XY location on the shapeobject.

Parameters

float $m

Return Value

pointObj

final string getValue(layerObj $layer, string $filedname)

Returns the value for a given field name.

Parameters

layerObj $layer
string $filedname

Return Value

string

final shapeObj intersection(shapeObj $shape)

Returns a shape object representing the intersection of the shape object with the one passed as parameter.

Only available if php/mapscript is built with GEOS library.

Parameters

shapeObj $shape

Return Value

shapeObj

final bool intersects(shapeObj $shape)

Returns MS_TRUE if the two shapes intersect, MS_FALSE otherwise.

Parameters

shapeObj $shape

Return Value

bool

final lineObj line(int $i)

Returns a reference to line number i.

Parameters

int $i

Return Value

lineObj

final int overlaps(shapeObj $shape)

Returns true if the shape passed as argument overlaps the shape.

Else returns false. Only available if php/mapscript is built with GEOS library.

Parameters

shapeObj $shape

Return Value

int

final int project(projectionObj $in, projectionObj $out)

Project the shape from "in" projection (1st argument) to "out" projection (2nd argument). Returns MS_SUCCESS/MS_FAILURE.

Parameters

projectionObj $in
projectionObj $out

Return Value

int

final int set(string $property_name, $new_value)

Set object property to a new value.

Parameters

string $property_name
$new_value

Return Value

int

final int setBounds()

Updates the bounds property of the shape.

Must be called to calculate new bounding box after new parts have been added.

Return Value

int

final shapeObj|null simplify(float $tolerance)

Given a tolerance, returns a simplified shape object or NULL on error. Only available if php/mapscript is built with GEOS library (>=3.0).

Parameters

float $tolerance

Return Value

shapeObj|null

final shapeObj symdifference(shapeObj $shape)

Returns the computed symmetric difference of the supplied and existing shape.

Only available if php/mapscript is built with GEOS library.

Parameters

shapeObj $shape

Return Value

shapeObj

final shapeObj|null topologyPreservingSimplify(float $tolerance)

Given a tolerance, returns a simplified shape object or NULL on error. Only available if php/mapscript is built with GEOS library (>=3.0).

Parameters

float $tolerance

Return Value

shapeObj|null

final int touches(shapeObj $shape)

Returns true if the shape passed as argument touches the shape.

Else return false. Only available if php/mapscript is built with GEOS library.

Parameters

shapeObj $shape

Return Value

int

final string toWkt()

Returns WKT representation of the shape's geometry.

Return Value

string

final shapeObj union(shapeObj $shape)

Returns a shape object representing the union of the shape object with the one passed as parameter.

Only available if php/mapscript is built with GEOS library

Parameters

shapeObj $shape

Return Value

shapeObj

final int within(shapeObj $shape2)

Returns true if the shape is entirely within the shape2 passed as argument.

Else returns false. Only available if php/mapscript is built with GEOS library.

Parameters

shapeObj $shape2

Return Value

int