OpenLayers JavaScript Mapping Library |
OpenLayers. Geometry. CollectionA 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. Inerhits fromSummary
components{Array(OpenLayers.Geometry)} The component parts of this geometry OpenLayers. Geometry. CollectionCreates a Geometry Collection -- a list of geoms. Parameters
Returns{OpenLayers.Geometry.Collection} A new geometry collection addComponents
Add components to this geometry. Parameters
addComponent
Add a new component (geometry) to the collection. If this.componentTypes is set, then the component class name must be in the componentTypes array. The bounds cache is reset. Parameters
Return{Boolean} The component geometry was successfully added removeComponents
Remove components from this geometry. Parameters
removeComponent
Remove a component from this geometry. Parameters
getArea
Calculate the area of this geometry. Note how this function is overridden in OpenLayers.Geometry.Polygon. Return{Number} The area of the collection by summing its parts |
Destroy this geometry.
destroy: function ()
Clone this geometry.
clone: function()
Get a string representing the components for this collection
getComponentsString: function()
Recalculate the bounds by iterating through the components and calling calling extendBounds() on each item
calculateBounds: function()
Add components to this geometry.
addComponents: function( components )
Add a new component (geometry) to the collection.
addComponent: function( component, index )
Remove components from this geometry.
removeComponents: function( components )
Remove a component from this geometry.
removeComponent: function( component )
Calculate the length of this geometry
getLength: function()
Calculate the area of this geometry.
getArea: function()
Moves a collection in place
move: function( x, y )
Tests for equivalent geometries
equals: function( geometry )