Class TLcdGXYAsynchronousEditableLabelsLayerWrapper
- All Implemented Interfaces:
ILcdPropertyChangeSource
,ILcdSelection<Object>
,ILcdGXYAsynchronousLayerWrapper
,ILcdGXYEditableLabelsLayer
,ILcdGXYLayer
,ILcdLayer
,Serializable
- Direct Known Subclasses:
TLcdGXYAsynchronousEditableLabelsLayerTreeNodeWrapper
ILcdGXYAsynchronousLayerWrapper
for
ILcdGXYEditableLabelsLayer
instances, wrapping and protecting
the latter interface's state. It manages label positions for
asynchronous painting, in order to keep them consistent in between the
layer and its asynchronous wrapper.
This wrapper does not support labels produced by
ALcdGXYInteractiveLabelProvider
.
- Since:
- 7.2
- See Also:
-
Field Summary
Fields inherited from interface com.luciad.view.gxy.ILcdGXYEditableLabelsLayer
PLACED_LABELS
-
Constructor Summary
ConstructorDescriptionTLcdGXYAsynchronousEditableLabelsLayerWrapper
(ILcdGXYEditableLabelsLayer aDecoratedLayer) Creates a layer decorator that delegates painting to an asynchronous paint queue.TLcdGXYAsynchronousEditableLabelsLayerWrapper
(ILcdGXYEditableLabelsLayer aDecoratedLayer, ILcdGXYAsynchronousPaintQueue aPaintQueue) Creates a layer decorator that delegates painting to an asynchronous paint queue. -
Method Summary
Modifier and TypeMethodDescriptionint
applyOnInteract
(ILcdFunction aFunction, Graphics aGraphics, int aPaintMode, ILcdGXYView aGXYView) Applies the function to (at the least) all objects that are contained (partially or completely) in the bounds of the view.int
applyOnInteractLabels
(ILcdFunction aLabelFunction, Graphics aGraphics, int aPaintMode, ILcdGXYView aGXYView) Applies the function to (at the least) all labels that are contained (partially or completely) in the bounds of the view.Returns a state change synchronizer for the wrapped layer.getGXYLabelEditor
(Object aObject) Returns a clone of the wrapped layer's GXYLabelEditor, or the editor itself if the associated paint queue is empty.Returns a clone of the wrapped layer's ILcdGXYLabelingAlgorithm, or the algorithm itself if the associated paint queue is empty.Returns theALcdLabelLocations
instance which contains all the information about the labels of this layer.Returns a state change synchronizer for this wrapper.boolean
This flag determines if the labels are editable, i.e. if they can be moved by the user.boolean
This property determines whether the layer is equipped to let the user edit the labels.void
paint
(Graphics aGraphics, int aMode, ILcdGXYView aGXYView) Paints the layer asynchronously or synchronously, depending onisAsynchronous
.void
setAsynchronous
(boolean aAsynchronous) Disables or enables the asynchronous drawing.void
Sets the paint queue to delegate asynchronous paint requests to.void
setLabelsEditable
(boolean aLabelsEditable) This flag determines if the labels are editable, i.e. if they can be moved by the user.Methods inherited from class com.luciad.view.gxy.asynchronous.TLcdGXYAsynchronousLayerWrapper
addPropertyChangeListener, addSelectionListener, applyOnInteract, clearSelection, fireCollectedSelectionChanges, firePropertyChangeEvent, getBounds, getGXYAsynchronousPaintQueue, getGXYEditor, getGXYLabelPainter, getGXYLayer, getGXYPainter, getGXYPen, getIcon, getLabel, getLabelMapScaleRange, getLabelScaleRange, getMapScaleRange, getModel, getModelXYWorldTransfoClass, getScaleRange, getSelectionCount, invokeAndWaitOnGXYLayer, invokeLaterOnGXYLayer, invokeLaterOnGXYLayerInEDT, invokeNowOnGXYLayer, isAsynchronous, isEditable, isEditableSupported, isLabeled, isLabeledSupported, isSelectable, isSelectableSupported, isSelected, isTraceOn, isVisible, removePropertyChangeListener, removeSelectionListener, selectedObjects, selectObject, setEditable, setIcon, setLabel, setLabeled, setSelectable, setTraceOn, setVisible, stopPainting
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.view.gxy.ILcdGXYLayer
applyOnInteract, getBounds, getGXYEditor, getGXYLabelPainter, getGXYPainter, getGXYPen, getLabelMapScaleRange, getLabelScaleRange, getMapScaleRange, getModelXYWorldTransfoClass, getScaleRange, isLabeled, isLabeledSupported, setLabeled, stopPainting
Methods inherited from interface com.luciad.view.ILcdLayer
clearSelection, fireCollectedSelectionChanges, getIcon, getLabel, getModel, isEditable, isEditableSupported, isSelectable, isSelectableSupported, isVisible, selectObject, setEditable, setIcon, setLabel, setSelectable, setVisible
Methods inherited from interface com.luciad.util.ILcdPropertyChangeSource
addPropertyChangeListener, removePropertyChangeListener
Methods inherited from interface com.luciad.util.ILcdSelection
addSelectionListener, getSelectedObjects, getSelectionCount, isSelected, removeSelectionListener, selectedObjects
-
Constructor Details
-
TLcdGXYAsynchronousEditableLabelsLayerWrapper
Creates a layer decorator that delegates painting to an asynchronous paint queue. This behavior is triggered for the first view that paints the layer. After construction, a paint queue must be set usingsetGXYAsynchronousPaintQueue(ILcdGXYAsynchronousPaintQueue)
- Parameters:
aDecoratedLayer
- the layer to decorate. The layer is automatically redrawn if the model changes.
-
TLcdGXYAsynchronousEditableLabelsLayerWrapper
public TLcdGXYAsynchronousEditableLabelsLayerWrapper(ILcdGXYEditableLabelsLayer aDecoratedLayer, ILcdGXYAsynchronousPaintQueue aPaintQueue) Creates a layer decorator that delegates painting to an asynchronous paint queue. This behavior is triggered for the first view that paints the layer. After construction, a paint queue must be set usingsetGXYAsynchronousPaintQueue(ILcdGXYAsynchronousPaintQueue)
- Parameters:
aDecoratedLayer
- the layer to decorate. The layer is automatically redrawn if the model changes.aPaintQueue
- the paint queue to delegate paint calls to
-
-
Method Details
-
getSynchronousGXYLayerChangeTracker
Description copied from interface:ILcdGXYAsynchronousLayerWrapper
Returns a state change synchronizer for this wrapper. The wrapper's changes will be applied to the wrapped layer before each asynchronous paint, using the asynchronous wrapper.- Specified by:
getSynchronousGXYLayerChangeTracker
in interfaceILcdGXYAsynchronousLayerWrapper
- Overrides:
getSynchronousGXYLayerChangeTracker
in classTLcdGXYAsynchronousLayerWrapper
- Returns:
- a synchronizer tracking changes for this wrapper. To protect this wrapper's state, the tracker should only be used in the synchronous thread, i.e. the event dispatch thread.
-
getAsynchronousGXYLayerChangeTracker
Description copied from interface:ILcdGXYAsynchronousLayerWrapper
Returns a state change synchronizer for the wrapped layer. The changes will be applied after each asynchronous paint, using the synchronous tracker.- Specified by:
getAsynchronousGXYLayerChangeTracker
in interfaceILcdGXYAsynchronousLayerWrapper
- Overrides:
getAsynchronousGXYLayerChangeTracker
in classTLcdGXYAsynchronousLayerWrapper
- Returns:
- a synchronizer tracking changes for the wrapped layer. To protect the wrapped layer's state, the tracker should only be used in the asynchronous thread, i.e. the paint thread.
-
setAsynchronous
Description copied from interface:ILcdGXYAsynchronousLayerWrapper
Disables or enables the asynchronous drawing.- Specified by:
setAsynchronous
in interfaceILcdGXYAsynchronousLayerWrapper
- Overrides:
setAsynchronous
in classTLcdGXYAsynchronousLayerWrapper
- Parameters:
aAsynchronous
- if false, paints synchronously, if true, paints asynchronously- Throws:
InterruptedException
- when the thread is interrupted while waiting for the asynchronous paint to complete
-
paint
Description copied from class:TLcdGXYAsynchronousLayerWrapper
Paints the layer asynchronously or synchronously, depending onisAsynchronous
. Asynchronous painting is delegated to the layer's paint queue.- Specified by:
paint
in interfaceILcdGXYEditableLabelsLayer
- Specified by:
paint
in interfaceILcdGXYLayer
- Overrides:
paint
in classTLcdGXYAsynchronousLayerWrapper
- Parameters:
aGraphics
- the Graphics to paint on.aMode
- indicates what should be painted and how it should be painted.aGXYView
- the view to paint for.- See Also:
-
setGXYAsynchronousPaintQueue
Description copied from interface:ILcdGXYAsynchronousLayerWrapper
Sets the paint queue to delegate asynchronous paint requests to. Paint queues can be shared between multiple layer wrappers. This is even advised, as each paint queue uses memory for buffering the asynchronously generated images.- Specified by:
setGXYAsynchronousPaintQueue
in interfaceILcdGXYAsynchronousLayerWrapper
- Overrides:
setGXYAsynchronousPaintQueue
in classTLcdGXYAsynchronousLayerWrapper
- Parameters:
aQueue
- the asynchronous paint queue responsible for executing the paint calls.
-
getGXYLabelingAlgorithm
Returns a clone of the wrapped layer's ILcdGXYLabelingAlgorithm, or the algorithm itself if the associated paint queue is empty.- Specified by:
getGXYLabelingAlgorithm
in interfaceILcdGXYEditableLabelsLayer
- Parameters:
aLabel
- the identifier defining the label and its associated domain object- Returns:
- the label algorithm, or
null
to rely on the label painter - See Also:
-
getGXYLabelEditor
Returns a clone of the wrapped layer's GXYLabelEditor, or the editor itself if the associated paint queue is empty.- Specified by:
getGXYLabelEditor
in interfaceILcdGXYEditableLabelsLayer
- Parameters:
aObject
- The object for which to retrieve the label editor. This object should not benull
and should be contained in the model of this layer.- Returns:
- The editor for
aObject
. This editor should already haveaObject
set on it. TheTLcdLabelLocation
however still needs tobe set
. - See Also:
-
getLabelLocations
Description copied from interface:ILcdGXYEditableLabelsLayer
Returns the
ALcdLabelLocations
instance which contains all the information about the labels of this layer. You can use this instance to retrieve which labelshave been drawn
and where these labelsare located
.This instance can also be used to
alter
the location of the labels. As this method always returns the same instance, changes made to the returnedALcdLabelLocations
instance immediately effect all other clients of this layer.If the location of a label is changed, the layer should be invalidated using the
invalidateGXYLayer
method of theILcdGXYView
.- Specified by:
getLabelLocations
in interfaceILcdGXYEditableLabelsLayer
- Returns:
- The
ALcdLabelLocations
instance. It never isnull
. - See Also:
-
isLabelsEditableSupported
public boolean isLabelsEditableSupported()Description copied from interface:ILcdGXYEditableLabelsLayer
This property determines whether the layer is equipped to let the user edit the labels. More specifically this property determines whether the layer can provide anILcdGXYLabelEditor
for its objects.- Specified by:
isLabelsEditableSupported
in interfaceILcdGXYEditableLabelsLayer
- Returns:
true
if the layer is equipped with label editors,false
otherwise.- See Also:
-
isLabelsEditable
public boolean isLabelsEditable()Description copied from interface:ILcdGXYEditableLabelsLayer
This flag determines if the labels are editable, i.e. if they can be moved by the user. Note that the labels can however still be moved by, for instance, labeling algorithms.- Specified by:
isLabelsEditable
in interfaceILcdGXYEditableLabelsLayer
- Returns:
true
if the labels can be moved and reshaped by the user,false
otherwise.- See Also:
-
setLabelsEditable
public void setLabelsEditable(boolean aLabelsEditable) Description copied from interface:ILcdGXYEditableLabelsLayer
This flag determines if the labels are editable, i.e. if they can be moved by the user. Note that the labels can however still be moved by, for instance, labeling algorithms.- Specified by:
setLabelsEditable
in interfaceILcdGXYEditableLabelsLayer
- Parameters:
aLabelsEditable
-true
if you want the user to be able to move and reshape the labels,false
otherwise.- See Also:
-
applyOnInteract
public int applyOnInteract(ILcdFunction aFunction, Graphics aGraphics, int aPaintMode, ILcdGXYView aGXYView) Description copied from interface:ILcdGXYEditableLabelsLayer
Applies the function to (at the least) all objects that are contained (partially or completely) in the bounds of the view. This method behaves similar to the paint method, and as such is allowed to omit small or invisible objects for performance reasons. For example, it can disregard objects that are outside the scale range.The function shall be applied successively to all objects in the bounds as long as the function returns
true
for an object. This allows developers to indicate a stop condition. Note that the order in which the objects are passed to the function is not specified.The mode indicates what objects of the model should be taken into account. The objects to be taken into account shall be one of:
- ALL: all the objects in the layer's model, or
- SELECTION: all the objects in the layer's selection.
The representations provided shall be a combination of one or more of:
- BODIES: the combination of geometric representations of the objects,
- HANDLES: the handles for the objects,
- LABELS: the combination of the textual representations of the objects.
The mode supplied shall be a bitwise 'or' combination of a constant of the first group and a combination of constants of the second group.
- Specified by:
applyOnInteract
in interfaceILcdGXYEditableLabelsLayer
- Parameters:
aFunction
- the function to apply. When the function returnsfalse
, no more objects should be passed to the function.aGraphics
- the graphicsaPaintMode
- the paint mode.aGXYView
- the view in whose bounds the objects representations should be in order to be passed to the function. Note that for efficiency reasons (e.g. to avoid expensive bounds calculations) objects may be passed that are not inside the view bounds.- Returns:
- the number of objects the function was applied on.
-
applyOnInteractLabels
public int applyOnInteractLabels(ILcdFunction aLabelFunction, Graphics aGraphics, int aPaintMode, ILcdGXYView aGXYView) Description copied from interface:ILcdGXYEditableLabelsLayer
Applies the function to (at the least) all labels that are contained (partially or completely) in the bounds of the view. This method behaves similar to the paint method, and as such is allowed to omit labels for small or invisible objects for performance reasons. For example, it can disregard labels for objects outside the scale range, or labels outside the label scale range.The function shall be applied successively to all labels in the bounds as long as the function returns
true
for a label. This allows developers to indicate a stop condition. Note that the order in which the labels are passed to the function is not specified.The mode indicates what labels should be taken into account. The labels to be taken into account shall be one of:
- ALL: all the labels in the layer's model, or
- SELECTION: all the labels in the layer's selection.
The representations provided shall be a combination of one or more of:
- BODIES: the combination of label representations of the objects,
- HANDLES: the handles for the labeled objects,
- LABELS: the combination of the textual labels representations of the objects.
The mode supplied shall be a bitwise 'or' combination of a constant of the first group and a combination of constants of the second group.
- Specified by:
applyOnInteractLabels
in interfaceILcdGXYEditableLabelsLayer
- Parameters:
aLabelFunction
- the function to apply. When the function returnsfalse
, no more labels should be passed to the function. The Object passed to this function is always aTLcdLabelIdentifier
.aGraphics
- the graphicsaPaintMode
- the paint mode.aGXYView
- the view in whose bounds the objects representations should be in order passed to the function. Note that for efficiency reasons (e.g. to avoid expensive bounds calculations) objects may be passed that are not inside the view bounds.- Returns:
- the number of objects the function was applied on.
-