<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=iso-8859-1>
<META content="MSHTML 6.00.6002.18309" name=GENERATOR></HEAD>
<BODY id=MailContainerBody
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-TOP: 15px" leftMargin=0
topMargin=0 CanvasTabStop="true" name="Compose message area">
<DIV><FONT face=Arial size=2>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)</FONT></DIV>
<DIV><FONT face=Arial size=2>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.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>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 (<A
href="http://trac.geoext.org/attachment/ticket/235">http://trac.geoext.org/attachment/ticket/235</A>)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>[1] <A
href="http://trac.geoext.org/attachment/ticket/235/autoDisableLayerNode.patch">http://trac.geoext.org/attachment/ticket/235/autoDisableLayerNode.patch</A></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Matt Priour</FONT></DIV>
<DIV><FONT face=Arial size=2>Kestrel Computer Consulting</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV style="FONT: 10pt Tahoma">
<DIV><BR></DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=itintern12@gmail.com
href="mailto:itintern12@gmail.com">IT Intern</A> </DIV>
<DIV><B>Sent:</B> Thursday, October 28, 2010 9:08 AM</DIV>
<DIV><B>To:</B> <A title=users@geoext.org
href="mailto:users@geoext.org">users@geoext.org</A> </DIV>
<DIV><B>Subject:</B> [Users] Disable Nodes on Zoom Event</DIV></DIV></DIV>
<DIV><BR></DIV>Hello GeoExt Users,<BR><BR>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
:)<BR><BR>elshae<BR><BR>Code:<BR><BR>map.events.on({ "zoomend": function (e)
{<BR><BR>
layerTree.on("checkchange", function (node, checked)
{<BR>
alert(node.text + "Inside event");<BR>
if(checked == false)<BR>
node.disable();<BR>
else if(checked ==
true)<BR>
node.enable();<BR><BR>
});<BR>
<BR>
if (this.getZoom() > 7) {<BR>
tib_villages.setVisibility(true);<BR>
tib_lakes.setVisibility(true);<BR>
tib_townships.setVisibility(true);<BR><BR>
<BR>
}<BR>
else {<BR><BR>
tib_villages.setVisibility(false);<BR>
tib_lakes.setVisibility(false);<BR>
tib_townships.setVisibility(false);<BR>
//alert(layerTree.tib_villages.node.text);<BR>
<BR>
if (this.getZoom() > 5)
{<BR>
infrastructure.setVisibility(true);<BR>
geography.setVisibility(true);<BR>
geography2.setVisibility(true);<BR>
tib_countys.setVisibility(true);<BR>
<BR>
}<BR>
else{<BR>
infrastructure.setVisibility(false);<BR>
geography.setVisibility(false);<BR>
geography2.setVisibility(false);<BR>
tib_countys.setVisibility(false);<BR>
}<BR>
}//end
else<BR>
<BR>
}//end function
(e)<BR>
<BR>
}); //end map.events.on<BR>
<P>
<HR>
<P></P>_______________________________________________<BR>Users mailing
list<BR>Users@geoext.org<BR>http://www.geoext.org/cgi-bin/mailman/listinfo/users<BR></BODY></HTML>