[OpenLayers-Users] Overriding overlay select to force a reload
of the toggled layer
Jay Douillard
jay.douillard at ubc.ca
Wed Jul 15 13:17:35 EDT 2009
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.
http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Layer-js.html#OpenLayers.Layer.visibility
http://dev.openlayers.org/apidocs/files/OpenLayers/Events-js.html
----
Jay
----- Original Message -----
From: "Adrian Popa" <adrian_gh.popa at romtelecom.ro>
To: users at openlayers.org
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
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users
More information about the Users
mailing list