public class TLcdGXYProcedureTrajectoryLegLabelPainter extends Object implements ILcdGXYMultiLabelPainter, ILcdGXYLabelPainterProvider
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.Modifier and Type | Field and Description |
---|---|
static int |
ALTITUDE_DESCRIPTION |
static int |
ALTITUDE_LOWER |
static int |
ALTITUDE_UPPER |
static int |
COURSE |
static int |
DISTANCE |
static int |
DURATION |
static int |
IAP_FIX_ROLE |
static int |
LEG_TYPE |
static int |
OVERFLY_TYPE |
static int |
RHO |
static int |
ROUTE_TYPE |
static int |
SEQUENCE_NUMBER |
static int |
THETA |
static int |
TURN_DIRECTION |
DEFAULT, SELECTED
Constructor and Description |
---|
TLcdGXYProcedureTrajectoryLegLabelPainter()
Creates a new
TLcdGXYProcedureTrajectoryLegLabelPainter . |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Redefines
Object.clone to make it public. |
ILcdGXYLabelPainter |
getGXYLabelPainter(Object aObject)
Finds an
ILcdGXYLabelPainter that can be used to label the object passed. |
TLcdGXYFeaturedLabelPainter |
getInternalLabelPainter() |
int |
getLabelCount(Graphics aGraphics,
ILcdGXYContext aContext)
Returns the number of labels for the object set to this label painter.
|
int |
getLabelIndex()
Returns the index of the label that is currently painted or scheduled to paint.
|
int |
getLocationIndex()
Gets the index of location where to paint the label(s) of the set Object.
|
Object |
getObject()
Gets the Object this ILcdGXYLabelPainter can label.
|
int |
getPossibleLocationCount(Graphics aGraphics)
Returns the number of possible locations where this
ILcdGXYLabelPainter can
paint/draw the labels of the set domain Object . |
int |
getSubLabelCount(int aIndex)
Return the number of sublabels in a label.
|
int |
getSubLabelIndex()
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 on
aGraphics . |
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 |
setObject(Object aObject)
Sets the Object to be labeled by this ILcdGXYLabelPainter.
|
void |
setSubLabelIndex(int aIndex)
Sets the sublabel index.
|
public static final int SEQUENCE_NUMBER
public static final int ROUTE_TYPE
public static final int LEG_TYPE
public static final int OVERFLY_TYPE
public static final int TURN_DIRECTION
public static final int RHO
public static final int THETA
public static final int COURSE
public static final int DISTANCE
public static final int DURATION
public static final int ALTITUDE_DESCRIPTION
public static final int ALTITUDE_UPPER
public static final int ALTITUDE_LOWER
public static final int IAP_FIX_ROLE
public TLcdGXYProcedureTrajectoryLegLabelPainter()
TLcdGXYProcedureTrajectoryLegLabelPainter
.public TLcdGXYFeaturedLabelPainter getInternalLabelPainter()
public void setLabelProperties(int[] aLabelProperties)
aLabelProperties
- An array containing any of the SEQUENCE_NUMBER, ROUTE_TYPE, etc. constants.public Object getObject()
ILcdGXYLabelPainter
getObject
in interface ILcdGXYLabelPainter
ILcdGXYLabelPainter.setObject(java.lang.Object)
public void setObject(Object aObject)
ILcdGXYLabelPainter
setObject
in interface ILcdGXYLabelPainter
aObject
- The object to be labeled.ILcdGXYLabelPainter.getObject()
public int getLocationIndex()
ILcdGXYLabelPainter
getLocationIndex
in interface ILcdGXYLabelPainter
ILcdGXYLabelPainter.setLocationIndex(int)
public void setLocationIndex(int aIndex)
ILcdGXYLabelPainter
setLocationIndex
in interface ILcdGXYLabelPainter
aIndex
- the index of the location. Must be between 0 and getPossibleLocationCount()
- 1.ILcdGXYLabelPainter.getLocationIndex()
public int getLabelIndex()
ILcdGXYMultiLabelPainter
getLabelIndex
in interface ILcdGXYMultiLabelPainter
ILcdGXYMultiLabelPainter.setLabelIndex(int)
public void setLabelIndex(int aIndex)
ILcdGXYMultiLabelPainter
Sets the label. The results of any subsequent method calls to ILcdGXYLabelPainter.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
and ILcdGXYLabelPainter.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.
setLabelIndex
in interface ILcdGXYMultiLabelPainter
aIndex
- The label index. This should be larger than or equal to 0
and
less than the result ILcdGXYMultiLabelPainter.getLabelCount(java.awt.Graphics, com.luciad.view.gxy.ILcdGXYContext)
.ILcdGXYMultiLabelPainter.setSubLabelIndex(int)
public int getLabelCount(Graphics aGraphics, ILcdGXYContext aContext)
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.getLabelCount
in interface ILcdGXYMultiLabelPainter
aGraphics
- The Graphics currently painting onaContext
- The ILcdGXYContext currently validpublic int getSubLabelIndex()
ILcdGXYMultiLabelPainter
getSubLabelIndex
in interface ILcdGXYMultiLabelPainter
ILcdGXYMultiLabelPainter.setSubLabelIndex(int)
public void setSubLabelIndex(int aIndex)
ILcdGXYMultiLabelPainter
ILcdGXYLabelPainter.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
and
ILcdGXYLabelPainter.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.setSubLabelIndex
in interface ILcdGXYMultiLabelPainter
aIndex
- The sub label index. This should be larger than or equal to
0
and less than the result ILcdGXYMultiLabelPainter.getSubLabelCount(int)
.ILcdGXYMultiLabelPainter.setLabelIndex(int)
public int getSubLabelCount(int aIndex)
ILcdGXYMultiLabelPainter
getSubLabelCount
in interface ILcdGXYMultiLabelPainter
aIndex
- the index of the label.public void paintLabel(Graphics aGraphics, int aMode, ILcdGXYContext aContext)
ILcdGXYLabelPainter
Paints the label of the set Object on aGraphics
. aGXYContext
should
contain the ILcdGXYView
for which the label is painted and
ILcdGXYLayer
to which the object belongs
The implementation of this method shall define how to paint the label of the set Object in
the given mode, considering aGXYContext
and the possible locations
aLocationIndex
(of multiple alternatives).
The domain Object
of the label to be painted and the location index should be
set before calling this method using the setObject
and
setLocationIndex
methods respectively.
paintLabel
in interface ILcdGXYLabelPainter
aGraphics
- the Graphics
instance on which to paint.aMode
- a combination of ILcdGXYLabelPainter.DEFAULT and ILcdGXYLabelPainter.SELECTED.aContext
- the ILcdGXYContext
in which the label painting has to be
performed.ILcdGXYLabelPainter.DEFAULT
,
ILcdGXYLabelPainter.SELECTED
public int getPossibleLocationCount(Graphics aGraphics)
ILcdGXYLabelPainter
ILcdGXYLabelPainter
can
paint/draw the labels of the set domain Object
.
The domain Object
for which the location count is retrieved should be set
before calling this method using the ILcdGXYLabelPainter.setObject(java.lang.Object)
method.
getPossibleLocationCount
in interface ILcdGXYLabelPainter
aGraphics
- the Graphics the label will be painted on.ILcdGXYLabelPainter
can
paint/draw the labels of the set Object.ILcdGXYLabelPainter.setLocationIndex(int)
public double labelBoundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aContext, Rectangle aRectangle) throws TLcdNoBoundsException
ILcdGXYLabelPainter
Calculates the bounds of the label that can be painted. The bounds are
set as a side effect in aRectangleSFCT
, the orientation of
aRectangleSFCT
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)
and ILcdGXYLabelPainter.setLocationIndex(int)
methods respectively.
labelBoundsSFCT
in interface ILcdGXYLabelPainter
aGraphics
- the aGraphics
to consider.aMode
- the representation mode of the label.aContext
- the ILcdGXYContext
the drawing depends on.aRectangle
- the Rectangle
containing the bounds of the label in view /
graphics coordinates as side effect.TLcdNoBoundsException
- if the Object doesn't have any valid bounds, e.g. if it is always
invisible in the current projection.ILcdGXYLabelPainter.DEFAULT
,
ILcdGXYLabelPainter.SELECTED
public Object clone()
ILcdGXYLabelPainter
Object.clone
to make it public.clone
in interface ILcdGXYLabelPainter
clone
in interface ILcdGXYLabelPainterProvider
clone
in class Object
public ILcdGXYLabelPainter getGXYLabelPainter(Object aObject)
ILcdGXYLabelPainterProvider
ILcdGXYLabelPainter
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;
}
getGXYLabelPainter
in interface ILcdGXYLabelPainterProvider
aObject
- the object to find a label painter for