[Users] Suggestion for tree RadioButtonPlugin

Eric Lemoine eric.lemoine at camptocamp.com
Thu Aug 5 08:02:44 CEST 2010


On Monday, August 2, 2010, Dan Ramage <dan at inlet.geol.sc.edu> wrote:
>
>
>
>
>
>
>
>
>
>
>
>
>
> I run into situations where I have layers that should be
> grouped together in a node, but maybe only one of them is capable of a getFeatureInfo
> request.
>
> Currently on a node loader.baseAttrs.radioGroup must be
> defined for the plugin to work. However every layer that appears in the group
> will have a radiobutton whether it is required or not.
>
>
>
> When working on my layerOpacitySliderPlugin, I added some
> code to check not only if the node defines loader.baseAttrs.slider, but also
> check to see if the layer defines layer.options.opacitySlider: true.  By
> default, if loader.baseAttrs.slider is defined, but nothing is set in
> layer.options.opacitySlider, the slider will be created. So one catch is for
> any layers in a group that might have a slider, the ones in the groups that
> should not have a slider must define layer.options.opacitySlider: false.
>
>
>
>
>
> Anyway I was wondering if something similar would be a
> useful addition to the radio button to give some further creation control.

Hi.

I wouldn't make such a change to GeoExt. Relying on user-specific
options not defined in OpenLayers isn't something I'd personnally like
to have.

What you can possibly do is extend LayerLoader. Something like this (untested):

LayerLoader = Ext.extend(GeoExt.tree.LayerLoader, {
    createNode: function(attr) {
         var radioGroup = this.baseAttrs.radioGroup;
         var queryable = attr.layer.options.queryable;
        if(queryable) {
            delete this.baseAttrs.radioGroup;
        }
        var node = LayerLoader.superclass.createNode.apply(this, arguments);
        this.baseAttrs.radioGroup = radioGroup;
        return node;
    }
});


Cheers,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


More information about the Users mailing list