<< Click to Display Table of Contents >>
new sg.geometry.Polygon()
Description
create a polygon object.
Position
Geometry.js
Properties
Properties |
Type |
Description |
extent |
sg.geometry.Extent |
Geometry extent |
type |
String |
Geometry type |
area |
Number |
Polygon area |
rings |
Array.<sg.geometry.LinearRing> |
Array of polygon rings |
Methods
Methods |
Type |
Description |
||||||||||
getExtent() |
Returns: sg.geometry.Extent |
Return geometry extent object. Returns:
|
||||||||||
toWkt() |
Returns: String |
Convert to WKT string Returns:
|
||||||||||
addRing(ring) |
sg.geometry.LinearRing |
Add rings to polygon
|
||||||||||
contains(pt) |
pt:sg.geometry.Point Returns:Boolean |
Define whether a point is contained in the polygon
Returns:
|
||||||||||
getArea() |
Returns: Number |
Return geometry area Returns:
|
||||||||||
getCentroid() |
Returns: sg.geometry.Point |
Return geometry centroid Returns:
|
||||||||||
isClockwise(ring) |
ring:sg.geometry.LinearRing Returns:Boolean |
Check if the polygon ring is clockwise.
Returns:
|
||||||||||
update() |
Update geometry extent, area etc. |
|||||||||||
forEachVertex(callback) |
function |
Get the each vertex by a callback function. callback(context) { //Each point (sg.geometry.Point) context.point; //The index of ring context.ringIndex; //The index of point context.pointIndex; } |
||||||||||
getFirstPoint_()
|
Returns: sg.geometry.point |
Get the first vertex of a polygon Returns:
|
Example
|
©2015 Supergeo Technologies Inc.