<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hello Jay,<br>
<br>
Thanks for your help. I ended up doing:<br>
<br>
markers.events.on({ "featureselected": onMarkerSelect,
"featureunselected": onMarkerUnselect, <b>"visibilitychanged":
onMarkerToggle</b> });<br>
<br>
function onMarkerToggle(event)
{
<br>
//ask for this layers refresh if visibility becomes
true
<br>
if(markers.visibility ==
true){
<br>
// alert("requesting marker
refresh");
<br>
updateActiveAlarms(); //this refreshes the layer<br>
}
<br>
} <br>
<br>
It works perfectly. Thanks again,<br>
Adrian<br>
<br>
Jay Douillard wrote:
<blockquote
cite="mid:10988451.80491247678255022.JavaMail.root@verrazzano"
type="cite">
<pre wrap="">Adrian,
You need to register events to fire when want refreshing to occur.
You can use the visibility property of a layer to test if it is visible and only refresh those layers that are.
<a class="moz-txt-link-freetext" href="http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Layer-js.html#OpenLayers.Layer.visibility">http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Layer-js.html#OpenLayers.Layer.visibility</a>
<a class="moz-txt-link-freetext" href="http://dev.openlayers.org/apidocs/files/OpenLayers/Events-js.html">http://dev.openlayers.org/apidocs/files/OpenLayers/Events-js.html</a>
----
Jay
----- Original Message -----
From: "Adrian Popa" <a class="moz-txt-link-rfc2396E" href="mailto:adrian_gh.popa@romtelecom.ro"><adrian_gh.popa@romtelecom.ro></a>
To: <a class="moz-txt-link-abbreviated" href="mailto:users@openlayers.org">users@openlayers.org</a>
Sent: Tuesday, July 14, 2009 11:27:17 PM GMT -08:00 US/Canada Pacific
Subject: [OpenLayers-Users] Overriding overlay select to force a reload of the toggled layer
Hi everybody,
I have several overlay vector layers that get their data in KML format
from some server-side scripts. The data is highly dynamic, so it needs
to be refreshed constantly (this is solved). The problem appears if only
one overlay layer is selected (visible), I need to refresh all overlay
layers so that if the user toggles another overlay, he will have the
most recent data. I would like to reduce the overhead on the server and
client side and only refresh the visible overlay layers, and to force a
refresh of a layer whenever the user makes it visible. For this I would
have to override the function that runs when a layer is selected in the
layer switcher and call another refresh function before the layer is
made visible. Can anyone point me in the right direction?
P.S. I would like to do this without editing the openlayers code;
instead I would like to override/overload the function for my objects only.
Thanks,
Adrian
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@openlayers.org">Users@openlayers.org</a>
<a class="moz-txt-link-freetext" href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>