Class TLcdICAOAirspacePainter
- All Implemented Interfaces:
ILcdCloneable
,ILcdPropertyChangeSource
,ILcdGXYPainter
,ILcdGXYPainterProvider
,Serializable
,Cloneable
ILcdGenericAirspace
objects according to the ICAO
guidelines for aeronautical charts. The painter supports separate paint styles for the different
airspace classifications (A, B, C, D, E, F and G).
This label painter evaluates its expressions using an instance of TLcdDataObjectExpressionLanguage
.- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Property defining that the rendering of the band should be in high-quality.static final int
Property defining that the rendering of the band should be as quick as possible.Fields inherited from class com.luciad.view.gxy.ALcdGXYPainter
defaultCreationFillStyle, defaultCreationLineStyle, defaultFillStyle, defaultLineStyle, fWorkBounds
Fields inherited from interface com.luciad.view.gxy.ILcdGXYPainter
BODY, CREATING, DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPropertyChangeListener
(PropertyChangeListener aPropertyChangeListener) Adds aPropertyChangeListener
to thisILcdGXYPainter
.void
anchorPointSFCT
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPoint) ImplementsILcdGXYPainter.anchorPointSFCT
.void
boundsSFCT
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds a2DEditableBounds) Sets the supplied bounds (in view coordinates, pixels) so that it encompasses the representation of the object in the given mode taking into account the given context.clone()
MakesObject.clone()
public.Gets the fill style.getCursor
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Override this method to return a cursor.Returns the display name of thisILcdGXYPainter
.Gets the line style.Returns the Object for which the representation is currently being handled by this painter.boolean
isTouched
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Checks if the representation of the object in the given mode is touched at the location as defined in the supplied context.void
paint
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Displays the representation of the object in the given mode on the Graphics passed, taking into account the supplied context.void
removePropertyChangeListener
(PropertyChangeListener aPropertyChangeListener) Removes aPropertyChangeListener
from thisILcdGXYPainter
.void
setBandWidth
(char aAirspaceClassification, int aBandWidth) Sets the width of the band for the given airspace classification.void
setClassExpression
(String aExpression) Sets the expression that evaluates to the airspace classification.void
setClassIndex
(int aIndex) Deprecated.void
Sets the color for the given airspace classification.void
setLineStyle
(TLcdG2DLineStyle aStyle) Sets the style for painting lines.void
Sets the Object for which the representation shall be handled by this painter.void
setRenderMode
(int aRenderMode) Sets the rendering mode.void
setSelectionColor
(char aAirspaceClassification, Color aColor) Sets the selection color for the given airspace classification.void
setSnapIcon
(ILcdIcon aSnapIcon) snapTarget
(Graphics aGraphics, ILcdGXYContext aGXYContext) Override this method to support snapping.boolean
supportSnap
(Graphics aGraphics, ILcdGXYContext aGXYContext) Override this method to support snapping.Methods inherited from class com.luciad.view.gxy.ALcdGXYPainter
firePropertyChangeEvent, firePropertyChangeEvent, getGXYPainter, isTraceOn, setClassTraceOn, setDisplayName, setTraceOn
-
Field Details
-
RENDER_QUALITY
public static final int RENDER_QUALITYProperty defining that the rendering of the band should be in high-quality.- See Also:
-
RENDER_SPEED
public static final int RENDER_SPEEDProperty defining that the rendering of the band should be as quick as possible.- See Also:
-
-
Constructor Details
-
TLcdICAOAirspacePainter
public TLcdICAOAirspacePainter()Creates a newTLcdICAOAirspacePainter
object.
-
-
Method Details
-
paint
Description copied from interface:ILcdGXYPainter
Displays the representation of the object in the given mode on the Graphics passed, taking into account the supplied context.The visual representation of an object depends on the context. Depending on the context (e.g. is the location covered by the view), an object may or may not have a representation. The context contains:
- transformations which allow to compute the location in view space of points and bounds given in model, space
- a pen which can connect points with a line or create arcs around a point,
- the view for which the object's representation must be painted. This can be useful when the painted object depends on the scale of the view, or the presence of other layers in the view.
- the current location(s) of the mouse or input device and the last location(s) the mouse or input device was pressed.
The mode passed in this method indicates what part of the object must be painted, whether it should be painted as selected or not, and whether user interaction (via mouse movements) must be taken into account.
When the mode passed contains either TRANSLATING, RESHAPING or CREATING, this method is also responsible for interpreting interaction on the representation of an object and modifying the representation of the object accordingly. The painter is not responsible for modifying the object itself, this is done by a corresponding
ILcdGXYEditor
. Implementations ofILcdGXYPainter
andILcdGXYEditor
interfaces must be consistent for an object: the painter must display the result of the user interaction on the object, while the editor is responsible for modifying the object as a result of the user interaction. A good practice to ensure a consistent implementation is to implement both theILcdGXYPainter
andILcdGXYEditor
interfaces in a single class.When the mode passed includes SNAPS, the part of the representation which corresponds to the object returned as snap target by the method
snapTarget
must be painted in order to provide the user with a visual indication of the snap target.The Graphics passed in this method can be different from the Graphics returned by a view due to techniques such as double buffering (as applied in Swing). Basic drawing operations must always be performed on the Graphics passed as an argument in this method.
- Parameters:
aGraphics
- the Graphics on which the representation of the object is paintedaMode
- the mode the object is represented in (see class documentation).aGXYContext
- theILcdGXYContext
the drawing depends on.
-
setClassIndex
Deprecated.Sets the feature number that has to be used to retrieve the airspace classification from an ILcdFeatured object.- Parameters:
aIndex
- The number of the airspace classification feature.
-
setClassExpression
Sets the expression that evaluates to the airspace classification.- Parameters:
aExpression
- the airspace classification expression.- See Also:
-
setColor
Sets the color for the given airspace classification.- Parameters:
anAirspaceClassification
- A,B,C,D,E,F or GaColor
- A color.
-
setSelectionColor
Sets the selection color for the given airspace classification.- Parameters:
aAirspaceClassification
- A,B,C,D,E,F or GaColor
- A color.
-
setBandWidth
public void setBandWidth(char aAirspaceClassification, int aBandWidth) Sets the width of the band for the given airspace classification. An airspace is represented by a polygon with a band on the inside. The width of this band is represented in meters.- Parameters:
aAirspaceClassification
- A,B,C,D,E,F or GaBandWidth
- the width of the band in meters.
-
setRenderMode
public void setRenderMode(int aRenderMode) Sets the rendering mode. Should be one of: TLcdICAOAirspacePainter.RENDER_SPEED, TLcdICAOAirspacePainter.RENDER_QUALITY- Parameters:
aRenderMode
- The desired rendering-configuration.
-
setSnapIcon
-
getSnapIcon
-
setLineStyle
Sets the style for painting lines. The color/selection color of the given style will be used as default color/selection color when an airspace has no classification or when no specific airspace classification - color match can be retrieved.- Parameters:
aStyle
- The line style.
-
getLineStyle
Gets the line style.- Returns:
- The line style.
-
getBandStyle
Gets the fill style.- Returns:
- The fill style.
-
setObject
Description copied from interface:ILcdGXYPainter
Sets the Object for which the representation shall be handled by this painter.Setting the object on the painter may have an effect on the internal state of the painter, for example, the color to use.
When the object is set to a painter, the context parameter in subsequent calls to methods in this class must contain a layer that contains this object and for which the painter for this object is this painter.
- Parameters:
aObject
- the object for which the representation shall be handled by this painter.- See Also:
-
boundsSFCT
public void boundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds a2DEditableBounds) throws TLcdNoBoundsException Description copied from interface:ILcdGXYPainter
Sets the supplied bounds (in view coordinates, pixels) so that it encompasses the representation of the object in the given mode taking into account the given context.If this method returns without exception the bounds argument must encompass the representation of the object. A point outside the bounds will not be contained within the painted object.
The bounds returned in this method can be seen as the equivalent in the view space of the bounds in the model space for
ILcdBounded
objects.- Parameters:
aGraphics
- the Graphics on which the representation of the object is paintedaMode
- the mode the object is represented in (see class documentation). For example, an object may be represented differently in SELECTED mode compared to DEFAULT mode. The returned bounds of the representation must take this different representation into account.aGXYContext
- the context for which the representation of the object is painted. It contains amongst others the transformations from model to world and world to view.a2DEditableBounds
- the bounds that must be adapted to encompass the representation of the object in the given mode and context. These bounds must not be taken into account when the method has thrown an exception.- Throws:
TLcdNoBoundsException
- if no bounds can be determined for the representation of the object. This can happen when the object does not have a representation in the given context, for example when it is located in a part of the world which is not visible in the current view.- See Also:
-
clone
Description copied from interface:ILcdCloneable
Makes
When for example extending fromObject.clone()
public.java.lang.Object
, it can be implemented like this:public Object clone() { try { return super.clone(); } catch ( CloneNotSupportedException e ) { // Cannot happen: extends from Object and implements Cloneable (see also Object.clone) throw new RuntimeException( e ); } }
- Specified by:
clone
in interfaceILcdCloneable
- Specified by:
clone
in interfaceILcdGXYPainterProvider
- Overrides:
clone
in classALcdGXYPainter
- Returns:
- a clone of this painter provider.
- See Also:
-
getCursor
Description copied from class:ALcdGXYPainter
Override this method to return a cursor. This implementation returns null.- Specified by:
getCursor
in interfaceILcdGXYPainter
- Overrides:
getCursor
in classALcdGXYPainter
- Parameters:
aGraphics
- the Graphics on which the representation of the object is paintedaMode
- the rendering mode to return the cursor for.aGXYContext
- the context in which the rendering occurs.- Returns:
null
.
-
getDisplayName
Description copied from class:ALcdGXYPainter
Returns the display name of thisILcdGXYPainter
.- Specified by:
getDisplayName
in interfaceILcdGXYPainter
- Overrides:
getDisplayName
in classALcdGXYPainter
- Returns:
- the name that has been set using
setDisplayName()
, orthis.toString()
if no name has been set.
-
getObject
Description copied from interface:ILcdGXYPainter
Returns the Object for which the representation is currently being handled by this painter.- Returns:
- the Object for which the representation is currently being handled by this painter.
- See Also:
-
isTouched
Description copied from interface:ILcdGXYPainter
Checks if the representation of the object in the given mode is touched at the location as defined in the supplied context.The location that must be taken into account to check whether the representation is touched can be retrieved from the context passed with the methods
ILcdGXYContext.getX()
andILcdGXYContext.getY()
. If the check is part of an ongoing operation of user interaction, for example, when the mouse is being dragged, the location of the start of the operation can also be taken into account using the methodsILcdGXYContext.getDeltaX()
andILcdGXYContext.getDeltaY()
. The context contains the transformations required to convert this location into the equivalent location in model space. Implementations of this interface usually follow either of the following patterns:- transform the location of the interaction back to model space and compare the coordinates with the object in model space.
- transform the location to world space and compare with a world representation of the object. This forces the painter into caching a world representation of the object. Caching a view representation of an object is not very practical as it would have to change whenever the view's scale changes or when it is panned. A world representation of an object only changes when the view's XYWorldReference changes, which happens less frequently.
As the mode influences the way an object is represented, it must also be taken into account when checking whether that representation is being touched. When the mode contains CREATING, RESHAPING or TRANSLATING which indicate that the object must be represented in a state for an ongoing operation, the location of the start of the operation may be taken into account as mentioned above. The painting result can take into account multiple locations, to respond to, for example, multi-touch input. When the mode contains SELECTED, the painter should also check if the non-selected representation is touched, since these are always painted on top of each other.
The
boundsSFCT
is often used to speed up the performance of this method as a location outside these bounds can never touch the representation of the object.Note that this method does not give an indication of what part of the object is touched. It is up to the painter implementations to provide methods to make this distinction. The method does also not indicate what sensitivity must be applied when checking if an object is touched. It is up to the implementation to decide what should be the maximum distance between the location given in the context and the closest relevant point or area of the representation of the object.
- Parameters:
aGraphics
- the Graphics on which the representation of the object is paintedaMode
- the mode the object is represented inaGXYContext
- contains the location of the interaction and the transformations to convert this location into model coordinates- Returns:
- true if the representation of the object in the given mode is touched by the location as defined in the context passed, false otherwise
- See Also:
-
addPropertyChangeListener
Description copied from class:ALcdGXYPainter
Adds aPropertyChangeListener
to thisILcdGXYPainter
.- Specified by:
addPropertyChangeListener
in interfaceILcdPropertyChangeSource
- Overrides:
addPropertyChangeListener
in classALcdGXYPainter
- Parameters:
aPropertyChangeListener
- The listener to be notified- See Also:
-
removePropertyChangeListener
Description copied from class:ALcdGXYPainter
Removes aPropertyChangeListener
from thisILcdGXYPainter
.- Specified by:
removePropertyChangeListener
in interfaceILcdPropertyChangeSource
- Overrides:
removePropertyChangeListener
in classALcdGXYPainter
- Parameters:
aPropertyChangeListener
- the listener that should no longer be notified of changes of this object's properties- See Also:
-
snapTarget
Description copied from class:ALcdGXYPainter
Override this method to support snapping. This implementation does not support snapping.- Specified by:
snapTarget
in interfaceILcdGXYPainter
- Overrides:
snapTarget
in classALcdGXYPainter
- Parameters:
aGraphics
- the Graphics on which the representation of the object is paintedaGXYContext
- the context in which this object is represented and in which the editing of an object occurs.- Returns:
null
.- See Also:
-
supportSnap
Description copied from class:ALcdGXYPainter
Override this method to support snapping. This implementation does not support snapping.- Specified by:
supportSnap
in interfaceILcdGXYPainter
- Overrides:
supportSnap
in classALcdGXYPainter
- Parameters:
aGraphics
- the Graphics on which the representation of the object is paintedaGXYContext
- the context in which this object is represented and in which the editing of an object occurs.- Returns:
false
.
-
anchorPointSFCT
public void anchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPoint) throws TLcdNoBoundsException ImplementsILcdGXYPainter.anchorPointSFCT
.aPointSFCT
will be set to the center of the bounds calculated by boundsSFCT. This implementation uses the center of the airspace as anchor points.- Specified by:
anchorPointSFCT
in interfaceILcdGXYPainter
- Overrides:
anchorPointSFCT
in classALcdGXYPainter
- Parameters:
aGraphics
- the Graphics on which the representation of the object is paintedaMode
- the mode the object is painted in (see class documentation)aGXYContext
- the context for which the representation of the object is painted. It contains amongst others the transformations from model to world and world to view.aPoint
- the point that has to be moved to the location of the anchor point of the representation of the object. This point must not be taken into account when the method has thrown a TLcdNoBoundsException.- Throws:
TLcdNoBoundsException
- if no anchor point can be determined for the representation of the object. This can be when the object does not have a representation in the given context, for example when it is located in a part of the world which is not visible in the projection as set in the views world reference.- See Also:
-
setClassExpression(String)