Class TLcdGXYProcedureTrajectoryLegLabelPainter
- All Implemented Interfaces:
ILcdGXYLabelPainter
,ILcdGXYLabelPainterProvider
,ILcdGXYMultiLabelPainter
,Serializable
,Cloneable
GXYProcedureTrajectoryLegLabelPainter
sample class, and is actually a wrapper around it. This construct allows to either use this label painter as-is,
or to not use it at all and replace it with the identical GXYProcedureTrajectoryLegLabelPainter
.
As the source code of the latter is available as sample code, it can be customized.
Please refer to GXYProcedureTrajectoryLegLabelPainter
for an explanation of what this painter does.- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Fields inherited from interface com.luciad.view.gxy.ILcdGXYLabelPainter
DEFAULT, SELECTED
-
Constructor Summary
ConstructorDescriptionCreates a newTLcdGXYProcedureTrajectoryLegLabelPainter
. -
Method Summary
Modifier and TypeMethodDescriptionclone()
RedefinesObject.clone
to make it public.getGXYLabelPainter
(Object aObject) Finds anILcdGXYLabelPainter
that can be used to label the object passed.int
getLabelCount
(Graphics aGraphics, ILcdGXYContext aContext) Returns the number of labels for the object set to this label painter.int
Returns the index of the label that is currently painted or scheduled to paint.int
Gets the index of location where to paint the label(s) of the set Object.Gets the Object this ILcdGXYLabelPainter can label.int
getPossibleLocationCount
(Graphics aGraphics) Returns the number of possible locations where thisILcdGXYLabelPainter
can paint/draw the labels of the set domainObject
.int
getSubLabelCount
(int aIndex) Return the number of sublabels in a label.int
Returns the index of the sublabel to paint.double
labelBoundsSFCT
(Graphics aGraphics, int aMode, ILcdGXYContext aContext, Rectangle aRectangle) Calculates the bounds of the label that can be painted.void
paintLabel
(Graphics aGraphics, int aMode, ILcdGXYContext aContext) Paints the label of the set Object onaGraphics
.void
setLabelIndex
(int aIndex) Sets the label.void
setLabelProperties
(int[] aLabelProperties) Sets the procedure leg properties that need to be displayed on the labels.void
setLocationIndex
(int aIndex) Sets the index of location where to paint the label(s) of the set Object.void
Sets the Object to be labeled by this ILcdGXYLabelPainter.void
setSubLabelIndex
(int aIndex) Sets the sublabel index.
-
Field Details
-
SEQUENCE_NUMBER
public static final int SEQUENCE_NUMBER- See Also:
-
ROUTE_TYPE
public static final int ROUTE_TYPE- See Also:
-
LEG_TYPE
public static final int LEG_TYPE- See Also:
-
OVERFLY_TYPE
public static final int OVERFLY_TYPE- See Also:
-
TURN_DIRECTION
public static final int TURN_DIRECTION- See Also:
-
RHO
public static final int RHO- See Also:
-
THETA
public static final int THETA- See Also:
-
COURSE
public static final int COURSE- See Also:
-
DISTANCE
public static final int DISTANCE- See Also:
-
DURATION
public static final int DURATION- See Also:
-
ALTITUDE_DESCRIPTION
public static final int ALTITUDE_DESCRIPTION- See Also:
-
ALTITUDE_UPPER
public static final int ALTITUDE_UPPER- See Also:
-
ALTITUDE_LOWER
public static final int ALTITUDE_LOWER- See Also:
-
IAP_FIX_ROLE
public static final int IAP_FIX_ROLE- See Also:
-
-
Constructor Details
-
TLcdGXYProcedureTrajectoryLegLabelPainter
public TLcdGXYProcedureTrajectoryLegLabelPainter()Creates a newTLcdGXYProcedureTrajectoryLegLabelPainter
.
-
-
Method Details
-
getInternalLabelPainter
-
setLabelProperties
public void setLabelProperties(int[] aLabelProperties) Sets the procedure leg properties that need to be displayed on the labels. Call this method with a null argument to revert to the default behavior of the internal label painter (i.e. retrieve the labels based on feature indices).- Parameters:
aLabelProperties
- An array containing any of the SEQUENCE_NUMBER, ROUTE_TYPE, etc. constants.
-
getObject
Description copied from interface:ILcdGXYLabelPainter
Gets the Object this ILcdGXYLabelPainter can label.- Specified by:
getObject
in interfaceILcdGXYLabelPainter
- Returns:
- the Object this ILcdGXYLabelPainter can label.
- See Also:
-
setObject
Description copied from interface:ILcdGXYLabelPainter
Sets the Object to be labeled by this ILcdGXYLabelPainter.- Specified by:
setObject
in interfaceILcdGXYLabelPainter
- Parameters:
aObject
- The object to be labeled.- See Also:
-
getLocationIndex
public int getLocationIndex()Description copied from interface:ILcdGXYLabelPainter
Gets the index of location where to paint the label(s) of the set Object.- Specified by:
getLocationIndex
in interfaceILcdGXYLabelPainter
- Returns:
- the index of the position. Must be between 0 and getPossibleLocationCount() - 1.
- See Also:
-
setLocationIndex
public void setLocationIndex(int aIndex) Description copied from interface:ILcdGXYLabelPainter
Sets the index of location where to paint the label(s) of the set Object.- Specified by:
setLocationIndex
in interfaceILcdGXYLabelPainter
- Parameters:
aIndex
- the index of the location. Must be between 0 and getPossibleLocationCount() - 1.- See Also:
-
getLabelIndex
public int getLabelIndex()Description copied from interface:ILcdGXYMultiLabelPainter
Returns the index of the label that is currently painted or scheduled to paint.- Specified by:
getLabelIndex
in interfaceILcdGXYMultiLabelPainter
- Returns:
- the index of the label that is currently painted or scheduled to paint.
- See Also:
-
setLabelIndex
public void setLabelIndex(int aIndex) Description copied from interface:ILcdGXYMultiLabelPainter
Sets the label. The results of any subsequent method calls to
ILcdGXYLabelPainter.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
andILcdGXYLabelPainter.labelBoundsSFCT(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext, java.awt.Rectangle)
etc. will apply to the label and sublabel indicated by this label index.- Specified by:
setLabelIndex
in interfaceILcdGXYMultiLabelPainter
- Parameters:
aIndex
- The label index. This should be larger than or equal to0
and less than the resultILcdGXYMultiLabelPainter.getLabelCount(java.awt.Graphics, com.luciad.view.gxy.ILcdGXYContext)
.- See Also:
-
getLabelCount
Description copied from interface:ILcdGXYMultiLabelPainter
Returns the number of labels for the object set to this label painter.
Note: when returning multiple (moveable) labels for the same object, it might be useful to useTLcdGXYEditControllerModel2.EDIT_WHAT_FIRST_TOUCHED_LABEL
to avoid that a mouse drag moves them all together.- Specified by:
getLabelCount
in interfaceILcdGXYMultiLabelPainter
- Parameters:
aGraphics
- The Graphics currently painting onaContext
- The ILcdGXYContext currently valid- Returns:
- The number of label for the given object.
-
getSubLabelIndex
public int getSubLabelIndex()Description copied from interface:ILcdGXYMultiLabelPainter
Returns the index of the sublabel to paint.- Specified by:
getSubLabelIndex
in interfaceILcdGXYMultiLabelPainter
- Returns:
- the index of the sublabel to paint.
- See Also:
-
setSubLabelIndex
public void setSubLabelIndex(int aIndex) Description copied from interface:ILcdGXYMultiLabelPainter
Sets the sublabel index. The results of any subsequent method calls toILcdGXYLabelPainter.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
andILcdGXYLabelPainter.labelBoundsSFCT(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext, java.awt.Rectangle)
etc. will apply to the label and sublabel indicated by this sublabel index.- Specified by:
setSubLabelIndex
in interfaceILcdGXYMultiLabelPainter
- Parameters:
aIndex
- The sub label index. This should be larger than or equal to0
and less than the resultILcdGXYMultiLabelPainter.getSubLabelCount(int)
.- See Also:
-
getSubLabelCount
public int getSubLabelCount(int aIndex) Description copied from interface:ILcdGXYMultiLabelPainter
Return the number of sublabels in a label. The value should be 1 or higher.- Specified by:
getSubLabelCount
in interfaceILcdGXYMultiLabelPainter
- Parameters:
aIndex
- the index of the label.- Returns:
- The number of sublabels of the label with the given index.
-
paintLabel
Description copied from interface:ILcdGXYLabelPainter
Paints the label of the set Object on
aGraphics
.aGXYContext
should contain theILcdGXYView
for which the label is painted andILcdGXYLayer
to which the object belongsThe implementation of this method shall define how to paint the label of the set Object in the given mode, considering
aGXYContext
and the possible locationsaLocationIndex
(of multiple alternatives).The domain
Object
of the label to be painted and the location index should be set before calling this method using thesetObject
andsetLocationIndex
methods respectively.- Specified by:
paintLabel
in interfaceILcdGXYLabelPainter
- Parameters:
aGraphics
- theGraphics
instance on which to paint.aMode
- a combination of ILcdGXYLabelPainter.DEFAULT and ILcdGXYLabelPainter.SELECTED.aContext
- theILcdGXYContext
in which the label painting has to be performed.- See Also:
-
getPossibleLocationCount
Description copied from interface:ILcdGXYLabelPainter
Returns the number of possible locations where thisILcdGXYLabelPainter
can paint/draw the labels of the set domainObject
.The domain
Object
for which the location count is retrieved should be set before calling this method using theILcdGXYLabelPainter.setObject(java.lang.Object)
method.- Specified by:
getPossibleLocationCount
in interfaceILcdGXYLabelPainter
- Parameters:
aGraphics
- the Graphics the label will be painted on.- Returns:
- the number of possible locations where this
ILcdGXYLabelPainter
can paint/draw the labels of the set Object. - See Also:
-
labelBoundsSFCT
public double labelBoundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aContext, Rectangle aRectangle) throws TLcdNoBoundsException Description copied from interface:ILcdGXYLabelPainter
Calculates the bounds of the label that can be painted. The bounds are set as a side effect in
aRectangleSFCT
, the orientation ofaRectangleSFCT
is returned as an angle.The bounds represent the upper left point of the label, and a width and a height. The rotation value represents the rotation of the label bounds around the upper left point.
The object for which the bounds are retrieved and the location index of the label should be set before calling this method using the
ILcdGXYLabelPainter.setObject(java.lang.Object)
andILcdGXYLabelPainter.setLocationIndex(int)
methods respectively.- Specified by:
labelBoundsSFCT
in interfaceILcdGXYLabelPainter
- Parameters:
aGraphics
- theaGraphics
to consider.aMode
- the representation mode of the label.aContext
- theILcdGXYContext
the drawing depends on.aRectangle
- theRectangle
containing the bounds of the label in view / graphics coordinates as side effect.- Returns:
- the angle orientation of the rectangle around the labels in RADIANs, clockwise, 0 at 3 o'clock.
- Throws:
TLcdNoBoundsException
- if the Object doesn't have any valid bounds, e.g. if it is always invisible in the current projection.- See Also:
-
clone
Description copied from interface:ILcdGXYLabelPainter
RedefinesObject.clone
to make it public.- Specified by:
clone
in interfaceILcdGXYLabelPainter
- Specified by:
clone
in interfaceILcdGXYLabelPainterProvider
- Overrides:
clone
in classObject
-
getGXYLabelPainter
Description copied from interface:ILcdGXYLabelPainterProvider
Finds anILcdGXYLabelPainter
that can be used to label the object passed.The label painter provider is responsible for setting the object to the label painter before returning the label painter. An implementation should therefore have the following structure:
public ILcdGXYLabelPainter getGXYLabelPainter(Object aObject) { ILcdGXYLabelPainter labelPainter = ... // find the label painter for the object if (labelPainter != null) { labelPainter.setObject(aObject); } return labelPainter; }
- Specified by:
getGXYLabelPainter
in interfaceILcdGXYLabelPainterProvider
- Parameters:
aObject
- the object to find a label painter for- Returns:
- a label painter that can be used to label the object; or null if no label painter could be found for the given object, or the object could not be set on the retrieved label painter.
-