[Users] Layer group with legend
Andreas Hocevar
ahocevar at opengeo.org
Tue Oct 19 15:41:26 CEST 2010
Hi Alexandre,
see comments inline.
On Oct 19, 2010, at 15:25 , Alexandre Dube wrote:
> One thing at a time. First, mixing the tree-legend and
> LayerParamLoader. I don't really get how I'm suppose to assemble the
> elements. So far, I modified the tree-legend example and tried [1] but
> it triggers a javascript error...
You are calling the wrong superclass. You need
GeoExt.tree.LayerParamLoader.prototype.createNode.call(this, attr);
> Secondly, I about my other "group" node level thing, I'm not sure if
> that's currently possible with the current elements unless I create the
> nodes manually, am I right ?
You could use a LayerLoader with a filter for each of your groups. At least that's what I hear other people do.
Regards,
Andreas.
>
> Thanks for any pointer,
>
> Alexandre
>
>
> [1] ==================================
>
> var mapPanel = new GeoExt.MapPanel({
> region: "center",
> center: [146.1569825, -41.6109735],
> zoom: 6,
> layers: [
> new OpenLayers.Layer.WMS("Tasmania",
> "http://demo.opengeo.org/geoserver/wms", {
> layers:
> "topp:tasmania_state_boundaries,topp:tasmania_water_bodies,topp:tasmania_roads,topp:tasmania_cities"
> }, {
> buffer: 0,
> isBaseLayer: false
> })
> ]
> });
>
> var tree = new Ext.tree.TreePanel({
> region: "east",
> title: "Layers",
> width: 250,
> autoScroll: true,
> enableDD: true,
> // apply the tree node component plugin to layer nodes
> plugins: [{
> ptype: "gx_treenodecomponent"
> }],
> loader: {
> applyLoader: false,
> uiProviders: {
> "custom_ui": LayerNodeUI
> }
> },
> root: {
> nodeType: "gx_layer",
> layer: "Tasmania",
> isLeaf: false,
> loader: {
> param: "LAYERS",
> baseAttrs: {
> uiProvider: "custom_ui"
> },
> createNode: function(attr) {
> // add a WMS legend to each node created
> attr.component = {
> xtype: "gx_wmslegend",
> layerRecord:
> mapPanel.layers.getByLayer(attr.layer),
> showTitle: false,
> // custom class for css positioning
> // see tree-legend.html
> cls: "legend"
> }
> return
> GeoExt.tree.LayerLoader.prototype.createNode.call(this, attr);
> }
> }
> },
> rootVisible: true,
> lines: false
> });
>
>
>
>
> On 10-10-19 08:15 AM, Alexandre Dube wrote:
>> Hi Andreas,
>>
>> Thanks for your reply. I little more detail wouldn't hurt if it's
>> not asking for too much.
>>
>> Also, I'd like to add one thing in my tree : groups. I already have
>> the name of the group each server-side layer has and I'd like to add a
>> level of nodes for that :
>>
>> [x] Group1
>> [x] Layer1
>> (img) Class1
>> (img) Class2
>> [x] Layer2
>> (img) Class1
>> [ ] Group2
>> [ ] Layer3
>> [ ] Layer4
>> [x] Layer5
>>
>> and so on using one single OpenLayers.Layer.WMS object. Is that
>> possible too ?
>>
>> Thanks,
>>
>> Alexandre
>>
>>
>> On 10-10-18 04:53 PM, Andreas Hocevar wrote:
>>
>>> Hi Alexandre,
>>>
>>> this is definitely possible. All you need to do is configure your LayerParamLoader with a custom createNode function that creates an appropriate LayerLegend instance. Pretty much the same as in the tree-legend.html example.
>>>
>>> Does this answer your question or do you need more details?
>>>
>>> Regards,
>>> Andreas.
>>>
>>> On Oct 18, 2010, at 22:02 , Alexandre Dube wrote:
>>>
>>>
>>>
>>>> Hi,
>>>>
>>>> Is it possible to use a "group layer" as shown in this example [1]
>>>> with each "param/layer" generated node having its own "legend" node [2]
>>>> ? I would like to have one OpenLayers.WMS object in the end. Is that
>>>> possible with the current GeoExt legend and tree features available ?
>>>>
>>>> Thanks,
>>>>
>>>> [1] http://api.geoext.org/1.0/examples/tree.html
>>>> [2] http://api.geoext.org/1.0/examples/tree-legend.html
>>>>
>>>> --
>>>> Alexandre Dubé
>>>> Mapgears
>>>> www.mapgears.com
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at geoext.org
>>>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>
>
> --
> Alexandre Dubé
> Mapgears
> www.mapgears.com
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list