[Users] Question on using WMS GetLegendGraphic with a GeoExt.tree.LayerNode
Andrew Stewart
Andrew.Stewart at reddeer.ca
Tue Nov 23 01:38:37 CET 2010
Sorry to reply so many times to my own post.. but I kinda figured this out. Basically now I am setting the text property of each childnode after expanding to the WMS GetLegendGraphic request and then contatonating that with the text name of the node. Is there a better way to do this.. I am just using the expand event and then redrawing the entire childnodes with new icons.. can I do this before the nodes are even expanded?
From: users-bounces at geoext.org [users-bounces at geoext.org] On Behalf Of Andrew Stewart [Andrew.Stewart at reddeer.ca]
Sent: November 22, 2010 4:22 PM
To: users at geoext.org
Subject: Re: [Users] Question on using WMS GetLegendGraphic with a GeoExt.tree.LayerNode
So I have tried to change the icon of each childNode after the expand event like so -
'expand' : {fn: function(node) {
var count = (node.childNodes.length -1);
while (count >= 0)
{node.childNodes[count].setIcon("../images/minus.png");
count -=1;
}
}}
But this does not seem to work, anything else I can try?
________________________________
From: users-bounces at geoext.org [mailto:users-bounces at geoext.org] On Behalf Of Andrew Stewart
Sent: November 22, 2010 3:51 PM
To: users at geoext.org
Subject: [Users] Question on using WMS GetLegendGraphic with a GeoExt.tree.LayerNode
Is it possible to show a legend graphic which is returned from my WMS GetLegendGraphic request next to each item on the LayerNode after it is expanded? (or before.. Or whenever as long as it shows).
I declare my layernode like so -
//Trails layerList
layerList_Trails = new GeoExt.tree.LayerNode({
"layer": layer_Trails,
"isLeaf": false,
"checked": false,
"enableDD": true,
"cls": "rootnode",
"singleClickExpand": true,
"listeners": {
'checkchange' : function(node, checked)
{
// If a parent node is unchecked, uncheck all the children
if (node.getUI().isChecked()) {
node.expand();
}
if (!node.getUI().isChecked())
{
node.collapse();
}
}
},
"loader": {
"param": "LAYERS"
}
});
Which is added to my root -
layerRoot_Legend.appendChild(layerList_Trails);
And then my treepanel
var layerRoot_Legend = new Ext.tree.TreeNode({
enableDD: true,
text: "All Legend Items",
loaded: true,
expanded: true
});
var layerTree_Legend = new Ext.tree.TreePanel({
title: '',
root: layerRoot_Legend,
enableDD: true,
applyLoader: true,
rootVisible: false
});
Except previously when I declared my layers individually I had put an <img> tag with the right layer next to each.. But now I am declaring them in groups like -
//Trails Group
var layer_Trails = new OpenLayers.Layer.WMS("<img src='http://localhost/WebService/Request.aspx?request=GetLegendGraphic&version=1.1.1&format=image/png&layer=Asphalt' alt=''/>Trails", "http://localhost/WebService/Request.aspx",
{
layers: ['Onstreet_Bike_Route', 'Mountain_-_Stunt_Biking', 'Equestrian', 'Gravel_or_Shale', 'Asphalt'],
VERSION: "1.1.1",
transparent: true
},
{ isBaseLayer: false,
singleTile: true,
visibility: false,
buffer: 1,
ratio: 1
}
But this only puts the image on the actual group name and I need it to be beside each legend entry when it is expanded. Is there a place somewhere I can stick this image tag and either hard code the layer name or have it be returned from the childNodes of the tree and get it to show this image beside each childNode? Appreciate any assistance!
________________________________
This e-mail is intended for the original recipient(s) only. If you have received it in error, please advise the sender and delete this message.
________________________________
[This message has been scanned for security content threats and viruses.]
[The City of Red Deer I.T. Services asks that you please consider the environment before printing this e-mail.]
________________________________
This e-mail is intended for the original recipient(s) only. If you have received it in error, please advise the sender and delete this message.
________________________________
[This message has been scanned for security content threats and viruses.]
[The City of Red Deer I.T. Services asks that you please consider the environment before printing this e-mail.]
More information about the Users
mailing list