Hi,

On Nov 23, 2007 10:54 AM, Marcos Sánchez Provencio <[EMAIL PROTECTED]> wrote:
> Sorry if I ask nonsense. If they all use the same context, do they all
> look the same? I need one of the layers (the opaque one) to be different
> in each of them. The transparent layers are auxiliary.

No, you're not asking nonsense. My previous answer was nonsense. But
there is also a clean way to achieve what you want using several
contexts. For the zoom/pan (called area of interest), you can use the
existing ZoomToAoi tool. If your master map (the one that controls the
viewport of the others has a context model with id "mainMap", you
would have to add the following under the <tools> section of your
other models:

        <ZoomToAoi id="separateIdForEachContextHere">
          <targetModel>mainMap</targetModel>
        </ZoomToAoi>

This will listen to the aoi event, and will synchronize the maps
without pressing a button. If you do not want this, copy this tool and
remove the listener for the aoi event.

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. If you want to synchronize automatically when changing layer
visibility in the master map, it is even simpler:

this.syncHidden = function(objRef);
  var layer = objRef.model.getParam("hidden");
  objRef.model.setHidden(layer);
}
this.targetModel.addListener("hidden", this.syncHidden, this);

Regards,
Andreas.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mapbuilder-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mapbuilder-users

Reply via email to