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
clone
Clone this geometry. Returns{OpenLayers.Geometry.Collection} An exact clone of this 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
Returns{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. Returns{Float} The area of the collection by summing its parts rotate
Rotate a geometry around some origin Parameters
resize
Resize a geometry relative to some origin. Use this method to apply a uniform scaling to a geometry. Parameters
equals
Tests for equivalent geometries Parameters
Returns{Boolean} The coordinates are equivalent |
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 )
Rotate a geometry around some origin
rotate: function( angle, origin )
Resize a geometry relative to some origin.
resize: function( scale, origin )
Tests for equivalent geometries
equals: function( geometry )