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:
@@ -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"
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user