Class OpenLayers.Geometry.Collection
- extends OpenLayers.Geometry
- Known Subclasses:
-
OpenLayers.Geometry.MultiPoint
OpenLayers.Geometry.MultiPolygon
OpenLayers.Geometry.MultiLineString
OpenLayers.Geometry.Polygon
OpenLayers.Geometry.Collection
A Collection is exactly what it sounds like: A collection of different Geometries. These are stored in the local parameter components (which can be passed as a parameter to the constructor).
As new geometries are added to the collection, they are NOT cloned. When removing geometries, they need to be specified by reference (ie you have to pass in the exact geometry to be removed).
The getArea and getLength functions here merely iterate through the components, summing their respective areas and lengths.
Create a new instance with the OpenLayers.Geometry.Collection constructor.
Constructor
OpenLayers.Geometry.Collection
(
components
)
- Parameters:
-
components
<Array(OpenLayers.Geometry)>
Methods
void
addComponents
(
components
)
- Parameters:
-
components
<Array(OpenLayers.Geometry)>
Number | Object
distanceTo
(
geometry
,
options
)
- Parameters:
-
geometry
<OpenLayers.Geometry>
-
options
<Object>
- Returns:
Number | Object
- distance
void
equals
(
geometry
)
- Parameters:
-
geometry
<OpenLayers.Geometry>
OpenLayers.Geometry.Point
getCentroid
(
weighted
)
- Parameters:
-
weighted
<Boolean>
- Returns:
OpenLayers.Geometry.Point
- centroid
Float
getGeodesicArea
(
projection
)
- Parameters:
-
projection
<OpenLayers.Projection>
- Returns:
Float
- geodesic area
Float
getGeodesicLength
(
projection
)
- Parameters:
-
projection
<OpenLayers.Projection>
- Returns:
Float
- geodesic area
Float
getLength
(
)
- Returns:
Float
- geometry length
Array
getVertices
(
nodes
)
- Parameters:
-
nodes
<Boolean>
- Returns:
Array
- vertices
Boolean
intersects
(
geometry
)
- Parameters:
-
geometry
<OpenLayers.Geometry>
- Returns:
Boolean
- intersects
void
move
(
x
,
y
)
- Parameters:
-
x
<Float>
-
y
<Float>
Boolean
removeComponents
(
components
)
- Parameters:
-
components
<Array(OpenLayers.Geometry)>
- Returns:
Boolean
- was removed
void
resize
(
scale
,
origin
,
ratio
)
- Parameters:
-
scale
<Float>
-
origin
<OpenLayers.Geometry.Point>
-
ratio
<Float>
default 1.
void
rotate
(
angle
,
origin
)
- Parameters:
-
angle
<Float>
degree
-
origin
<OpenLayers.Geometry.Point>
center point
OpenLayers.Geometry
transform
(
source
,
dest
)
- Parameters:
-
source
<OpenLayers.Projection>
-
dest
<OpenLayers.Projection>
- Returns:
OpenLayers.Geometry
- geometry