Hi,
what you're obviously doing is de-couple the view from the model. If
your large number of maps are all using the same context model, you do
not need a sync button at all -- they will automatically synchronize:
<Context id="yourContext">
<widgets>
<MapPaneOL id="map1">
...
</MapPaneOL>
<MapPaneOL id="map2">
...
</MapPaneOL>
<MapPaneOL id="map3">
...
</MapPaneOL>
</widgets>
</Context>
Regards,
Andreas.
On Nov 22, 2007 4:09 PM, Marcos Sánchez Provencio <[EMAIL PROTECTED]> wrote:
>
> Sorry;
>
> I'll try with an example (I have implemented it already, so it is not so
> important now).
>
> I have a large (16+) number of maps in one page. I wanted to implement a
> button to sync all the views (the zoom and auxiliary visible layers). I
> found a suboptimal solution that I'd like to improve.How could I find a more
> elegant way? This is what I did (overwriting the reset button with a
> different name):
>
> function Sincro(widgetNode, model) {
> ButtonBase.apply(this, new Array(widgetNode, model));
>
> this.cursor = "default";
>
> this.doSelect = function(selected,objRef) {
> if (selected){
>
> var checks=document.getElementsByTagName('input')
> var
> capas=objRef.targetModel.doc.selectNodes("/wmc:ViewContext/wmc:LayerList/wmc:Layer/wmc:Name");
> var ocultas=new Array()
> for (var l=0;l<capas.length;l++){
> var nombreCapa=capas[l].firstChild.nodeValue
> var oculta=objRef.targetModel.getHidden(nombreCapa)
> ocultas['legend_'+nombreCapa]=oculta
> }
> for (var l=0;l<checks.length;l++){
> var check=checks[l]
> if (check.type=='checkbox'){
> check.checked=ocultas[check.id]=='0'
> var onclick=check.getAttributeNode('onclick').nodeValue
> onclick=onclick.replace('this','check')
> eval(onclick)
> }
> }
>
> // Buscar el resto de los modelos y recentrarlos
> var originalExtent = objRef.targetModel.extent;
> for (var oo in config.objects){
> var o=config.objects[oo]
> if ((o.extent)&& (o!==objRef.targetModel)&&(oo[0]=='m')){
> //excluyo los locator
> o.extent.centerAt(originalExtent.getCenter(),
> originalExtent.res[0] )
> }
> }
> }
> -------------------------------------------------------------------------
> 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
>
>
-------------------------------------------------------------------------
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