Still working on that... If I use getAllLayers, I have no idea of how to
get their names. So I use the following selectNodes call.
I sync the layers alright, but not the checks. In my previous version, I
acted on the checks so the layers got hidden/shown fine. Is there a
similar inverse approach? I understand it is more correct to act on the
models than touching gui elements...

  this.doSelect = function(selected,objRef) {
    if (selected){
        var
capas=objRef.targetModel.doc.selectNodes("/wmc:ViewContext/wmc:LayerList/wmc:Layer/wmc:Name");
        //store hidden state for each source layer
        var ocultas=new Array()
        for (var l=0;l<capas.length;l++){
            var nombreCapa=capas[l].firstChild.nodeValue
            var oculta=objRef.targetModel.getHidden(nombreCapa)!=='0'
            ocultas[nombreCapa]=oculta
            }
        // See other models, copy stored info
      var originalExtent = objRef.targetModel.extent;
      var contextos=config.modelNode.selectNodes('mb:models/mb:Context')
        for (var oo=0; oo< contextos.length; oo++){
            var c=contextos[oo]
            var idContexto=c.attributes.id.nodeValue
            var o=config.objects[idContexto]
            if ((idContexto!
==objRef.targetModel.id)&&(idContexto[0]==='m')){ //excluyo los locator
                    for (var i in ocultas)
                        o.setHidden(i,ocultas[i])
                    o.extent.centerAt(originalExtent.getCenter(),
originalExtent.res[0] )
                }
            }
    }
  }



El vie, 23-11-2007 a las 15:42 +0100, Andreas Hocevar escribió:

> For synchronizing the layers, create a tool similar to the above with
> a method that looks something like this:
> 
> var masterLayers = objRef.targetModel.getAllLayers();
> var name, hidden;
> for (var i=0; i<masterLayers) {
>   name = getNodeValue("wmc:Name");
>   hidden = objRef.targetModel.getHidden(name);
>   objRef.model.setHidden(name);
> }.
> 
> The above assumes that you want to synchronize when you click a
> button.
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Mapbuilder-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mapbuilder-users

Reply via email to