| Package | org.openscales.core.geometry |
| Class | public class Polygon |
| Inheritance | Polygon Collection Geometry |
| Property | Defined by | ||
|---|---|---|---|
| area : Number [read-only]
Calculate the approximate area of this geometry (the projection and
the geodesic are not managed).
| Polygon | ||
![]() | bounds : Bounds | Geometry | |
![]() | components : Array
Setter of the components (children) of this collection.
| Collection | |
![]() | componentsLength : int
Number of components in the collection
| Collection | |
![]() | componentsString : String
Get a string representing the components for this collection
| Collection | |
![]() | componentTypes : Array
Getter and setter of the authorized types for the components
(children) of this collection
| Collection | |
![]() | id : String | Geometry | |
![]() | length : Number
Returns the geometry's length.
| Geometry | |
![]() | parent : Geometry | Geometry | |
| Method | Defined by | ||
|---|---|---|---|
|
Polygon(rings:Array)
Constructor for a Polygon geometry.
| Polygon | ||
![]() |
addComponent(component:Geometry, index:Number):Boolean
Add a new component (geometry) to the collection.
| Collection | |
![]() |
addComponents(components:Array):void
Add components to this geometry.
| Collection | |
![]() |
Determines if the feature is placed at the given point with a certain tolerance (or not).
| Geometry | |
![]() |
calculateBounds():void
Recalculate the bounds by iterating through the components and
calling extendBounds() on each item.
| Collection | |
![]() |
clearBounds():void
Clear the geometry's bounds
| Geometry | |
|
To get this geometry clone
| Polygon | ||
![]() |
componentByIndex(i:int):Geometry
Component of the specified index, casted to the Geometry type
| Collection | |
![]() |
Determine if the input geometry is fully contained in this one.
| Geometry | |
|
containsPoint(p:Point):Boolean
Test if a point is inside this geometry.
| Polygon | ||
|
Create a regular polygon around a radius.
| Polygon | ||
![]() |
destroy():void
Destroy the collection.
| Collection | |
![]() |
distanceTo(geom:Geometry):Number
Calculate the closest distance between two geometries (on the x-y plane).
| Geometry | |
![]() |
extendBounds(newBounds:Bounds):void
Extends geometry's bounds
If bounds are not defined yet, it initializes the bounds.
| Geometry | |
![]() |
getcomponentsClone():Array
TO get component clone
| Collection | |
|
intersects(geom:Geometry):Boolean
Determine if the input geometry intersects this one.
| Polygon | ||
![]() |
[static]
Test if a point is at the left, at the right or on an infinite line.
| Geometry | |
|
isPointInPolygon(point:Point, manageHoles:Boolean = true):Boolean
Test if a point is inside a polygon.
| Polygon | ||
![]() |
removeComponent(component:Geometry):void
Remove a component from this geometry.
| Collection | |
![]() |
removeComponents(components:Array):void
Remove components from this geometry.
| Collection | |
![]() |
replaceComponent(index:int, component:Geometry):Boolean
replace the component of specified index by the input geometry.
| Collection | |
![]() |
segmentsIntersect(seg1:Array, seg2:Array, tolerance:Number = 0.0):Boolean
[static]
Determine whether two line segments intersect or not.
| Geometry | |
|
toShortString():String
Component of the specified index, casted to the LinearRing type
| Polygon | ||
![]() |
toVertices():Array
Return an array of all the vertices (Point) of this geometry
| Collection | |
![]() |
transform(source:ProjProjection, dest:ProjProjection):void
Moves a geometry by the given displacement along positive x and y axes.
| Collection | |
| area | property |
area:Number [read-only]Calculate the approximate area of this geometry (the projection and the geodesic are not managed). Be careful, if some components intersect themselves, the intersection area is substracted several times ! Moreover, the auto-intersection of edges of each LinearRing is not managed.
Implementation public function get area():Number
| Polygon | () | constructor |
public function Polygon(rings:Array)Constructor for a Polygon geometry. The first ring (components[0]) is the outer bounds of the polygon and all subsequent rings (component[1..n]) are internal holes.
Parametersrings:Array — the polygon and its holes
|
| clone | () | method |
| containsPoint | () | method |
public override function containsPoint(p:Point):BooleanTest if a point is inside this geometry.
Parametersp:Point — the point to test
|
Boolean — a boolean defining if the point is inside or outside this geometry
|
| createRegularPolygon | () | method |
public function createRegularPolygon(origin:Point, radius:Number, sides:Number, rotation:Number):PolygonCreate a regular polygon around a radius. Useful for creating circles and the like.
Parametersorigin:Point — The center of polygon.
|
|
radius:Number — Distance to vertex, in map units.
|
|
sides:Number — Number of sides. 20 approximates a circle.
|
|
rotation:Number — original angle of rotation, in degrees.
|
Polygon |
| intersects | () | method |
public override function intersects(geom:Geometry):BooleanDetermine if the input geometry intersects this one.
Parametersgeom:Geometry — Any type of geometry.
|
Boolean — The input geometry intersects this one.
|
| isPointInPolygon | () | method |
public function isPointInPolygon(point:Point, manageHoles:Boolean = true):BooleanTest if a point is inside a polygon. A point on a polygon edge is considered inside. A point on at least one of the holes is considered outside except if the manageHoles parameter is set to false.
Parameterspoint:Point — the point to test
|
|
manageHoles:Boolean (default = true) — a boolean defining if the test must manage the
holes (default) or not.
|
Boolean — a boolean defining if the point is inside or outside this geometry
|
| toShortString | () | method |
public override function toShortString():StringComponent of the specified index, casted to the LinearRing type
ReturnsString |