Class ALcyAsynchronousPaintFacade
Whoever creates an ILcdGXYLayer
that is eligible
for asynchronous painting should pass it to the method createGXYAsynchronousLayer(com.luciad.view.gxy.ILcdGXYLayer)
.
Layers returned by this method can be accessed and added to a view just like regular layers.
Depending on the actual facade instance, the original layer will be painted asynchronously or
not. However, the returned layer is not guaranteed to be the same layer as the original
layer. To access the original layer safely, use the method invokeAndWaitOnGXYLayer(com.luciad.view.gxy.ILcdGXYLayer, com.luciad.view.gxy.asynchronous.ILcdGXYAsynchronousLayerRunnable)
. This
method can be used for any ILcdGXYLayer
, including synchronously painted layers.
-
Constructor Summary
ModifierConstructorDescriptionprotected
Creates a newALcyAsynchronousPaintFacade
. -
Method Summary
Modifier and TypeMethodDescriptionabstract ILcdGXYLayer
Enables the given layer to be painted asynchronously, depending on the facade instance.abstract ILcyGXYLayerOrderManager
Creates a new layer order manager based on the given one.abstract ILcyLayerStyleProvider
createGXYAsynchronousLayerStyleProvider
(ILcyLayerStyleProvider aLayerStyleProvider, ILcdFilter aLayerFilter) Creates a new asynchronous layer style provider based on the given layer style provider.abstract ILcdGXYViewLabelPainter
createGXYAsynchronousViewLabelPainter
(ILcdGXYView aView, ILcdGXYViewLabelPainter aViewLabelPainter) Creates a new view label painter based on the given one.abstract ILcdGXYLayer
createGXYLspAsynchronousLayer
(ILspLayer aLspLayer, ILcdGXYLayer aGXYLayer) Enables the given layers to be painted asynchronously, depending on the facade instance.abstract void
invokeAndWaitOnGXYLayer
(ILcdGXYLayer aGXYLayer, ILcdGXYAsynchronousLayerRunnable aLayerRunnable) Invokes the given runnable for the given layer without interfering with the layer's painting thread.abstract void
invokeLaterOnGXYLayer
(ILcdGXYLayer aGXYLayer, ILcdGXYAsynchronousLayerRunnable aLayerRunnable) Invokes the given runnable for the given layer without interfering with the layer's painting thread.abstract void
invokeLaterOnGXYLayerInEDT
(ILcdGXYLayer aGXYLayer, ILcdGXYAsynchronousLayerRunnable aLayerRunnable) Invokes the given runnable for the given layer without interfering with the layer's painting thread.abstract void
invokeNowOnGXYLayer
(ILcdGXYLayer aGXYLayer, ILcdGXYAsynchronousLayerRunnable aLayerRunnable) Executes the given invocation for the given layer.abstract void
Creates a new paint queue manager for the given view's asynchronous layers.
-
Constructor Details
-
ALcyAsynchronousPaintFacade
protected ALcyAsynchronousPaintFacade()Creates a newALcyAsynchronousPaintFacade
.
-
-
Method Details
-
createGXYAsynchronousLayer
Enables the given layer to be painted asynchronously, depending on the facade instance.After calling this method, the given layer may be painted in a painting thread other than the event dispatch thread. To access the original layer so that the access does not interfere with the both synchronous and asynchronous painting, use
invokeAndWaitOnGXYLayer(com.luciad.view.gxy.ILcdGXYLayer, com.luciad.view.gxy.asynchronous.ILcdGXYAsynchronousLayerRunnable)
orinvokeLaterOnGXYLayer(com.luciad.view.gxy.ILcdGXYLayer, com.luciad.view.gxy.asynchronous.ILcdGXYAsynchronousLayerRunnable)
.- Parameters:
aLayer
- the layer to paint asynchronously. The layer's paint method should take care when waiting for another thread: if that thread in turn waits for asynchronous painting to complete, a deadlock will occur.- Returns:
- a layer that will paint the given layer asynchronously (depending on the facade
instance). It is this layer that should be inserted in a view. Note that this layer is
not necessarily the same as
aLayer
.
-
createGXYLspAsynchronousLayer
public abstract ILcdGXYLayer createGXYLspAsynchronousLayer(ILspLayer aLspLayer, ILcdGXYLayer aGXYLayer) Enables the given layers to be painted asynchronously, depending on the facade instance.
Both
aLspLayer
andaGXYLayer
should represent the same model. Depending on whether the used hardware supports Lightspeed rendering, the Lightspeed layer will be used to render thebody
representation of the visualization. The GXY layer is used for all parts of the visualization that are not taken care off by the Lightspeed layer (selection, labeling).After calling this method, the given layers may be painted in a painting thread other than the event dispatch thread. To access the original GXY layer so that it does not interfere with both synchronous and asynchronous painting, use
invokeAndWaitOnGXYLayer(com.luciad.view.gxy.ILcdGXYLayer, com.luciad.view.gxy.asynchronous.ILcdGXYAsynchronousLayerRunnable)
orinvokeLaterOnGXYLayer(com.luciad.view.gxy.ILcdGXYLayer, com.luciad.view.gxy.asynchronous.ILcdGXYAsynchronousLayerRunnable)
. The original Lightspeed layer should not be accessed.- Parameters:
aLspLayer
- The Lightspeed layer used to display thebody
representation of the visualizationaGXYLayer
- The GXY layer used to display all other representations of the visualization- Returns:
- a layer that will paint the given layers asynchronously (depending on the facade
instance) It is this layer that should be inserted in a view. Note that this layer is
not necessarily the same as
aGXYLayer
.
-
invokeLaterOnGXYLayer
public abstract void invokeLaterOnGXYLayer(ILcdGXYLayer aGXYLayer, ILcdGXYAsynchronousLayerRunnable aLayerRunnable) Invokes the given runnable for the given layer without interfering with the layer's painting thread. If the layer is painted synchronously, the runnable is queued on the event dispatch thread. If the given layer is painted asynchronously, the runnable is queued on the asynchronous paint thread.
The method returns immediately.To avoid concurrency problems with property change listeners, layer property changes will be fired on the event dispatch thread, not on the paint thread.
- Parameters:
aGXYLayer
- the layer that will be accessed and/or changed. AnyILcdGXYLayer
is allowed, but if a layer was used increateGXYAsynchronousLayer(com.luciad.view.gxy.ILcdGXYLayer)
, only the result of the latter method should be passed, not the original layer.aLayerRunnable
- the runnable to invoke. The runnable will be called with the original layer of the aforementionedaGXYLayer
. The runnable'srun
method should take care when waiting for another thread: if that thread in turn waits for the painting thread to stop, a deadlock will occur.
-
invokeLaterOnGXYLayerInEDT
public abstract void invokeLaterOnGXYLayerInEDT(ILcdGXYLayer aGXYLayer, ILcdGXYAsynchronousLayerRunnable aLayerRunnable) Invokes the given runnable for the given layer without interfering with the layer's painting thread. The runnable is queued on the event dispatch thread. The method returns immediately.
This method is useful for code that needs to be executed on the EDT, while not blocking the user interface while waiting for the asynchronous painting to complete.- Parameters:
aGXYLayer
- the layer that will be accessed and/or changed. AnyILcdGXYLayer
is allowed, but if a layer was used increateGXYAsynchronousLayer(com.luciad.view.gxy.ILcdGXYLayer)
, only the result of the latter method should be passed, not the original layer.aLayerRunnable
- the runnable to invoke. The runnable will be called with the original layer of the aforementionedaGXYLayer
.
-
invokeAndWaitOnGXYLayer
public abstract void invokeAndWaitOnGXYLayer(ILcdGXYLayer aGXYLayer, ILcdGXYAsynchronousLayerRunnable aLayerRunnable) throws InterruptedException Invokes the given runnable for the given layer without interfering with the layer's painting thread. If the given layer is painted asynchronously, the invocation will not interfere with the asynchronous painting. If the layer is painted synchronously, the runnable is executed in the event dispatch thread.
The method will wait until the invocation has stopped.- Parameters:
aGXYLayer
- the layer that will be accessed and/or changed. AnyILcdGXYLayer
is allowed, but if a layer was used increateGXYAsynchronousLayer(com.luciad.view.gxy.ILcdGXYLayer)
, only the result of the latter method should be passed, not the original layer.aLayerRunnable
- the runnable to invoke. The runnable will be called with the original layer of the aforementionedaGXYLayer
. The runnable'srun
method should take care when waiting for another thread: if that thread in turn waits for the painting thread to stop, a deadlock will occur.- Throws:
InterruptedException
- when the thread is interrupted while waiting for the execution to complete
-
invokeNowOnGXYLayer
public abstract void invokeNowOnGXYLayer(ILcdGXYLayer aGXYLayer, ILcdGXYAsynchronousLayerRunnable aLayerRunnable) Executes the given invocation for the given layer. The caller should take care that the invocation does not interfere with asynchronous painting.- Parameters:
aGXYLayer
- the layer that will be accessed and/or changed. AnyILcdGXYLayer
is allowed, but if a layer was used increateGXYAsynchronousLayer(com.luciad.view.gxy.ILcdGXYLayer)
, only the result of the latter method should be passed, not the original layer.aLayerRunnable
- the runnable to invoke. The runnable will be called with the original layer of the aforementionedaGXYLayer
.
-
createGXYAsynchronousLayerOrderManager
public abstract ILcyGXYLayerOrderManager createGXYAsynchronousLayerOrderManager(ILcyGXYLayerOrderManager aManager) Creates a new layer order manager based on the given one. The manager could take into account asynchronous paint hints.- Parameters:
aManager
- the manager to delegate to. The new manager will respect the constraints and behavior of this manager.- Returns:
- a new manager that handles both synchronously and asynchronously painted layers
-
createGXYAsynchronousViewLabelPainter
public abstract ILcdGXYViewLabelPainter createGXYAsynchronousViewLabelPainter(ILcdGXYView aView, ILcdGXYViewLabelPainter aViewLabelPainter) Creates a new view label painter based on the given one. The painter can accelerate label painting, e.g. by temporarily skipping labels of layers that are being asynchronously painted.- Parameters:
aView
- the view for which to create a label painteraViewLabelPainter
- an existing view label painter- Returns:
- a new view label painter that handles labels of both synchronously and asynchronously painted layers
-
setupGXYAsynchronousPaintQueueManager
Creates a new paint queue manager for the given view's asynchronous layers.
- Parameters:
aView
- the view for which the manager is created- See Also:
-
createGXYAsynchronousLayerStyleProvider
public abstract ILcyLayerStyleProvider createGXYAsynchronousLayerStyleProvider(ILcyLayerStyleProvider aLayerStyleProvider, ILcdFilter aLayerFilter) Creates a new asynchronous layer style provider based on the given layer style provider.- Parameters:
aLayerStyleProvider
- a given layer style provider.aLayerFilter
- a filter which returns true for layers for which the new layer style provider should work.- Returns:
- a new asynchronous layer style provider based on the given layer style provider.
-