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
ConstructorsConstructorDescriptionTLcdGXYAsynchronousEditableLabelsLayerWrapper(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 TypeMethodDescriptionintapplyOnInteract(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.intapplyOnInteractLabels(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 theALcdLabelLocationsinstance which contains all the information about the labels of this layer.Returns a state change synchronizer for this wrapper.booleanThis flag determines if the labels are editable, i.e. if they can be moved by the user.booleanThis property determines whether the layer is equipped to let the user edit the labels.voidpaint(Graphics aGraphics, int aMode, ILcdGXYView aGXYView) Paints the layer asynchronously or synchronously, depending onisAsynchronous.voidsetAsynchronous(boolean aAsynchronous) Disables or enables the asynchronous drawing.voidSets the paint queue to delegate asynchronous paint requests to.voidsetLabelsEditable(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, stopPaintingMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.view.gxy.ILcdGXYLayer
applyOnInteract, getBounds, getGXYEditor, getGXYLabelPainter, getGXYPainter, getGXYPen, getLabelMapScaleRange, getLabelScaleRange, getMapScaleRange, getModelXYWorldTransfoClass, getScaleRange, isLabeled, isLabeledSupported, setLabeled, stopPaintingMethods inherited from interface com.luciad.view.ILcdLayer
clearSelection, fireCollectedSelectionChanges, getIcon, getLabel, getModel, isEditable, isEditableSupported, isSelectable, isSelectableSupported, isVisible, selectObject, setEditable, setIcon, setLabel, setSelectable, setVisibleMethods inherited from interface com.luciad.util.ILcdPropertyChangeSource
addPropertyChangeListener, removePropertyChangeListenerMethods 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:ILcdGXYAsynchronousLayerWrapperReturns 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:
getSynchronousGXYLayerChangeTrackerin interfaceILcdGXYAsynchronousLayerWrapper- Overrides:
getSynchronousGXYLayerChangeTrackerin 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:ILcdGXYAsynchronousLayerWrapperReturns a state change synchronizer for the wrapped layer. The changes will be applied after each asynchronous paint, using the synchronous tracker.- Specified by:
getAsynchronousGXYLayerChangeTrackerin interfaceILcdGXYAsynchronousLayerWrapper- Overrides:
getAsynchronousGXYLayerChangeTrackerin 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:ILcdGXYAsynchronousLayerWrapperDisables or enables the asynchronous drawing.- Specified by:
setAsynchronousin interfaceILcdGXYAsynchronousLayerWrapper- Overrides:
setAsynchronousin 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:TLcdGXYAsynchronousLayerWrapperPaints the layer asynchronously or synchronously, depending onisAsynchronous. Asynchronous painting is delegated to the layer's paint queue.- Specified by:
paintin interfaceILcdGXYEditableLabelsLayer- Specified by:
paintin interfaceILcdGXYLayer- Overrides:
paintin 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:ILcdGXYAsynchronousLayerWrapperSets 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:
setGXYAsynchronousPaintQueuein interfaceILcdGXYAsynchronousLayerWrapper- Overrides:
setGXYAsynchronousPaintQueuein 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:
getGXYLabelingAlgorithmin interfaceILcdGXYEditableLabelsLayer- Parameters:
aLabel- the identifier defining the label and its associated domain object- Returns:
- the label algorithm, or
nullto 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:
getGXYLabelEditorin interfaceILcdGXYEditableLabelsLayer- Parameters:
aObject- The object for which to retrieve the label editor. This object should not benulland should be contained in the model of this layer.- Returns:
- The editor for
aObject. This editor should already haveaObjectset on it. TheTLcdLabelLocationhowever still needs tobe set. - See Also:
-
getLabelLocations
Description copied from interface:ILcdGXYEditableLabelsLayerReturns the
ALcdLabelLocationsinstance which contains all the information about the labels of this layer. You can use this instance to retrieve which labelshave been drawnand where these labelsare located.This instance can also be used to
alterthe location of the labels. As this method always returns the same instance, changes made to the returnedALcdLabelLocationsinstance immediately effect all other clients of this layer.If the location of a label is changed, the layer should be invalidated using the
invalidateGXYLayermethod of theILcdGXYView.- Specified by:
getLabelLocationsin interfaceILcdGXYEditableLabelsLayer- Returns:
- The
ALcdLabelLocationsinstance. It never isnull. - See Also:
-
isLabelsEditableSupported
public boolean isLabelsEditableSupported()Description copied from interface:ILcdGXYEditableLabelsLayerThis property determines whether the layer is equipped to let the user edit the labels. More specifically this property determines whether the layer can provide anILcdGXYLabelEditorfor its objects.- Specified by:
isLabelsEditableSupportedin interfaceILcdGXYEditableLabelsLayer- Returns:
trueif the layer is equipped with label editors,falseotherwise.- See Also:
-
isLabelsEditable
public boolean isLabelsEditable()Description copied from interface:ILcdGXYEditableLabelsLayerThis 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:
isLabelsEditablein interfaceILcdGXYEditableLabelsLayer- Returns:
trueif the labels can be moved and reshaped by the user,falseotherwise.- See Also:
-
setLabelsEditable
public void setLabelsEditable(boolean aLabelsEditable) Description copied from interface:ILcdGXYEditableLabelsLayerThis 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:
setLabelsEditablein interfaceILcdGXYEditableLabelsLayer- Parameters:
aLabelsEditable-trueif you want the user to be able to move and reshape the labels,falseotherwise.- See Also:
-
applyOnInteract
public int applyOnInteract(ILcdFunction aFunction, Graphics aGraphics, int aPaintMode, ILcdGXYView aGXYView) Description copied from interface:ILcdGXYEditableLabelsLayerApplies 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
truefor 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:
applyOnInteractin 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:ILcdGXYEditableLabelsLayerApplies 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
truefor 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:
applyOnInteractLabelsin 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.
-