Articles and Tutorials
GSPolygon
GSPolygon represents a vector-based polygon feature. This is a closed shape consisting of a set of connected straight line segments.| Constructor Summary | |
| GSPolygon (<Object> params) Constructs a new GSPolygon that is initialized with the properties provided in the params associative array. | |
| Method Summary | |
| GSBounds | getBounds() Gets the minimum bounding box necessary to contain this map feature |
| Array | getHandles() Gets the drag handles for this shape |
| Array | getPoints() Returns the NZMG coordinates that define this this shape |
| Array | getSelectedHandles() Returns the selected drag handles for this shape |
| void | hideHandles() Hides the drag handles for this shape |
| GSPoint | insertPoint() Can be called when two adjacent drag handles have been selected to insert a new point equidistant between them. |
| boolean | removePoint (<GSPoint> point) Removes the specified point from this shape |
| void | setPoints(<Array> points) Sets the list of NZMG points that describe this polyline. |
| void | showHandles() Shows the drag handles for this shape. |
| Constructor Detail |
GSPolygon
GSPolygon(<Object> params)- Constructs a new GSPolygon that is initialized with the properties provided in the params associative array.
-
-
- points - the NZMG coordinates describing this polygon specified as an array of GSPoint instances
- style - an associative array containing name-value pairs for each style property to set, see GSVectorGraphics.setStyle() for all supported properties
- handleSelectModifier - the modifier key that should be used to 'select' a drag handle when clicking on it. Any of the following modifiers may be specified: alt, ctrl, meta, shift
params - an associative array of named arguments used to initialize this shape, the following parameters may be specified:
Parameters: -
| Method Detail |
getBounds
GSBounds getBounds()- Gets the minimum bounding box necessary to contain this map feature
-
- the bounds of this map feature
Returns:
getHandles
Array getHandles()- Gets the drag handles for this shape
-
- an array of GSHandle objects
Returns:
getPoints
Array getPoints()- Returns the NZMG coordinates that define this this shape
-
- an array of GSPoint objects
Returns:
getSelectedHandles
Array getSelectedHandles()- Returns the selected drag handles for this shape
-
- an array of GSHandle objects. The array will be empty if no handles are currently selected
Returns:
hideHandles
void hideHandles()- Hides the drag handles for this shape
insertPoint
GSPoint insertPoint()- Can be called when two adjacent drag handles have been selected to insert a new point equidistant between them.
-
- the point that was inserted
Returns:
removePoint
boolean removePoint(<GSPoint> point)- Removes the specified point from this shape
-
- point - the NZMG point to remove from this shape
Parameters:
-
- true if the point was removed
Returns:
setPoints
void setPoints(<Array> points)- Sets the list of NZMG points that describe this polyline. All coordinate values are specified using the GSPoint class
-
- points - the points to set. If an odd number of coordinates is provided the element will not be rendered
Parameters:
showHandles
void showHandles()- Shows the drag handles for this shape. For each vertice of the shape a drag handle is provided

