Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Delaying map refresh

I have a different answer than Jesse (which may mean I am wrong - heh). I would make a CompositeCommand that does all the work you want to in one go ... the map will only have a chance to respond when the composite command is finished its work.

This is the point where Jesse either says "you are wrong jody" or "that is a good idea".

Jody

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




Back to the top