Hi,

You are in luck. All objects in the main model are EMF objects which have a eSetDeliver method. So if you set the visibility of a layer you need to disable the layer's events if you dont want it to fire. So for your example:


1) ((Map)map).eSetDeliver( false );
2) foreach layer ((Layer)layer).eSetDeliver( false );
3) Turn layers' visibility on/off
4) map.setBbox( selectedLayer.getBbox() )
5) ((Map)map).eSetDeliver( true );
6) foreach layer ((Layer)layer).eSetDeliver( true );
7) map.refresh()

Jesse


On 18-Dec-08, at 11:06 AM, Ugo Taddei wrote:

Hello,

we have built a widget that replaces some of the functionality provided by the LayersView. It's basically a combo box with the current layers, and which sets the visibility for all layers to be false, except the one chosen by the combo. Furthermore, on selecting, the map should zoom to the layer's bbox. Like this (in pseudo):

1) User selects layer on combo?
2) for each layer
 if layer is not selected layer -> setVisible( false )
 else setVisible( true )

map refreshes here!

3) map.setBbox( selectedLayer.getBbox() )

map refreshes again!

This all works fine. However, there are two events (or more) being triggered: layer visibility (implies a map refresh), jump to bbox (another map refresh).

Is there a way to temporarily disable map refresh? As in

1) map.setFiringEvents( false );
2) Turn layers' visibility on/off
3) map.setBbox( selectedLayer.getBbox() )
4) map.setFiringEvents( true );
5) map.refresh()

Thanks in advance,

Ugo

--
Ugo Taddei

Fraunhofer Institut Intelligente Analyse- und Informationssysteme (FhG IAIS)
http://www.iais.fraunhofer.de
Department Knowledge Discovery - IAIS.KD -
Working Group Spatial Decision Support
http://www.iais.fraunhofer.de/kd.html
phone  (+49)2241-14-2184    fax    (+49)2241-14-2072
Schloss Birlinghoven, D-53754 Sankt Augustin, Germany
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to