[OpenLayers-Users] re moveFeatures vs. destroyFeatures behavior

BrainDrain paulborodaev at gmail.com
Fri Sep 26 01:41:10 EDT 2008


I mean doing this optionally in 'silent' mode when notifications are not
needed

Eric Lemoine-3 wrote:
> 
> Hi.
> 
> Yes, something could probably be done for eraseFeatures and
> removeFeatures. The thing is that removeFeatures triggers a
> featureremoved event for each feature removed. What we could do is
> introduce removeAllFeatures which will be documented as not triggering
> featureremoved events. Feel free to create a ticket for this, and
> propose a patch. Thanks. Eric
> 
> 2008/9/25, BrainDrain <paulborodaev at gmail.com>:
>>
>> 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.
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
> _______________________________________________
> 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-tp18599629p19682833.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list