Hi Bill,
Sorry for not getting back to you sooner, I set your email aside to
think about it a little bit, and a time filter put it somewhere where
I lost track of it.
I can't really think of a safe way to do what you want, unless you
want extend LayerHandler. I checked in a change to the LayerHandler
in the cvs beta on the website that moves the background layers to
the bottom before the LayerEvents get sent out, you could do the same
with your layers.
I think I would handle the three layers a little differently. You
can add PropertyChangeListeners and PaintListeners to a MapBean, so I
think I would create a Component that implements those interfaces and
forwards the relevant calls to the layers. That is, take the
Projection that shows up in the PropertyChangeEvent (property name
MapBean.projectionChange, new value is the Projection) and set it on
the layer, and call doPrepare() on it. Then, when the PaintListener
method is called, forward that Graphics object to the Layer's render
(Graphics) method.
You might be able to hold 3 OMGraphicLists in this component instead
of using Layers, and call repaint on the MapBean if they need to be
updated before the next projection change. I guess that depends on
what you're doing, however.
Hope this helps,
- Don
On Aug 21, 2006, at 6:01 PM, William Barber wrote:
> Hi folks,
>
> our application contains several layers that we expose in the
> LayersPanel, which the user is allowed to rearrange at will. It
> also contains 3 "invisible" layers, which must sit on top of the
> exposed layers in the layer stack. We start by adding these 3
> layers on top, which is fine. But, in the setLayers() method in our
> class that implements LayerListener, I have 3 moveLayer() calls to
> ensure that, if someone moves an exposed layer to the top, the 3
> invisible layers get moved back on top of all the layers. eg.:
>
> public void setLayers(LayerEvent e) {
> ...
> switch(type) {
> case LayerEvent.ALL:
> layerHandler.moveLayer(flashLayer, 0);
> layerHandler.moveLayer(highlightLayer, 1);
> layerHandler.moveLayer(virtualLayer, 2);
> ...
> }
>
> These moveLayers() calls seem to be causing a deadlock in the
> LayerHandler setLayers() method (see thread dump below).
> The deadlock occurs in the first line of LayerHandler.setLayers()
> (line 488):
>
> allLayers = layers;
>
> Is there an accepted way to safely rearrange layers from within on
> the app's setLayers() method?
>
> Many thanks for any help, Bill Barber
> ----------------------------------------------------------------------
> ---------
> OpenMap(tm) Version 4.6.3
> Copyright (C) BBNT Solutions LLC. All rights reserved.
> See http://openmap.bbn.com/ for details.
>
> Full thread dump Java HotSpot(TM) Client VM (1.5.0_06-b05 mixed
> mode, sharing):
>
> "Thread-11" prio=1 tid=0x0861c358 nid=0x16f4 waiting for monitor
> entry [0xaaed7000..0xaaed8030]
> at com.bbn.openmap.LayerHandler.setLayers(LayerHandler.java:
> 488)
> - waiting to lock <0x5cc8c1c0> (a
> com.bbn.openmap.LayerHandler)
> at com.bbn.openmap.LayerHandler.moveLayer(LayerHandler.java:
> 645)
> at userinterface.vis2d.Map.setLayers(Map.java:495)
> at com.bbn.openmap.event.LayerSupport.fireLayer
> (LayerSupport.java:91)
> - locked <0x5cc8c230> (a com.bbn.openmap.event.LayerSupport)
> at com.bbn.openmap.event.LayerSupport$SetLayerRunnable.doIt
> (LayerSupport.java:176)
> at com.bbn.openmap.event.LayerSupport$SetLayerRunnable.run
> (LayerSupport.java:165)
> at java.lang.Thread.run(Thread.java:595)
>
> "TimerQueue" daemon prio=1 tid=0x085dcad0 nid=0x16ef in Object.wait
> () [0xaa4d6000..0xaa4d6eb0]
> at java.lang.Object.wait(Native Method)
> - waiting on <0x5d046e20> (a javax.swing.TimerQueue)
> at javax.swing.TimerQueue.run(TimerQueue.java:233)
> - locked <0x5d046e20> (a javax.swing.TimerQueue)
> at java.lang.Thread.run(Thread.java:595)
>
> --
> [To unsubscribe to this list send an email to "majdart_at_bbn.com"
> with the following text in the BODY of the message "unsubscribe
> openmap-users"]
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, dietrick_at_bbn.com
BBN Technologies, Cambridge, MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Sep 12 2006 - 18:34:54 EDT