[OpenLayers-Trac] [OpenLayers] #3216: Strategy.Filter sabotages other strategies

OpenLayers trac-20090302 at openlayers.org
Wed Mar 30 09:55:00 EDT 2011


#3216: Strategy.Filter sabotages other strategies
-----------------------------+----------------------------------------------
 Reporter:  vog              |       Owner:  tschaub     
     Type:  bug              |      Status:  new         
 Priority:  major            |   Milestone:  2.11 Release
Component:  Strategy.Filter  |     Version:  2.10        
 Keywords:                   |       State:  Review      
-----------------------------+----------------------------------------------
 I wrote a custom strategy that depends on the "beforefeaturesadded" and
 "beforefeaturesremoved" events. While it worked flawlessly when used
 alone, it failed to work when used in combination with a Strategy.Filter
 instance in the same vector layer.

 The reason is that Strategy.Filter suppresses important events for
 apparently no reason. More concretely, Strategy.Filter suppresses events
 when it removes or (re-)adds features to the vector layer due to changed
 filter conditions.

 At a first glance, I thought that this is necessary to ensure that
 Strategy.Filter won't be confused, as it triggers those events while it
 handles them. However, this possible issue has been already solved
 perfectly via the "caching" attribute. This attribute is set to "true"
 while calling addFeatures() and removeFeatures(), and the event handlers
 are written in a way that they won't do anything while "caching" is
 "true".

 So there should really be no reason to suppress those events. The attached
 patch fixed this.

 After applying this patch, my custom strategy works with no problems in
 combination with Strategy.Filter.

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3216>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list