Class TLcdGXYAsynchronousLabelPlacer

java.lang.Object
com.luciad.view.gxy.labeling.TLcdGXYAsynchronousLabelPlacer
All Implemented Interfaces:
ILcdCloneable, ILcdGXYViewLabelPlacer, Cloneable

public class TLcdGXYAsynchronousLabelPlacer extends Object implements ILcdGXYViewLabelPlacer
This view label placer can be used to perform asynchronous labeling. It tries to execute the label placing on the PaintQueue thread(s) and on a background thread. Because of this, the EventDispatch thread is never blocked during label placing. Asynchronous label placing can be enabled by adding this view label placer to the view.

Asynchronous label placing can be used in two cases :

  • with asynchronous painting disabled : label placing is executed partly on the EventDispatch thread, and partly on a background thread. The consequence is that in this case asynchronous label placing still shows blocking behavior when it uses the EventDispatch thread.
  • with asynchronous painting enabled : label placing is executed partly on the PaintQueue thread(s) and partly on a background thread. Because the EventDispatch thread is never used, label placing is non-blocking.

When using asynchronous labeling, thread-safety of the labeling algorithms should be kept in mind. Problems can occur if the ILcdGXYLabelingAlgorithm.collectLabelInfo implementation is not thread safe. When this is the case, an instance of the (non thread-safe) labeling algorithm should not be used on multiple threads. This is especially important when asynchronous painting is used, because in that case, the collecting method of the labeling algorithm can be executed on multiple PaintQueue threads.

When the collecting method of a labeling algorithm is thread-safe, they can be used on multiple threads without a problem. One should also make sure that when the collecting of labeling information is performed on multiple threads, the set priority provider is also thread-safe.

Note: When using this label placer in combination with asynchronous painting, it passes the wrapped layer to the labeling algorithm, and not the asynchronous layer wrapper.

Since:
10.1