[OpenLayers-Users] re moveFeatures vs. destroyFeatures behavior

BrainDrain paulborodaev at gmail.com
Thu Sep 25 16:49:04 EDT 2008


little working solution:
OpenLayers.Layer.Vector.prototype.destroyFeatures=function(features,options){   
    var all=(features==undefined);
    if(all){
        features=this.features;
    }else{
        if (!(features instanceof Array)){
            features=[features];
        }
    }
    if(features){
        features=features.slice();
        this.removeFeatures(features, options);
        for(var i=features.length-1;i>=0;i--){
            features[i].destroy();
        }
    }
};
It's strange for me that methods like eraseFeatures/removeFeatures/... don't
handles <all features> cases avoiding passes through each feature. What if
just write something like that:
 	this.selectedFeatures = [];			
        this.features = [];
        this.unrenderedFeatures = {}; etc.


youknowho wrote:
> 
> Hi Eric. Thank you for the response. From what you said my understanding
> of
> removeFeatures and destroyFeatures is correct, and this appears to be a
> bug.
> Using the code from my original post I verified this incorrect
> destroyFeatures() behavior again today, and will file a bug ticket.
> 
> Thanks,
> Ian
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://www.nabble.com/removeFeatures-vs.-destroyFeatures-behavior-tp18599629p19678021.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list