Class TLcdS52GXYLayer
- All Implemented Interfaces:
ILcdPropertyChangeSource
,ILcdSelection<Object>
,ILcdGXYEditableLabelsLayer
,ILcdGXYLayer
,ILcdLayer
,Serializable
A layer that adds support for the specific rendering requirements of S-52. Use this layer for
the
visualization of individual ENC cells. For catalogues, use TLcdS52GXYCatalogueLayer
.
In particular, this layer ensures that for edges which are part of multiple objects, each edge is only painted once, using the line style of the object with the highest display priority.
This layer only works with a TLcdS52GXYPainterProvider
painter provider.
Note: in versions prior to V2013.1, the layer could only handle the
ordered models (see TLcdS52ProductConfiguration#createOrderedModelDecoder
and the ECDIS developer guide). As of V2013.1, it is no longer needed to order the models
before passing them to the layer. The layer can now handle both ordered as well as non-ordered
models. The
TLcdLayer.getModel()
method will always return the model which was set on the layer.
- See Also:
-
Field Summary
Fields inherited from interface com.luciad.view.gxy.ILcdGXYEditableLabelsLayer
PLACED_LABELS
-
Constructor Summary
ConstructorDescriptionTLcdS52GXYLayer
(ILcdModel aS57Model) Creates a new layer which will be initialized with the given S-57 model.TLcdS52GXYLayer
(ILcdModel aModel, TLcdS52DisplaySettings aDisplaySettings) Creates a new layer which will be initialized with the given S-57 model and display settings. -
Method Summary
Modifier and TypeMethodDescriptionprotected int
applyOnInteract
(ILcdFunction aFunction, Graphics aGraphics, int aPaintMode, ILcdModel aModel, ILcdGXYView aGXYView) Applies the function to (at the least) all objects from the given model that are contained (partially or completely) in the bounds of the view.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.Returns the S-52 display settings of this layer.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.protected void
paintFromOverlaps
(Graphics aGraphics, int aMode, ILcd2DBoundsIndexedModel a2DBoundsIndexedModel, ILcdGXYContext aGXYContext) Paints the objects in the passed model by applying a painting function to allObject
of theILcd2DBoundsIndexedModel
that interact with the view clip.void
setFilter
(ILcdFilter aFilter) Sets theILcdFilter
to filter theObject
on thisILcdLayer
.void
setGXYPainterProvider
(ILcdGXYPainterProvider aGXYPainterProvider) Sets anILcdGXYPainterProvider
to thisTLcdGXYLayer
.Methods inherited from class com.luciad.view.gxy.TLcdGXYLayer
applyOnInteract, applyOnInteractLabels, asFactory, create, getBounds, getGXYEditor, getGXYEditorProvider, getGXYLabelEditor, getGXYLabelEditorProvider, getGXYLabelingAlgorithm, getGXYLabelingAlgorithmProvider, getGXYLabelPainter, getGXYLabelPainterProvider, getGXYLayerLabelPainter, getGXYPainter, getGXYPainterProvider, getGXYPainterProviderArray, getGXYPainters, getGXYPen, getIcon, getInteractMargin, getLabelLocations, getLabelMapScaleRange, getLabelScaleRange, getMapScaleRange, getMinimumObjectSizeForPainting, getModelElementComparator, getModelQueryConfiguration, getModelXYWorldTransfoClass, getPaintLabelsScaleRatioInterval, getScaleRange, isEditableSupported, isLabeled, isLabeledSupported, isLabelsEditable, isLabelsEditableSupported, isPaintFromOverlaps, isSelectionLabeled, isStopPainting, isTraceOn, modeToString, paintFromModel, setClassTraceOn, setGXYEditorProvider, setGXYLabelEditorProvider, setGXYLabelingAlgorithmProvider, setGXYLabelPainterProvider, setGXYLayerLabelPainter, setGXYPainterProviderArray, setGXYPen, setIcon, setInteractMargin, setLabeled, setLabelLocations, setLabelMapScaleRange, setLabelScaleRange, setLabelsEditable, setMapScaleRange, setMinimumObjectSizeForPainting, setModel, setModelElementComparator, setModelQueryConfiguration, setModelXYWorldTransfoClass, setPaintFromOverlaps, setPaintLabelsScaleRatioInterval, setScaleRange, setSelectionLabeled, setTraceOn, setVisible, startPainting, stopPainting
Methods inherited from class com.luciad.view.TLcdLayer
addPropertyChangeListener, addSelectionListener, clearSelection, fireCollectedSelectionChanges, firePropertyChangeEvent, getFilter, getLabel, getModel, getSelectionCount, invalidate, isEditable, isSelectable, isSelectableSupported, isSelected, isVisible, removePropertyChangeListener, removeSelectionListener, selectedObjects, selectObject, selectObjects, setEditable, setLabel, setSelectable, setSelectableSupported, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.luciad.view.ILcdLayer
clearSelection, fireCollectedSelectionChanges, getLabel, getModel, isEditable, isSelectable, isSelectableSupported, isVisible, selectObject, setEditable, setLabel, setSelectable
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
-
TLcdS52GXYLayer
Creates a new layer which will be initialized with the given S-57 model.- Parameters:
aS57Model
- the model list to set on this layer.
-
TLcdS52GXYLayer
Creates a new layer which will be initialized with the given S-57 model and display settings.- Parameters:
aModel
- the model list to set on this layer.aDisplaySettings
- the S-52 display settings to be used for this layer.
-
-
Method Details
-
setFilter
Description copied from class:TLcdGXYLayer
Sets the
ILcdFilter
to filter theObject
on thisILcdLayer
. Operations on this layer will only be applied to objects of the model that pass the filter. This includes painting, labeling, selection, editing, ...If the filter implements
ILcdChangeSource
, the layer will listen to changes in the filter to keep, for example, the selection up to date.Setting a
null
filter, lets all objects pass for rendering. By default the filter isnull
.The filtering performed by this filter is done inside the JVM, after the data has been queried from the model and been passed to the layer. Use the
TLcdGXYLayer.setModelQueryConfiguration(TLcdModelQueryConfiguration)
if you have filters which should be evaluated on the model side. For example when using a database model, this would allow the database to do the filtering.- Overrides:
setFilter
in classTLcdGXYLayer
- Parameters:
aFilter
- the filter that accepts only those objects that should be taken into account.- See Also:
-
getDisplaySettings
Returns the S-52 display settings of this layer.- Returns:
- the S-52 display settings of this layer.
-
setGXYPainterProvider
Sets anILcdGXYPainterProvider
to thisTLcdGXYLayer
. During painting, the provider will be queried to return a painter for the relevant domain objects. If no painter provider is set to this layer, nothing will be rendered. This call overwrites the painter provider array with a new one containing the given provider. Note that no property change listeners can be added to the painter provider, so the layer is not automatically notified when a property on the painter provider has changed. To notify the layer and its listeners, a property change event has to be fired, using the methodTLcdLayer.firePropertyChangeEvent(java.beans.PropertyChangeEvent)
.- Overrides:
setGXYPainterProvider
in classTLcdGXYLayer
- Parameters:
aGXYPainterProvider
- the new painter provider- Throws:
IllegalArgumentException
- if the specified painter provider is not an instance ofTLcdS52GXYPainterProvider
.- See Also:
-
paint
Description copied from class:TLcdGXYLayer
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.If this layer is asked to paint its labels, it must inform its
ALcdLabelLocations
instance as to which labels have been painted and which haven't been.The paint mode may contain
ILcdGXYEditableLabelsLayer.PLACED_LABELS
. This is a paint mode to indicate that only labels that are already placed should be painted. The already placed labels can be retrieved from theALcdLabelLocations
retrieved usingILcdGXYEditableLabelsLayer.getLabelLocations()
.This implementation calls
paintFromOverlaps
orpaintFromModel
, depending on whetherTLcdGXYLayer.isPaintFromOverlaps()
returnstrue
orfalse
.This method also calls
TLcdGXYLayer.applyOnInteract(com.luciad.util.ILcdFunction, java.awt.Graphics, int, ILcdGXYView)
andTLcdGXYLayer.applyOnInteractLabels(com.luciad.util.ILcdFunction, java.awt.Graphics, int, ILcdGXYView)
to determine which objects or labels should be painted. Customizing these methods will also customize the painting behavior.Objects smaller than the set minimum object size may be omitted.
- Specified by:
paint
in interfaceILcdGXYEditableLabelsLayer
- Specified by:
paint
in interfaceILcdGXYLayer
- Overrides:
paint
in classTLcdGXYLayer
- 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:
-
paintFromOverlaps
protected void paintFromOverlaps(Graphics aGraphics, int aMode, ILcd2DBoundsIndexedModel a2DBoundsIndexedModel, ILcdGXYContext aGXYContext) Description copied from class:TLcdGXYLayer
Paints the objects in the passed model by applying a painting function to allObject
of theILcd2DBoundsIndexedModel
that interact with the view clip. The paint order is determined by the model.- Overrides:
paintFromOverlaps
in classTLcdGXYLayer
- Parameters:
aGraphics
- the graphics to paint onaMode
- seeILcdGXYLayer.paint
.a2DBoundsIndexedModel
- the model to paintaGXYContext
- theILcdGXYContext
to consider for painting.
-
applyOnInteract
public int applyOnInteract(ILcdFunction aFunction, Rectangle aBounds, boolean aStrictInteract, ILcdGXYView aGXYView) Description copied from class:TLcdGXYLayer
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.
Objects smaller than the set minimum object size may be omitted.
- Specified by:
applyOnInteract
in interfaceILcdGXYLayer
- Overrides:
applyOnInteract
in classTLcdGXYLayer
- 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.
-
applyOnInteract
protected int applyOnInteract(ILcdFunction aFunction, Graphics aGraphics, int aPaintMode, ILcdModel aModel, ILcdGXYView aGXYView) Description copied from class:TLcdGXYLayer
Applies the function to (at the least) all objects from the given model 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.For more information on this method, see the javadoc of
applyOnInteract
.This method is called by
So it is possible to customise these methods by overriding this method. This can be used to e.g. customize the model content for painting of customise the model content for label placement.- Overrides:
applyOnInteract
in classTLcdGXYLayer
- 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.aModel
- the model for whose objects the given function is applied.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.
-