public class TLcdGXYAsynchronousEditableLabelsLayerWrapper extends TLcdGXYAsynchronousLayerWrapper implements ILcdGXYEditableLabelsLayer
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
.
PLACED_LABELS
Constructor and Description |
---|
TLcdGXYAsynchronousEditableLabelsLayerWrapper(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.
|
Modifier and Type | Method and Description |
---|---|
int |
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.
|
ILcdGXYLayerChangeTracker |
getAsynchronousGXYLayerChangeTracker()
Returns a state change synchronizer for the wrapped layer.
|
ILcdGXYLabelEditor |
getGXYLabelEditor(Object aObject)
Returns a clone of the wrapped layer's GXYLabelEditor, or the editor itself if the associated
paint queue is empty.
|
ILcdGXYLabelingAlgorithm |
getGXYLabelingAlgorithm(TLcdLabelIdentifier aLabel)
Returns a clone of the wrapped layer's ILcdGXYLabelingAlgorithm, or the algorithm itself if the associated
paint queue is empty.
|
ALcdLabelLocations |
getLabelLocations()
Returns the
ALcdLabelLocations instance which contains all the information
about the labels of this layer. |
ILcdGXYLayerChangeTracker |
getSynchronousGXYLayerChangeTracker()
Returns a state change synchronizer for this wrapper.
|
boolean |
isLabelsEditable()
This flag determines if the labels are editable, i.e. if they can be moved by the user.
|
boolean |
isLabelsEditableSupported()
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 on
isAsynchronous . |
void |
setAsynchronous(boolean aAsynchronous)
Disables or enables the asynchronous drawing.
|
void |
setGXYAsynchronousPaintQueue(ILcdGXYAsynchronousPaintQueue aQueue)
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.
|
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applyOnInteract, getBounds, getGXYEditor, getGXYLabelPainter, getGXYPainter, getGXYPen, getLabelMapScaleRange, getLabelScaleRange, getMapScaleRange, getModelXYWorldTransfoClass, getScaleRange, isLabeled, isLabeledSupported, setLabeled, stopPainting
clearSelection, fireCollectedSelectionChanges, getIcon, getLabel, getModel, isEditable, isEditableSupported, isSelectable, isSelectableSupported, isVisible, selectObject, setEditable, setIcon, setLabel, setSelectable, setVisible
addSelectionListener, getSelectedObjects, getSelectionCount, isSelected, removeSelectionListener, selectedObjects
addPropertyChangeListener, removePropertyChangeListener
create
public TLcdGXYAsynchronousEditableLabelsLayerWrapper(ILcdGXYEditableLabelsLayer aDecoratedLayer)
setGXYAsynchronousPaintQueue(ILcdGXYAsynchronousPaintQueue)
aDecoratedLayer
- the layer to decorate. The layer is automatically redrawn if the
model changes.public TLcdGXYAsynchronousEditableLabelsLayerWrapper(ILcdGXYEditableLabelsLayer aDecoratedLayer, ILcdGXYAsynchronousPaintQueue aPaintQueue)
setGXYAsynchronousPaintQueue(ILcdGXYAsynchronousPaintQueue)
aDecoratedLayer
- the layer to decorate. The layer is automatically redrawn if the
model changes.aPaintQueue
- the paint queue to delegate paint calls topublic ILcdGXYLayerChangeTracker getSynchronousGXYLayerChangeTracker()
ILcdGXYAsynchronousLayerWrapper
getSynchronousGXYLayerChangeTracker
in interface ILcdGXYAsynchronousLayerWrapper
getSynchronousGXYLayerChangeTracker
in class TLcdGXYAsynchronousLayerWrapper
public ILcdGXYLayerChangeTracker getAsynchronousGXYLayerChangeTracker()
ILcdGXYAsynchronousLayerWrapper
getAsynchronousGXYLayerChangeTracker
in interface ILcdGXYAsynchronousLayerWrapper
getAsynchronousGXYLayerChangeTracker
in class TLcdGXYAsynchronousLayerWrapper
public void setAsynchronous(boolean aAsynchronous) throws InterruptedException
ILcdGXYAsynchronousLayerWrapper
setAsynchronous
in interface ILcdGXYAsynchronousLayerWrapper
setAsynchronous
in class TLcdGXYAsynchronousLayerWrapper
aAsynchronous
- if false, paints synchronously, if true, paints asynchronouslyInterruptedException
- when the thread is interrupted while waiting for the asynchronous paint to completepublic void paint(Graphics aGraphics, int aMode, ILcdGXYView aGXYView)
TLcdGXYAsynchronousLayerWrapper
isAsynchronous
.
Asynchronous painting is delegated to the layer's paint queue.paint
in interface ILcdGXYEditableLabelsLayer
paint
in interface ILcdGXYLayer
paint
in class TLcdGXYAsynchronousLayerWrapper
aGraphics
- the Graphics to paint on.aMode
- indicates what should be painted and how it should be painted.aGXYView
- the view to paint for.ILcdGXYLayer.getGXYPainter(Object)
,
ILcdGXYLayer.getGXYLabelPainter(Object)
,
ILcdGXYLayer.getScaleRange()
,
ILcdGXYLayer.getLabelScaleRange()
,
ILcdGXYLayer.stopPainting()
public void setGXYAsynchronousPaintQueue(ILcdGXYAsynchronousPaintQueue aQueue)
ILcdGXYAsynchronousLayerWrapper
setGXYAsynchronousPaintQueue
in interface ILcdGXYAsynchronousLayerWrapper
setGXYAsynchronousPaintQueue
in class TLcdGXYAsynchronousLayerWrapper
aQueue
- the asynchronous paint queue responsible for executing the paint calls.public ILcdGXYLabelingAlgorithm getGXYLabelingAlgorithm(TLcdLabelIdentifier aLabel)
getGXYLabelingAlgorithm
in interface ILcdGXYEditableLabelsLayer
aLabel
- the identifier defining the label and its associated domain objectnull
to rely on the label painterILcdGXYEditableLabelsLayer.getGXYLabelingAlgorithm(com.luciad.view.TLcdLabelIdentifier)
public ILcdGXYLabelEditor getGXYLabelEditor(Object aObject)
getGXYLabelEditor
in interface ILcdGXYEditableLabelsLayer
aObject
- The object for which to retrieve the label editor. This object should not be
null
and should be contained in the model of this layer.aObject
. This editor should already have
aObject
set on it. The TLcdLabelLocation
however still needs
to be
set
.ILcdGXYEditableLabelsLayer.getGXYLabelEditor(Object)
public ALcdLabelLocations getLabelLocations()
ILcdGXYEditableLabelsLayer
Returns the ALcdLabelLocations
instance which contains all the information
about the labels of this layer. You can use this instance to retrieve which labels have been drawn
and where these labels are 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
returned ALcdLabelLocations
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
the ILcdGXYView
.
getLabelLocations
in interface ILcdGXYEditableLabelsLayer
ALcdLabelLocations
instance. It never is null
.ILcdGXYEditableLabelsLayer.getLabelLocations()
public boolean isLabelsEditableSupported()
ILcdGXYEditableLabelsLayer
ILcdGXYLabelEditor
for its objects.isLabelsEditableSupported
in interface ILcdGXYEditableLabelsLayer
true
if the layer is equipped with label editors, false
otherwise.ILcdGXYEditableLabelsLayer.isLabelsEditableSupported()
public boolean isLabelsEditable()
ILcdGXYEditableLabelsLayer
isLabelsEditable
in interface ILcdGXYEditableLabelsLayer
true
if the labels can be moved and reshaped by the user,
false
otherwise.ILcdGXYEditableLabelsLayer.isLabelsEditable()
public void setLabelsEditable(boolean aLabelsEditable)
ILcdGXYEditableLabelsLayer
setLabelsEditable
in interface ILcdGXYEditableLabelsLayer
aLabelsEditable
- true
if you want the user to be able to move and reshape
the labels, false
otherwise.ILcdGXYEditableLabelsLayer.getGXYLabelEditor(Object)
public int applyOnInteract(ILcdFunction aFunction, Graphics aGraphics, int aPaintMode, ILcdGXYView aGXYView)
ILcdGXYEditableLabelsLayer
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:
The representations provided shall be a combination of one or more of:
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.
applyOnInteract
in interface ILcdGXYEditableLabelsLayer
aFunction
- the function to apply. When the function returns false
, 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.public int applyOnInteractLabels(ILcdFunction aLabelFunction, Graphics aGraphics, int aPaintMode, ILcdGXYView aGXYView)
ILcdGXYEditableLabelsLayer
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:
The representations provided shall be a combination of one or more of:
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.
applyOnInteractLabels
in interface ILcdGXYEditableLabelsLayer
aLabelFunction
- the function to apply. When the function returns false
, no
more labels should be passed to the function. The Object passed to this
function is always a TLcdLabelIdentifier
.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.