<br><font size=2 face="sans-serif">Almost done....Amasing how things are
easy to do with OL.</font>
<br>
<br><font size=2 face="sans-serif">I have a wms layers array, "overlays[]"</font>
<br><font size=2 face="sans-serif">I use this code to create the layers
array of the overview map and to define the visibilitychanged event.</font>
<br><font size=2 face="sans-serif">var addLayersToMap = function()</font>
<br><font size=2 face="sans-serif">{ </font>
<br><font size=2 face="sans-serif">for( i in overlays )//overlays contains
my wms layers</font>
<br><font size=2 face="sans-serif">{</font>
<br><font size=2 face="sans-serif"> map.addLayer(
overlays[i] );</font>
<br><font size=2 face="sans-serif"> ov_overlays[i]
= overlays[i].clone();</font>
<br><font size=2 face="sans-serif"> ov_map.addLayer(
ov_overlays[i] );</font>
<br>
<br><font size=2 face="sans-serif"> //Ajoute
un listener au niveau de la carte principal pour gérer l'affichage sur
la ov_map</font>
<br><font size=2 face="sans-serif"> overlays[i].events.on(</font>
<br><font size=2 face="sans-serif"> {</font>
<br><font size=2 face="sans-serif">
'visibilitychanged': function(event)</font>
<br><font size=2 face="sans-serif">
{</font>
<br><font size=2 face="sans-serif">
ov_overlays[i].setVisibility(overlays[i].getVisibility());</font>
<br><font size=2 face="sans-serif">
}</font>
<br><font size=2 face="sans-serif"> });</font>
<br><font size=2 face="sans-serif">}</font>
<br><font size=2 face="sans-serif">}</font>
<br>
<br><font size=2 face="sans-serif">in run time, only the visibility of
the last layer of the array gets updated in the other map.</font>
<br><font size=2 face="sans-serif">I also tried with map.addLayers after
adding the overlays[i]. events on...with the same result</font>
<br>
<br><font size=2 face="sans-serif">Do you see something wrong</font>
<br><font size=2 face="sans-serif">thanks</font>
<br><font size=2 face="sans-serif">Steve</font>
<p>
<p>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Alexandre Dube <adube@mapgears.com></b>
</font>
<p><font size=1 face="sans-serif">04/02/2010 03:36 PM</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">A</font></div>
<td><font size=1 face="sans-serif">Steve.Toutant@inspq.qc.ca</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td><font size=1 face="sans-serif">users@openlayers.org</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Objet</font></div>
<td><font size=1 face="sans-serif">Re: [OpenLayers-Users] Magnifier window</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br>
<br>
<br><tt><font size=2>Hi Steve,<br>
<br>
I think you could do something like that (pseudo-code) :<br>
<br>
Create your original map<br>
Create all your layers and add them to the map<br>
<br>
Create your ov-map<br>
Register a mapmove event to the map to make ov-map follow it<br>
For each layer<br>
Clone it and add it to ov-map<br>
Register a visibilitychange event to a onVisibilityChanged
function<br>
<br>
onVisibilityChanged: function(event)<br>
var layers = ov-map.getLayersByName(this.name); // this is
the layer <br>
the visibility was changed<br>
if(layers && layers.length == 1)<br>
layers[0].setVisibility(this.visibility())<br>
<br>
Do you get the idea ?<br>
<br>
Best regards,<br>
<br>
Alexandre<br>
<br>
Steve.Toutant@inspq.qc.ca wrote:<br>
><br>
> Hi,<br>
> I'm using openlayers with geoext.<br>
> I would like to create a magnifier window. So it is like an overview
<br>
> map with a fix map center and a fix zoom level, but the main map and
<br>
> this overview map share the same geoext tree, so the layers are <br>
> shown/hidden on both maps.<br>
><br>
> I think I can do it if I start with the overview map example, here<br>
> http://www.openlayers.org/dev/examples/example-list.html<br>
><br>
> Does someone have a better idea or already tried this?<br>
><br>
> thanks in advance<br>
> Steve<br>
><br>
> ------------------------------------------------------------------------<br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
> Users@openlayers.org<br>
> http://openlayers.org/mailman/listinfo/users<br>
> <br>
<br>
<br>
-- <br>
Alexandre Dubé<br>
Mapgears<br>
www.mapgears.com<br>
<br>
</font></tt>
<br>
<br>
<br>