Can't you have your strategy listen to featureunselected and fix the
ordering within the feature group including the unselected feature and
all the features that feature intersects? Eric

2008/10/27, Jerome Freyre <[EMAIL PROTECTED]>:
>
> Hi everybody,
>
> Currently I am trying to developp a new strategy (based on
> OpenLayers.Strategy.Cluster) that can modify the order of features (bigger
> features go downer and small one go higher) to display features with correct
> "overlay" or "superposition".
>
> To do that, I found that I have to order my features.
>
> Actually, I am loading my features with HTTP protocol (see:
> http://www.nabble.com/Problem-with-Protocol-HTTP-and-vector-layer-tt20088456.html
> ;) ).
>
> My "sort algorithm" seems to work because it is ordering features based on
> the "overlayAttribute".
>
> The problem appears when I select a feature that is "downer". When I
> unselect it, the feature goes "higher" than the smaller one and stays like
> this.
>
> Has somebody got an idea to resolve this problem?
>
> My strategy function :
> ============================================
>         if(this.features.length >= 2) {
>
>                       var tempArray = this.features;
>                       //alert('count = ' + this.features.length);
>                       for (var i=0; i<this.features.length; i++) {    
>                               for(var j=this.features.length-1; j>i;j--) {
>                                       //alert('Comparaison de ' +
> this.features[j].attributes[this.overlayAttribute] + ' et ' +
> this.features[j-1].attributes[this.overlayAttribute]);
>                                       if 
> (parseInt(this.features[j].attributes[this.overlayAttribute]) >
> parseInt(this.features[j-1].attributes[this.overlayAttribute])) {
>                                               var tmp = this.features[j];
>                                               this.features[j] = 
> this.features[j-1];
>                                               this.features[j-1] = tmp;
>                                       }
>                               }
>                       }
>               }
>
>               alert('count = ' + this.features.length);
>               var attr = "";
>               for(var i=0; i<this.features.length; ++i) {
>                       attr += 
> this.features[i].attributes[this.overlayAttribute] + ' \\ ';
>               }
>
>       if(this.features.length > 0) {
>                  this.clustering = true;
>                  // A legitimate feature addition could occur during this
>                  // addFeatures call.  For clustering to behave well,
> features
>                  // should be removed from a layer before requesting a new
> batch.
>                                this.layer.removeFeatures();
>                  this.layer.addFeatures(this.features);
>                  this.clustering = false;
>              }
> ============================================
>
> --
> View this message in context:
> http://www.nabble.com/Problem-with-the-developpement-of-a-%22overlay-Strategy%22-tp20187399p20187399.html
> Sent from the OpenLayers Dev mailing list archive at Nabble.com.
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://openlayers.org/mailman/listinfo/dev
>
_______________________________________________
Dev mailing list
[email protected]
http://openlayers.org/mailman/listinfo/dev

Reply via email to