[Users] Disable Nodes on Zoom Event
Matt Priour
mpriour at kestrelcomputer.com
Thu Oct 28 17:45:55 CEST 2010
You have to "Apply" the patch. The exact instructions are SVN client dependant. If you are using SVN command-line then the OL wiki has good instructions. [1]
If you are using something like TortiseSVN, then you would right click on the GeoExt root directory in the file explorer.
Select TortiseSVN -> Apply Patch
Then select the patch file and hit apply
[1] http://trac.osgeo.org/openlayers/wiki/ApplyingPatches
Matt Priour
Kestrel Computer Consulting
From: IT Intern
Sent: Thursday, October 28, 2010 10:17 AM
To: users at geoext.org
Subject: Re: [Users] Disable Nodes on Zoom Event
My apologies, just realized it is a patch file not a .js, but I still need to know where exactly it goes...
On Thu, Oct 28, 2010 at 11:15 AM, IT Intern <itintern12 at gmail.com> wrote:
That's quite awesome! Thanks Matt. So now where do I apply this patch :p
Do I just copy the file into
lib/GeoExt/widgets/tree
and override the old LayerNode.js no worries???
cheers,
elshae
On Thu, Oct 28, 2010 at 10:46 AM, Matt Priour <mpriour at kestrelcomputer.com> wrote:
OpenLayers already has a Map moveend event handler that will check to see if the layer is still in range (maxExtent, minResolution, maxResolution, minScale & maxScale are all tested)
You should use one of these configuration options (maxResolution, minResolution are easiest) on the layers and let OL do the turning on/off layers for you.
To have your GeoExt LayerNodes respond by enabling/disabling when layers are in/out of range, you can apply the autoDisable patch [1] attached to Ticket #235 (http://trac.geoext.org/attachment/ticket/235)
[1] http://trac.geoext.org/attachment/ticket/235/autoDisableLayerNode.patch
Matt Priour
Kestrel Computer Consulting
From: IT Intern
Sent: Thursday, October 28, 2010 9:08 AM
To: users at geoext.org
Subject: [Users] Disable Nodes on Zoom Event
Hello GeoExt Users,
I have a zoom event that when a user zoom in and out of my map certain layers I setVisibility(false). Now what I would like to do is have another event inside that event which disables the nodes of those layers when their setVisibilty(false) and enables them back when setVisibility(true). I have some code and it kinda works, but the problem is the checkchange event does not only work when the zoomend event is done, but also anytime a user clicks the layer nodes. I played a little with stopPropagation and that didn't do anything for me. Actually I think my zoomend event could be much better coded and I would really love some suggestions. I appreciate everyone taking their time to help me :)
elshae
Code:
map.events.on({ "zoomend": function (e) {
layerTree.on("checkchange", function (node, checked) {
alert(node.text + "Inside event");
if(checked == false)
node.disable();
else if(checked == true)
node.enable();
});
if (this.getZoom() > 7) {
tib_villages.setVisibility(true);
tib_lakes.setVisibility(true);
tib_townships.setVisibility(true);
}
else {
tib_villages.setVisibility(false);
tib_lakes.setVisibility(false);
tib_townships.setVisibility(false);
//alert(layerTree.tib_villages.node.text);
if (this.getZoom() > 5) {
infrastructure.setVisibility(true);
geography.setVisibility(true);
geography2.setVisibility(true);
tib_countys.setVisibility(true);
}
else{
infrastructure.setVisibility(false);
geography.setVisibility(false);
geography2.setVisibility(false);
tib_countys.setVisibility(false);
}
}//end else
}//end function (e)
}); //end map.events.on
----------------------------------------------------------------------------
_______________________________________________
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101028/134b6ee8/attachment-0001.htm
More information about the Users
mailing list