API / geotoolkit / util / Polygon / Polygon
Represents a polygon with methods that allow the geometry of the polygon to be queried and modified.
↳
Polygon
Constructors
Methods
Constructors
• new Polygon(x?, y?, evenOddMode?)
| Name | Type | Description |
|---|---|---|
Optional x | number[] | x coordinates |
Optional y | number[] | y coordinates |
Optional evenOddMode | boolean | even odd mode |
Area.constructor
Methods
▸ clone(): Polygon
Clone polygon
polygon
▸ contains(x, y): boolean
Check if polygon contains point
Throws
if illegal argument count
| Name | Type | Description |
|---|---|---|
x | number | x position of the point |
y | number | y position of the point |
boolean
▸ contains(point): boolean
Check if polygon contains point
Throws
if illegal argument count
| Name | Type | Description |
|---|---|---|
point | Point | point |
boolean
▸ containsPolygon(polygon): boolean
Check if polygon contains polygon
| Name | Type | Description |
|---|---|---|
polygon | Polygon | polygon |
boolean
true if contains, else false
▸ containsRectangle(rectangle): boolean
Check if polygon contains rectangle
| Name | Type | Description |
|---|---|---|
rectangle | Rect | rectangle |
boolean
true if contains, else false
▸ getBounds(): Rect
Return bounds and locks the bounds rect from further editing.
bounds
▸ getClassName(): string
string
▸ getEvenOddMode(): boolean
Get even odd mode
boolean
will this use even odd mode or not
▸ getPointsX(): number[]
Gets x-coords of points
number[]
array of x-coordinates
▸ getPointsY(): number[]
Gets y-coords of points
number[]
array of y-coordinates
▸ getProperties(): Record<string, any>
Gets all the properties pertaining to this object
Record<string, any>
▸ getSize(): number
Gets number of points
number
points the number of points in this polygon
▸ intersectRectangle(rectangle): Polygon
Intersects polygon with the rectangle and leaves only the inner part of polygon WARNING! The result might have self-intersections in some cases
| Name | Type | Description |
|---|---|---|
rectangle | Rect | rectangle |
this
▸ intersectsPolygon(polygon): boolean
Check if polygon intersects polygon
| Name | Type | Description |
|---|---|---|
polygon | Polygon | polygon |
boolean
true if intersects, else false
▸ intersectsRectangle(rectangle): boolean
Check if polygon intersects rectangle
| Name | Type | Description |
|---|---|---|
rectangle | Rect | rectangle |
boolean
true if intersects, else false
▸ push(x, y): void
Add point to array of points.
| Name | Type | Description |
|---|---|---|
x | number | x coordinate |
y | number | y coordinate |
void
▸ setCoordinates(x, y): Polygon
Sets arrays of points. Will overwrite any existing points in this polygon.
| Name | Type | Description |
|---|---|---|
x | number[] | array of x coordinates |
y | number[] | array of y coordinates |
▸ setEvenOddMode(mode): Polygon
Set even odd mode
| Name | Type | Description |
|---|---|---|
mode | boolean | even odd mode |
▸ setProperties(properties?): Polygon
Sets all the properties pertaining to this object
| Name | Type | Description |
|---|---|---|
Optional properties | Record<string, any> | object containing the properties to set |
this
▸ Static fromRect(rect): Polygon
Create polygon from rect
| Name | Type | Description |
|---|---|---|
rect | Rect | rectangle |
instance
▸ Static getClassName(): string
string