[Users] Tree node disabling with min/max scale

Alexandre Dube adube at mapgears.com
Thu Oct 21 19:33:22 CEST 2010


The 'visibilitychanged' event would be used as usual, but for the 
disabling/enabling we only need to check the 'inRange' property of the 
layer.  If it's set to false and it's not a base layer, disable the 
node, else enable it.  That way, it would prevent the issue you mentioned.

Alexandre

On 10-10-21 12:24 PM, Matt Priour wrote:
> The only issue I see with that is that checking / unchecking a layer 
> will cause it to become visible or not and that in turn fires the 
> 'visibilitychanged' event which would now disable the layer node, 
> preventing one from turning on that layer again
>
> If you wanted to strictly tie the node disable/enable to the layer's 
> 'visibilitychanged' event then you would need to have some kind of 
> flag that would prevent the node from disabling itself after a 
> checkbox change event
>
> Matt Priour
>
> --------------------------------------------------
> From: "Alexandre Dube" <adube at mapgears.com>
> Sent: Thursday, October 21, 2010 10:51 AM
> To: "Matt Priour" <mpriour at kestrelcomputer.com>
> Cc: "Andreas Hocevar" <ahocevar at opengeo.org>; "GeoEXT Users" 
> <users at geoext.org>
> Subject: Re: [Users] Tree node disabling with min/max scale
>
>> Hi,
>>
>>   Would it make sense to register a 'visibilitychanged' event inside 
>> the LayerNode object and disable/enable the UI components accordingly 
>> ? Having a plugin is nice but this seems like a feature everyone 
>> would like to have by default.  Having to configure an additional 
>> plugin for that could be avoided IMHO.
>>
>>   Using the 'visibilitychanged' event registration method, you 
>> trigger much less events and you don't need to check each node on 
>> each map zoom. Only when a layer would be actually changed the 
>> according event would trigger only once and for the layer only.
>>
>>   What do you think ?  What do others think ?
>>
>> Alexandre
>>
>>
>> On 10-10-21 11:44 AM, Matt Priour wrote:
>>> My method is very similar to Pierre's.
>>> I have a TreePanel plugin who's init function wires up event 
>>> listeners to the map's zoom change event and async node expand event.
>>>
>>> it walks the tree and for each gx_layer type node it checks if the 
>>> associated layer is in range.
>>> If not then it disables the node and all of its children if any.
>>> It also checks for any node that has all of its children disabled, 
>>> and if so it also disables that node.
>>>
>>> I should have a working patch with test soon.
>>>
>>> Matt Priour
>>>
>>> --------------------------------------------------
>>> From: "Alexandre Dube" <adube at mapgears.com>
>>> Sent: Thursday, October 21, 2010 9:52 AM
>>> To: "Matt Priour" <mpriour at kestrelcomputer.com>
>>> Cc: "Andreas Hocevar" <ahocevar at opengeo.org>; "GeoEXT Users" 
>>> <users at geoext.org>
>>> Subject: Re: [Users] Tree node disabling with min/max scale
>>>
>>>> Hi Matt,
>>>>
>>>>   Nah, it's no "race" but I definitively need that feature soon, so 
>>>> I rather share how I would have done it.
>>>>
>>>>   Ideally, I would have made a new "rangechange" event for the 
>>>> OpenLayers.Layer object and listen to that event to disable/enable 
>>>> the UI of the node accordingly.  Upon creation, a node would be 
>>>> disabled if the 'inRange' is set to 'false' (unless it's a base 
>>>> layer).
>>>>
>>>>   That's pretty much it.  Does that make sense ?  How about your 
>>>> method ?
>>>>
>>>> Alexandre
>>>>
>>>>
>>>> On 10-10-21 10:29 AM, Matt Priour wrote:
>>>>> "It's a race" ;)
>>>>> I am working on implementing that feature today as well.
>>>>>
>>>>> Matt Priour
>>>>> Kestrel Computer Consutling
>>>>>
>>>>>
>>>>> --------------------------------------------------
>>>>> From: "Alexandre Dube" <adube at mapgears.com>
>>>>> Sent: Thursday, October 21, 2010 8:55 AM
>>>>> To: "Andreas Hocevar" <ahocevar at opengeo.org>
>>>>> Cc: "GeoEXT Users" <users at geoext.org>
>>>>> Subject: Re: [Users] Tree node disabling with min/max scale
>>>>>
>>>>>> Got it.  I guess it shouldn't be that hard to implement, so I'll 
>>>>>> give it
>>>>>> a try and report back with a patch + ticket if it goes well.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Alexandre
>>>>>>
>>>>>>
>>>>>> On 10-10-21 09:39 AM, Andreas Hocevar wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> this would be a useful improvement, but it is not yet 
>>>>>>> implemented - patches welcome!
>>>>>>>
>>>>>>> Regards,
>>>>>>> Andreas.
>>>>>>>
>>>>>>> On Oct 21, 2010, at 15:30 , Alexandre Dube wrote:
>>>>>>>
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>>    The LayerSwitcher automatically disables its layer elements 
>>>>>>>> when
>>>>>>>> zooming in/out following the min/max scale values of each 
>>>>>>>> layer.  Is
>>>>>>>> that feature available with GeoExt tree nodes as well or do I 
>>>>>>>> need to do
>>>>>>>> that manually ?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> -- 
>>>>>>>> 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
>>>>>>
>>>>
>>>>
>>>> -- 
>>>> Alexandre Dubé
>>>> Mapgears
>>>> www.mapgears.com
>>>>
>>>>
>>
>>
>> -- 
>> Alexandre Dubé
>> Mapgears
>> www.mapgears.com
>>
>>


-- 
Alexandre Dubé
Mapgears
www.mapgears.com



More information about the Users mailing list