Class TLcdWMSProxyGXYLayer
- All Implemented Interfaces:
ILcdPropertyChangeSource,ILcdSelection<Object>,ILcdGXYEditableLabelsLayer,ILcdGXYLayer,ILcdLayer,Serializable
ILcdGXYLayer implementation is designed for models
containing an ALcdWMSProxy object.
The easiest way to create a WMS layer is by using TLcdWMSProxyGXYLayerFactory.
When creating the layer manually (e.g. by creating an instance of this class), for a minimal setup, the following
should be configured:
- the
ILcdModel: either through the constructor or the setter - the
ILcdGXYPainterProvider: typically either aTLcdWMSProxyGXYPainteror aTLcdGXYTiledWMSProxyPainter.
- See Also:
-
Field Summary
Fields inherited from interface com.luciad.view.gxy.ILcdGXYEditableLabelsLayer
PLACED_LABELS -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new WMS proxy GXY layer with an empty model.TLcdWMSProxyGXYLayer(ILcdModel aModel, String aLabel) Creates a new WMS proxy GXY layer with the specified model. -
Method Summary
Modifier and TypeMethodDescriptionintapplyOnInteract(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 thisILcdGXYLayercontent, the bounds of all the drawings (for the supplied mode) that represent the Objects contained in theILcdModelof thisILcdGXYLayer.voidpaint(Graphics aGraphics, int aMode, ILcdGXYView aGXYView) Paints the combined representation of the layer's objects for a view, taking into account the mode.voidInform the layer that it should terminate the current paint operation.Methods inherited from class com.luciad.view.gxy.TLcdGXYLayer
applyOnInteract, applyOnInteract, applyOnInteractLabels, asFactory, create, 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, paintFromOverlaps, setClassTraceOn, setFilter, setGXYEditorProvider, setGXYLabelEditorProvider, setGXYLabelingAlgorithmProvider, setGXYLabelPainterProvider, setGXYLayerLabelPainter, setGXYPainterProvider, setGXYPainterProviderArray, setGXYPen, setIcon, setInteractMargin, setLabeled, setLabelLocations, setLabelMapScaleRange, setLabelScaleRange, setLabelsEditable, setMapScaleRange, setMinimumObjectSizeForPainting, setModel, setModelElementComparator, setModelQueryConfiguration, setModelXYWorldTransfoClass, setPaintFromOverlaps, setPaintLabelsScaleRatioInterval, setScaleRange, setSelectionLabeled, setTraceOn, setVisible, startPaintingMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.luciad.view.ILcdLayer
clearSelection, fireCollectedSelectionChanges, getLabel, getModel, isEditable, isSelectable, isSelectableSupported, isVisible, selectObject, setEditable, setLabel, setSelectableMethods inherited from interface com.luciad.util.ILcdPropertyChangeSource
addPropertyChangeListener, removePropertyChangeListenerMethods inherited from interface com.luciad.util.ILcdSelection
addSelectionListener, getSelectedObjects, getSelectionCount, isSelected, removeSelectionListener, selectedObjects
-
Constructor Details
-
TLcdWMSProxyGXYLayer
public TLcdWMSProxyGXYLayer()Creates a new WMS proxy GXY layer with an empty model. -
TLcdWMSProxyGXYLayer
Creates a new WMS proxy GXY layer with the specified model. For a minimal setup, a painter provider should be set before including this layer in a view. SeeTLcdWMSProxyGXYLayerfor details.- Parameters:
aModel- the modelaLabel- the label
-
-
Method Details
-
applyOnInteract
public int applyOnInteract(ILcdFunction aFunction, Rectangle aBounds, boolean aStrictInteract, ILcdGXYView aGXYView) Description copied from class:TLcdGXYLayerApplies 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
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.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:
applyOnInteractin interfaceILcdGXYLayer- Overrides:
applyOnInteractin 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, theILcdFunctionshall 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
Description copied from class:TLcdGXYLayerReturns the view bounds of thisILcdGXYLayercontent, the bounds of all the drawings (for the supplied mode) that represent the Objects contained in theILcdModelof thisILcdGXYLayer. For this operation, thisILcdGXYLayeris 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.
- Specified by:
getBoundsin interfaceILcdGXYLayer- Overrides:
getBoundsin classTLcdGXYLayer- Parameters:
aMode- a bitwise combination of ALL or SELECTION and one or more of BODIES and HANDLES. TheILcdGXYLayer.LABELSmode 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.
-
paint
Description copied from class:TLcdGXYLayerPaints 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
painterfor that object, when the LABELS mode is passed, painting shall be delegated to thelabelpainterfor 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
stopPaintingis called, the current painting operation should be aborted.If this layer is asked to paint its labels, it must inform its
ALcdLabelLocationsinstance 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 theALcdLabelLocationsretrieved usingILcdGXYEditableLabelsLayer.getLabelLocations().This implementation calls
paintFromOverlapsorpaintFromModel, depending on whetherTLcdGXYLayer.isPaintFromOverlaps()returnstrueorfalse.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:
paintin interfaceILcdGXYEditableLabelsLayer- Specified by:
paintin interfaceILcdGXYLayer- Overrides:
paintin 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:
-
stopPainting
public void stopPainting()Description copied from class:TLcdGXYLayerInform the layer that it should terminate the current paint operation. This method can be useful when the paint method is executed in a specificThreadand needs to be stopped in a safe state from another Thread.- Specified by:
stopPaintingin interfaceILcdGXYLayer- Overrides:
stopPaintingin classTLcdGXYLayer- See Also:
-