Add getDataExtent to Vector Layer. Patch from rupert, tests by me, r=me

(Closes #1369)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@6947 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2008-04-16 01:56:21 +00:00
parent 029e76d965
commit ecd291cb01
2 changed files with 23 additions and 1 deletions

View File

@@ -534,5 +534,24 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
preFeatureInsert: function(feature) {
},
/**
* APIMethod: getDataExtent
* Calculates the max extent which includes all of the features.
*
* Returns:
* {<OpenLayers.Bounds>}
*/
getDataExtent: function () {
var maxExtent = null;
if( this.features && (this.features.length > 0)){
var maxExtent = this.features[0].geometry.getBounds();
for(var i=0; i < this.features.length; i++){
maxExtent.extend(this.features[i].geometry.getBounds());
}
}
return maxExtent;
},
CLASS_NAME: "OpenLayers.Layer.Vector"
});