Hi Andreas,
thanks for replying!

I was about to quote the case of the vector layers that were affected
a special z-index range in some former OL layers. But it seems it is
no more the case. In addition I have just figured out that
setLayerZIndex is overridden in our project. I'm going to dig in that
direction.

Sorry for the noise,
alex

2010/10/15 Andreas Hocevar <[email protected]>:
> Hi,
>
> can you provide a test case to show that it really makes a difference? If you 
> only use the OpenLayers API correctly, it should not. Note that 
> Map::setLayerZIndex is not an API method. And here is the setLayerIndex (API 
> method) code from OL, which shows that the layers array reflects the order 
> the layers are shown:
>
>    setLayerIndex: function (layer, idx) {
>        var base = this.getLayerIndex(layer);
>        if (idx < 0) {
>            idx = 0;
>        } else if (idx > this.layers.length) {
>            idx = this.layers.length;
>        }
>        if (base != idx) {
>            this.layers.splice(base, 1);
>            this.layers.splice(idx, 0, layer);
>            for (var i=0, len=this.layers.length; i<len; i++) {
>                this.setLayerZIndex(this.layers[i], i);
>            }
>            this.events.triggerEvent("changelayer", {
>                layer: layer, property: "order"
>            });
>            if(this.allOverlays) {
>                if(idx === 0) {
>                    this.setBaseLayer(layer);
>                } else if(this.baseLayer !== this.layers[0]) {
>                    this.setBaseLayer(this.layers[0]);
>                }
>            }
>        }
>    },
>
> Regards,
> Andreas.
>
> On Oct 15, 2010, at 15:39 , Alexandre Saunier wrote:
>
>> Hello all!
>>
>> it seems to me there is a little inconsistence between the OpenLayers
>> stack order and the order of layers transmitted to the print module by
>> the PrintProvider.
>>
>> In OL, layers are stacked using the layers' z-indices, not according
>> the map.layers order.
>>
>> In the print() method of GeoExt.data.PrintProvider, layers are listed
>> in the print request using the following piece of code:
>>        var pagesLayer = pages[0].feature.layer;
>>        var encodedLayers = [];
>>        Ext.each(map.layers, function(layer){
>>            if(layer !== pagesLayer && layer.getVisibility() === true) {
>>                var enc = this.encodeLayer(layer);
>>                enc && encodedLayers.push(enc);
>>            }
>>        }, this);
>>        jsonData.layers = encodedLayers;
>> => layers are listed using the map.layers order.
>> Then in the generated PDF, layers are stacked in the same order, no
>> matter if a given layer should appear above the others because it has
>> a greater z-index in the OL map.
>>
>> I'm wondering if it would not be more relevant to sort map.layers
>> according to the layers' z-indices before adding layers to the
>> encodedLayers list? Is it worth submitting a patch about that issue?
>>
>> Thanks,
>> alex
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://www.geoext.org/cgi-bin/mailman/listinfo/dev
>
>
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>
>
_______________________________________________
Dev mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/dev

Reply via email to