Hi,
I have a mappping project which uses the Ext.TreePanel to configure the layers
as displayed underneath. I would like to be able to move the layers around
(which is possible using enableDD: true) but in my case the
drawing order doesn´t change. I.e when I move a layer upwards the drawing order
(z-index) stays the same.
What should I do to change the drawing order of the layers in the map when I
change the order in the tree?
Thanks for any tips,
Rob
First the layers definitions are defined...e.g
var layer_zgb_grenze = new OpenLayers.Layer.WMS("Verwaltungsgrenzen:
Planungsraum / Landkreis", "/geoserver/gwc/service/wms", {
layers: 'LK_Grenzen_gwc',
format: 'image/png',
transparent: true,
singleTile: true
}, {
'buffer': 0,
'opacity': 1,
'isBaseLayer': false,
visibility: true
});
...etc
then I put the layers into an array so I can check their initial drawing order
in the map (ps I have around 100 layers so this way it´s easier to see)
e.g..
// layers added first are at the bottom of the z-index
var grenzen_layers = [];
grenzen_layers.push(Layer_grenzen_sg,Layer_grenzen_mg,layer_zgb_grenze);
map.addLayers(grenzen_layers);
then the layers are put into the tree using the following....
// create tree structure
var treeConfig = [
{
nodeType: "gx_baselayercontainer",
text: "Basiskarten",
expanded: true,
hidden:true,
leaf: true,
loader: {
param: "LAYERS"
}
},
{
text: "DOP",
expanded: true,
children: [
{
nodeType: 'gx_layer',
text:'DOP',
layer: dop,
// icon:
'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=Grenzen_SG_gen',
qtip: "DOP"
}]
},
{
text: "Verwaltungsgrenzen",
expanded: true,
children: [
{
nodeType: 'gx_layer',
text:'Planungsraum / Landkreis Grenze',
layer: layer_zgb_grenze,
// icon:
'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=Suchraum_V1_wgs84',
qtip: "Metadata"
},
{
nodeType: 'gx_layer',
text:'Samtgemeinde Grenze',
layer: Layer_grenzen_sg,
// icon:
'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=Suchraum_V2_wgs84',
qtip: "Metadata"
},
{
nodeType: 'gx_layer',
text:'Mitgliedsgemeinde Grenze',
layer: Layer_grenzen_mg,
// icon:
'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=Suchraum_V3_wgs84',
qtip: "Metadata"
}]
},
{
text: "LROP / RROP",
expanded: true,
children: [
{
text: "LROP", //,layer_RROP
expanded: true,
children: [
{
nodeType: 'gx_layer',
text:'LROP',
layer: layer_LROP,
// icon:
'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=wea_wgs84',
qtip: "LROP"
}]
}
]
},
{
text: "DGM",
expanded: true,
children: [
{
nodeType: 'gx_layer',
text:'DGM',
layer: layer_dgm,
// icon:
'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=Vorrangstandorte_WEA_RROP08_wgs84',
qtip: "DGM"
}]
},
{
text: "Suchräume",
expanded: true,
children: [
{
nodeType: 'gx_layer',
text:'layer_suchraumV1',
layer: layer_dgm,
// icon:
'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=Suchraum_V1_wgs84',
qtip: "Metadata"
},
{
nodeType: 'gx_layer',
text:'layer_suchraumV2',
layer: layer_dgm,
// icon:
'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=Suchraum_V2_wgs84',
qtip: "Metadata"
},
{
nodeType: 'gx_layer',
text:'layer_suchraumV3',
layer: layer_dgm,
// icon:
'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=Suchraum_V3_wgs84',
qtip: "Metadata"
},
{
nodeType: 'gx_layer',
text:'layer_suchraumV4',
layer: layer_dgm,
// icon:
'http://maps.zgb.de/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=16&LAYER=Suchraum_V4_wgs84',
qtip: "Metadata"
}]
}
];
// create TreePanel
var layerTree = new Ext.tree.TreePanel({
text: "Karteninhalt",
border: true,
region: "west",
animate: true,
height: 500,
width: 350,
enableDD: true,
split: true,
autoScroll: true,
containerScroll: true,
xtype: "gx_legendpanel",
showWmsLegend: true,
loader: new Ext.tree.TreeLoader({
applyLoader: false,
uiProviders: {
"layernodeui": LayerNodeUI
}
}),
root: {
text: "ZGB GeoPortal",
nodeType: "async",
children: treeConfig,
expanded: true
},
rootVisible: true,
lines: true
});
_______________________________________________
Users mailing list
Users@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users