shapeObj
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
'type' is one of MS_SHAPE_POINT, MS_SHAPE_LINE, MS_SHAPE_POLYGON or MS_SHAPE_NULL Creates new shape object from WKT string.
Old style constructor
Returns true if shape2 passed as argument is entirely within the shape.
Returns a shape object representing the convex hull of shape.
Returns a shape object representing the difference of the shape object with the one passed as parameter.
Free the object properties and break the internal references.
Returns the area of the shape (if applicable).
Returns a point object representing the centroid of the shape.
Returns a point object with coordinates suitable for labelling the shape.
Returns the length (or perimeter) of the shape.
Apply only on Measured shape files. Given a measure m, retun the corresponding XY location on the shapeobject.
Returns a shape object representing the intersection of the shape object with the one passed as parameter.
Project the shape from "in" projection (1st argument) to "out" projection (2nd argument). Returns MS_SUCCESS/MS_FAILURE.
Set object property to a new value.
Updates the bounds property of the shape.
Given a tolerance, returns a simplified shape object or NULL on error. Only available if php/mapscript is built with GEOS library (>=3.0).
Returns the computed symmetric difference of the supplied and existing shape.
Given a tolerance, returns a simplified shape object or NULL on error. Only available if php/mapscript is built with GEOS library (>=3.0).
Returns WKT representation of the shape's geometry.
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.
final ShapeObj
ms_shapeObjFromWkt(string $wkt)
Old style constructor
final int
add(lineObj $line)
Add a line (i.e. a part) to the shape.
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.
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.
final shapeObj
convexhull()
Returns a shape object representing the convex hull of shape.
Only available if php/mapscript is built with GEOS library.
final bool
contains(pointObj $point)
Returns MS_TRUE if the point is inside the shape, MS_FALSE otherwise.
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.
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.
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.
final int
draw(mapObj $map, layerObj $layer, imageObj $img)
Draws the individual shape using layer.
Returns MS_SUCCESS/MS_FAILURE.
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.
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.
final float
getArea()
Returns the area of the shape (if applicable).
Only available if php/mapscript is built with GEOS library.
final pointObj
getCentroid()
Returns a point object representing the centroid of the shape.
Only available if php/mapscript is built with GEOS library.
final pointObj
getLabelPoint()
Returns a point object with coordinates suitable for labelling the shape.
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.
final pointObj
getPointUsingMeasure(float $m)
Apply only on Measured shape files. Given a measure m, retun the corresponding XY location on the shapeobject.
final string
getValue(layerObj $layer, string $filedname)
Returns the value for a given field name.
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.
final bool
intersects(shapeObj $shape)
Returns MS_TRUE if the two shapes intersect, MS_FALSE otherwise.
final lineObj
line(int $i)
Returns a reference to line number i.
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.
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.
final int
set(string $property_name, $new_value)
Set object property to a new value.
final int
setBounds()
Updates the bounds property of the shape.
Must be called to calculate new bounding box after new parts have been added.
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).
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.
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).
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.
final string
toWkt()
Returns WKT representation of the shape's geometry.
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
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.