[OpenLayers-Users] Magnifier window

Alexandre Dube adube at mapgears.com
Fri Feb 5 11:40:28 EST 2010


Steve,

Steve.Toutant at inspq.qc.ca wrote:
>
> Alexandre, i don't understand want you mean by
> "and attach it to the original layer ( layer.clonedLayer = 
> myCloneLayer )"
> Do you think that could help with the length returned by 
> ov_map.getLayersByName(this.name)
The 2nd option is : do not use ov_map.getLayersByName(this.name).  
Instead, when creating your myCloneLayer object, make a reference to it 
to its original layer : layer.cloneLayer = myCloneLayer.

Alexandre


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


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Users mailing list