OpenLayers OpenLayers

Ticket #1369: vector.getDataExtent.patch

File vector.getDataExtent.patch, 0.8 kB (added by openlayers, 11 months ago)
  • Vector.js

    old new  
    519519    preFeatureInsert: function(feature) { 
    520520    }, 
    521521 
     522    /**  
     523     * APIMethod: getDataExtent 
     524     * Calculates the max extent which includes all of the features. 
     525     *  
     526     * Returns: 
     527     * {<OpenLayers.Bounds>} 
     528     */ 
     529    getDataExtent: function () { 
     530        var maxExtent = null; 
     531        if( this.features && (this.features.length > 0)){ 
     532            var maxExtent = this.features[0].geometry.getBounds(); 
     533            for(var i=0; i < this.features.length; i++){ 
     534                maxExtent.extend(this.features[i].geometry.getBounds()); 
     535            } 
     536        } 
     537 
     538        return maxExtent; 
     539    }, 
     540 
    522541    CLASS_NAME: "OpenLayers.Layer.Vector" 
    523542});