Interface ILcdGXYLayer
- All Superinterfaces:
ILcdLayer
,ILcdPropertyChangeSource
,ILcdSelection<Object>
,Serializable
- All Known Subinterfaces:
ILcdGXYAsynchronousLayerWrapper
,ILcdGXYEditableLabelsLayer
,ILcdGXYLayerList
- All Known Implementing Classes:
TLcdGXYAsynchronousEditableLabelsLayerTreeNodeWrapper
,TLcdGXYAsynchronousEditableLabelsLayerWrapper
,TLcdGXYAsynchronousLayerTreeNodeWrapper
,TLcdGXYAsynchronousLayerWrapper
,TLcdGXYDensityLayer
,TLcdGXYLayer
,TLcdGXYLayerList
,TLcdGXYLayerTreeNode
,TLcdGXYLspAsynchronousLayerTreeNodeWrapper
,TLcdGXYLspAsynchronousLayerWrapper
,TLcdKML22GXYLayer
,TLcdMapGeorefGridLayer
,TLcdMapLonLatGridLayer
,TLcdMGRSGridLayer
,TLcdMultilevelGridLayer
,TLcdPOLLayer
,TLcdS52GXYCatalogueLayer
,TLcdS52GXYCatalogueLayerList
,TLcdS52GXYLayer
,TLcdS52GXYLevelLayerList
,TLcdUPSGridLayer
,TLcdUTMGridLayer
,TLcdVPFLayer
,TLcdWMSProxyGXYLayer
,TLcdXYGridLayer
,TLcyAreaOfInterestLayer
,TLcyDynamicLonLatGridLayer
,TLcyPIMGXYLayer
,TLcySnappableGXYLayer
,com.luciad.internal.lucy.map.TLcyStyledSnappableGXYLayer
,TLfnGXYVectorLayer
ILcdGXYView
of all objects in an ILcdModel
.
Representing means how it is visualized, but also how it behaves during graphical editing, or how its labels should
appear. Layers are often instantiated using a factory.
Creating domain object representations
In order to provide a representation for an object, the layer needs to know how basic rendering primitives are performed, using apen
, and how the object is transformed to its world
representation, using a model to world transformation class
.
Next, a layer distinguishes between two representations for an object:
a geometry
and a (typically textual) label
representation.
Rendering the geometry is handled by a painter
per object,
whereas rendering the label is handled by a label painter
per object.
If no painter nor label painter is available for an object, it won't get a representation.
Layers that support selection also have an appropriate
selection representation modifier
.
Finally, editable layers can display handles to interact with the domain objects.
Determining what objects to paint
A layer will often not display all objects, as it is possible that the representations of some
objects lie outside the bounds of the view.
In addition, the layer can decide not to display geometry and/or labels at a certain zoom level
(see scaleRange
) or as text (labelScaleRange
).
Implementations are free to add other means to restrict and/or filter (e.g. interactively determined
by the user) the visible objects.
Interacting with painted objects
Since interaction via the view is only possible with objects which are visible in the view, the method
applyOnInteract
enables applying an arbitrary function to objects based on whether their representation is inside a given
bounds or not. This method enables the reduction of the number of objects to which a function should be applied, as
it is not applied to any objects whose representation would fall outside the bounds.
Note that the ILcdGXYEditableLabelsLayer
interface defines additional methods that closer
correspond to the paint method by taking into account painting criteria such as the scale range
and layer visibility .
To quickly check whether any interaction is possible with a layer, the layer provides its
bounds
in a view, which contain the representations in that
view of all objects on the layer.
Outside the layer's bounds, no interaction with any of the layer's objects is possible.
For every object in the layer's model, an ILcdGXYEditor
can be provided to handle interactions with
the object (modifying the geometry of an object, for example). The handles of the geometry indicate where such
interactions can take place.
Note: This interface has been extended in the ILcdGXYEditableLabelsLayer
interface. If you implement your own layer, it is advised to
implement that interface in addition to this one.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Paint mode to indicate that all objects in the model should be taken into account.static final int
Paint mode to indicate that the body of the geometry of the objects should be painted.static final int
Paint mode to indicate that the handles of the geometry of the objects should be painted.static final int
Paint mode to indicate that the objects should be painted as text.static final int
Paint mode to indicate that only objects in the selection should be taken into account. -
Method Summary
Modifier and TypeMethodDescriptionint
applyOnInteract
(ILcdFunction aFunction, Rectangle aBounds, boolean aStrictInteract, ILcdGXYView aGXYView) Applies the function to (at the least) all objects that are contained (partially or completely) in the bounds of the view.getBounds
(int aMode, ILcdGXYView aGXYView) Returns the view bounds of thisILcdGXYLayer
content, the bounds of all the drawings (for the supplied mode) that represent the Objects contained in theILcdModel
of thisILcdGXYLayer
.getGXYEditor
(Object aObject) Returns the editor to use to modify the object via a view.getGXYLabelPainter
(Object aObject) Returns the label painter to use to paint the objects label in a view.getGXYPainter
(Object aObject) Returns the painter to use to render the object in a view.Returns the pen to use when performing basic painting operations for objects in this layers model.default TLcdDimensionInterval
<TLcdMapScale> Returns the map ratio scale range for which to display labels for elements of the model.Returns the toolkit scale range for which to display labels for elements of the model.default TLcdDimensionInterval
<TLcdMapScale> Returns the map ratio scale range for which to display elements of the model.Returns the transformation class that to use to transform points and bounds from model space to world space and back.Returns the toolkit scale range for which to display elements of the model.boolean
Returns whether objects should be represented as text.boolean
Returns whether this layer supports representing objects as text.void
paint
(Graphics aGraphics, int aMode, ILcdGXYView aGXYView) Paints the combined representation of the layer's objects for a view, taking into account the mode.void
setLabeled
(boolean aLabeled) Sets whether objects should be represented as text.void
Inform the layer that it should terminate the current paint operation.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
-
Field Details
-
ALL
static final int ALLPaint mode to indicate that all objects in the model should be taken into account.- See Also:
-
SELECTION
static final int SELECTIONPaint mode to indicate that only objects in the selection should be taken into account.- See Also:
-
BODIES
static final int BODIESPaint mode to indicate that the body of the geometry of the objects should be painted.- See Also:
-
HANDLES
static final int HANDLESPaint mode to indicate that the handles of the geometry of the objects should be painted.- See Also:
-
LABELS
static final int LABELSPaint mode to indicate that the objects should be painted as text.- See Also:
-
-
Method Details
-
paint
Paints the combined representation of the layer's objects for a view, taking into account the mode.The mode indicates what objects of the model should be taken into account and what representation should be provided. 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.
Note that the combined representation may contain less than the representation of all objects that were taken into account, as some objects may be disregarded for various reasons (filters, scale, ... ). When the views scale is outside the scale range (BODIES or HANDLES mode) or the label scale range (LABELS mode) nothing shall be painted.
The representations provided shall be one or more of:
- BODIES: the combination of geometric representations of the objects,
- HANDLES: the handles for the objects. These are the parts of the objects representation on which user interaction can be applied. For example, for a circle this can be the center point, allowing to move the circle.
- 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 one or more of the second group. When painting in BODIES or HANDLES mode, painting of an object shall be delegated to the
painter
for that object, when the LABELS mode is passed, painting shall be delegated to thelabelpainter
for that object.The view is passed to provide contextual information: some of the objects may have a different representation depending on the view, or depending on a property of the view, for example, the scale of the view.
The combined representation of the objects has to be painted on the Graphics supplied, as these may be different from the Graphics provided by the view (due to double buffering, for example).
When
stopPainting
is called, the current painting operation should be aborted.- 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:
-
applyOnInteract
int applyOnInteract(ILcdFunction aFunction, Rectangle aBounds, boolean aStrictInteract, ILcdGXYView aGXYView) Applies the function to (at the least) all objects that are contained (partially or completely) in the bounds of the view.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.When strict interaction is required, only objects whose representation lies within the given bounds, completely or partially, are candidates to be passed to the function. An object whose representation does not interact with the bounds should not be passed to the function. Applying non strict interaction can be useful to avoid heavy computations to determine whether an objects representation lies within the bounds.
This method behaves similar to the paint method, and as such is allowed to omit small or invisible objects for performance reasons.
- Parameters:
aFunction
- the function to apply. When the function returns false, no more objects should be passed to the function.aBounds
- all objects who lie partially or completely in this area in the view are candidates to be passed to the function.aStrictInteract
- iftrue
, theILcdFunction
shall be applied only to the objects interacting with the given bounds. When false is passed, other objects may be taken into account too. When applying the function to an object consumes less time than checking whether an objects representation interacts with the bounds, non-strict interaction is generally faster.aGXYView
- the view in whose bounds the objects representations should be in order to be passed to the function.- Returns:
- the number of objects the function was applied on.
-
getBounds
Returns the view bounds of thisILcdGXYLayer
content, the bounds of all the drawings (for the supplied mode) that represent the Objects contained in theILcdModel
of thisILcdGXYLayer
. For this operation, thisILcdGXYLayer
is to be considered as part ofaGXYView
.Outside of the layers bounds no interaction with any object of the layer via its representation is possible. Note that these bounds do not necessarily encompass the representation of all objects in the model, only the objects for which there is a representation in the view.
- Parameters:
aMode
- a bitwise combination of ALL or SELECTION and one or more of BODIES and HANDLES. TheILcdGXYLayer.LABELS
mode is not supported.aGXYView
- the view in which the layer could be placed. This enables taking into account the views settings, for example the scale.- Returns:
- a bounds (in view coordinates, pixels) that encompasses the representation of all objects that are rendered in a view.
- Throws:
TLcdNoBoundsException
- if the layer doesn't have any valid bounds, for example when none of the elements have a representation for the views current settings.IllegalArgumentException
- if the mode containsILcdGXYLayer.LABELS
-
stopPainting
void stopPainting()Inform the layer that it should terminate the current paint operation. This method can be useful when the paint method is executed in a specificThread
and needs to be stopped in a safe state from another Thread.- See Also:
-
getScaleRange
ILcdInterval getScaleRange()Returns the toolkit scale range for which to display elements of the model. In other words, the paint method will not render any objects in a view when:
view.getScale()
<getScaleRange().getMin()
orview.getScale()
>=getScaleRange().getMax()
. This does not imply that all objects in the model should be painted when the scale is inside this range as other restrictions may apply. For example, a layer may have a filter which defines which objects should be painted. For most use cases, we recommended using theunitless map scale range
instead. This property is mutually exclusive with the map scale range: only one of them has a non-null
value.- Returns:
- an
ILcdInterval
containing the minimum and maximum value of view scales for which objects should be rendered, excluding the maximum.null
if the scale constraints are determined bygetMapScaleRange()
. The scales are expressed in toolkit pixels/world unit. - See Also:
-
getMapScaleRange
Returns the map ratio scale range for which to display elements of the model.The paint method won't render objects in a view if the view's map scale is outside the scale range.
This does not imply that all objects in the model should be painted when the scale is inside this range as other restrictions may apply. For example, a layer may have a filter which defines which objects should be painted.
This property is mutually exclusive with thetoolkit scale range
: only one of them has a non-null
value.- Returns:
- the minimum and maximum value of view scales for which objects should be rendered,
or
null
if the scale constraints are determined bygetScaleRange()
- Since:
- 2021.0
-
getLabelScaleRange
ILcdInterval getLabelScaleRange()Returns the toolkit scale range for which to display labels for elements of the model. In other words, the paint method will not render any labels for objects in a view when:
view.getScale()
<getLabelScaleRange().getMin()
orview.getScale()
>=getLabelScaleRange().getMax()
. This does not imply that labels for all objects in the model should be painted when the scale is inside this range as other restrictions may apply. For example, a layer may decide not to paint any labels for objects whose body is not painted. For most use cases, we recommended using theunitless map scale range
instead. This property is mutually exclusive with the label map scale range: only one of them has a non-null
value.- Returns:
- an
ILcdInterval
containing the minimum and maximum value of view scales for which labels should be rendered, excluding the maximum.null
if the scale constraints are determined bygetLabelMapScaleRange()
The scales are expressed in toolkit pixels/world unit. - See Also:
-
getLabelMapScaleRange
Returns the map ratio scale range for which to display labels for elements of the model. The paint method will render labels for objects in a view if the view's map scale is both inside themap scale range
and inside the given map label scale range. This does not imply that labels for all objects in the model should be painted when the scale is inside this range as other restrictions may apply. For example, a layer may decide not to paint any labels for objects whose body is not painted. This property is mutually exclusive with thetoolkit label scale range
: only one of them has a non-null
value.- Returns:
- the minimum and maximum value of map scales for which object labels should be rendered,
or
null
if the scale constraints are determined bygetScaleRange()
- Since:
- 2021.0
-
getGXYPainter
Returns the painter to use to render the object in a view. If no painter is available, the object has no representation. When a painter is available, the object shall be assigned to the painter before using the painter, seesetObject
in ILcdGXYPainter.- Parameters:
aObject
- the object to find a painter for.- Returns:
- the painter to use to render the object in a view. When null is returned, the object has no representation in the view, as part of this layer.
-
getGXYEditor
Returns the editor to use to modify the object via a view. If no editor is available, the object cannot be edited via interaction through a view. When an editor is available, the object shall be assigned to the editor before editing, usingsetObject
in ILcdGXYEditor.- Parameters:
aObject
- the object to find an editor for.- Returns:
- the editor to use to modify the object via a view. When null is returned, the object cannot be edited via the view.
-
getGXYLabelPainter
Returns the label painter to use to paint the objects label in a view. If no label painter is available, the object does not have a label. When a label painter is available, the object shall be assigned to the label painter before using the label painter, seesetObject
in ILcdGXYLabelPainter.- Parameters:
aObject
- the object to find a label painter for.- Returns:
- the label painter to use to render the objects label in a view. When null is returned, the object does not have a label in the view, as part of this layer.
-
getGXYPen
ILcdGXYPen getGXYPen()Returns the pen to use when performing basic painting operations for objects in this layers model.- Returns:
- the pen to use when performing basic painting operations for objects in this layers model.
-
getModelXYWorldTransfoClass
Class getModelXYWorldTransfoClass()Returns the transformation class that to use to transform points and bounds from model space to world space and back. This class has to be conform with the reference of the model of this layer and the reference of the view this layer is part of.- Returns:
- the transformation class that to use to transform points and bounds from model space to world space and back.
-
isLabeledSupported
boolean isLabeledSupported()Returns whether this layer supports representing objects as text. If not, no effort should be made trying to represent the objects with labels.- Returns:
- whether this layer supports representing objects as text.
-
isLabeled
boolean isLabeled()Returns whether objects should be represented as text. Note that this property shall not be taken into account whenisLabeledSupported()
returns false.- Returns:
- whether objects should be represented as text.
- See Also:
-
setLabeled
void setLabeled(boolean aLabeled) Sets whether objects should be represented as text. The value set for this property shall have no effect as long asisLabeledSupported()
returns false.- Parameters:
aLabeled
- true to have a textual representation of the objects in the model, false to have no such representation.
-