new Polygon(coordinates, optionsopt) [source]
var polygon = new Polygon(
[
[
[121.48053653961283, 31.24244899384889],
[121.48049362426856, 31.238559229494186],
[121.49032123809872, 31.236210614999653],
[121.49366863494917, 31.242926029397037],
[121.48577221160967, 31.243880093267567],
[121.48053653961283, 31.24244899384889]
]
]
).addTo(layer);
Parameter | Type | Default | Description |
---|---|---|---|
coordinates
|
Array.<Array.<Number>> | Array.<Array.<Array.<Number>>> | Array.<Coordinate> | Array.<Array.<Coordinate>> | coordinates, shell coordinates or all the rings. | |
options
opt
|
Object | null | construct options defined in Polygon |
Extends:
Members
(constant) options
Inherited From:
Properties:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options
|
Object | configuration options
Properties
|
- Inherited From:
- Source:
Methods
setCoordinates(coordinates) [source]
Set coordinates to the polygon
Parameter | Type | Description |
---|---|---|
coordinates
|
Array.<Array.<Number>> | Array.<Array.<Array.<Number>>> | Array.<Coordinate> | Array.<Array.<Coordinate>> | new coordinates |
Fires:
Returns:
Polygon: thisgetCoordinates() [source]
Gets polygons's coordinates
Returns:
Array.<Array.<Coordinate>>:getCenterInExtent(extent) [source]
Get center of linestring's intersection with give extent
const extent = map.getExtent();
const center = line.getCenterInExtent(extent);
Parameter | Type | Description |
---|---|---|
extent
|
Extent |
Returns:
Coordinate: center, null if line doesn't intersect with extentgetShell() [source]
Gets shell's coordinates of the polygon
Returns:
Array.<Coordinate>:getHoles() [source]
Gets holes' coordinates of the polygon if it has.
Returns:
Array.<Array.<Coordinate>>:hasHoles() [source]
Whether the polygon has any holes inside.
Returns:
Boolean:(inherited) animateShow(optionsopt, cbopt) [source]
Show the linestring with animation
Parameter | Type | Default | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options
opt
|
Object | null | animation options
Properties
|
||||||||||||
cb
opt
|
function | null | callback function in animation |