[Users] Tree node disabling with min/max scale
Pierre Giraud
pierre.giraud at camptocamp.com
Thu Oct 21 16:55:44 CEST 2010
You must add a listener on TreeNode::expandnode too :
tree.on({
"expandnode": function(node) {
node.eachChild(checkInRange);
}
});
On Thu, Oct 21, 2010 at 4:49 PM, Pierre Giraud
<pierre.giraud at camptocamp.com> wrote:
> Hey all,
>
> Eric just told me to have a look at this thread.
> Actually, he remembered something I wrote for a project 4 months ago.
>
> So, here's how I managed to deal with min/maxScale in a layer tree.
> This code is on application side and it probably doesn't deserves to
> be in GeoExt.
>
> var checkInRange = function(node) {
> var n = node,
> scale = map.getScale(),
> minScale = n.attributes.minScale,
> maxScale = n.attributes.maxScale;
> if ((minScale && minScale > scale) || (maxScale && maxScale < scale)) {
> n.getUI().addClass("gx-tree-layer-outofrange");
> } else if (minScale || maxScale) {
> n.getUI().removeClass("gx-tree-layer-outofrange");
> }
> };
>
> map.events.on({
> "zoomend": function() {
> tree.getRootNode().cascade(checkInRange);
> }
> });
>
> With the css styles :
>
> .x-tree-node .gx-tree-layer-outofrange .x-tree-node-icon {
> opacity: 0.5;
> }
>
> .gx-tree-layer-outofrange .x-tree-node-anchor span {
> color: #777;
> }
>
>
> Pierre (so happy to contribute)
>
>
> On Thu, Oct 21, 2010 at 4:29 PM, Matt Priour
> <mpriour at kestrelcomputer.com> 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
>>>
>> _______________________________________________
>> Users mailing list
>> Users at geoext.org
>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>
>
>
>
> --
> Pierre GIRAUD
> Géomaticien, Analyste
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
>
> Tel : 00 33 4 79 44 44 93
> Mail : pierre.giraud at camptocamp.com
> http://www.camptocamp.com
>
--
Pierre GIRAUD
Géomaticien, Analyste
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 93
Mail : pierre.giraud at camptocamp.com
http://www.camptocamp.com
More information about the Users
mailing list