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
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intFields inherited from interface com.luciad.view.gxy.ILcdGXYLabelPainter
DEFAULT, SELECTED -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newTLcdGXYProcedureTrajectoryLegLabelPainter. -
Method Summary
Modifier and TypeMethodDescriptionclone()RedefinesObject.cloneto make it public.getGXYLabelPainter(Object aObject) Finds anILcdGXYLabelPainterthat can be used to label the object passed.intgetLabelCount(Graphics aGraphics, ILcdGXYContext aContext) Returns the number of labels for the object set to this label painter.intReturns the index of the label that is currently painted or scheduled to paint.intGets the index of location where to paint the label(s) of the set Object.Gets the Object this ILcdGXYLabelPainter can label.intgetPossibleLocationCount(Graphics aGraphics) Returns the number of possible locations where thisILcdGXYLabelPaintercan paint/draw the labels of the set domainObject.intgetSubLabelCount(int aIndex) Return the number of sublabels in a label.intReturns the index of the sublabel to paint.doublelabelBoundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aContext, Rectangle aRectangle) Calculates the bounds of the label that can be painted.voidpaintLabel(Graphics aGraphics, int aMode, ILcdGXYContext aContext) Paints the label of the set Object onaGraphics.voidsetLabelIndex(int aIndex) Sets the label.voidsetLabelProperties(int[] aLabelProperties) Sets the procedure leg properties that need to be displayed on the labels.voidsetLocationIndex(int aIndex) Sets the index of location where to paint the label(s) of the set Object.voidSets the Object to be labeled by this ILcdGXYLabelPainter.voidsetSubLabelIndex(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:ILcdGXYLabelPainterGets the Object this ILcdGXYLabelPainter can label.- Specified by:
getObjectin interfaceILcdGXYLabelPainter- Returns:
- the Object this ILcdGXYLabelPainter can label.
- See Also:
-
setObject
Description copied from interface:ILcdGXYLabelPainterSets the Object to be labeled by this ILcdGXYLabelPainter.- Specified by:
setObjectin interfaceILcdGXYLabelPainter- Parameters:
aObject- The object to be labeled.- See Also:
-
getLocationIndex
public int getLocationIndex()Description copied from interface:ILcdGXYLabelPainterGets the index of location where to paint the label(s) of the set Object.- Specified by:
getLocationIndexin 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:ILcdGXYLabelPainterSets the index of location where to paint the label(s) of the set Object.- Specified by:
setLocationIndexin 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:ILcdGXYMultiLabelPainterReturns the index of the label that is currently painted or scheduled to paint.- Specified by:
getLabelIndexin 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:ILcdGXYMultiLabelPainterSets 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:
setLabelIndexin interfaceILcdGXYMultiLabelPainter- Parameters:
aIndex- The label index. This should be larger than or equal to0and less than the resultILcdGXYMultiLabelPainter.getLabelCount(java.awt.Graphics, com.luciad.view.gxy.ILcdGXYContext).- See Also:
-
getLabelCount
Description copied from interface:ILcdGXYMultiLabelPainterReturns 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_LABELto avoid that a mouse drag moves them all together.- Specified by:
getLabelCountin 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:ILcdGXYMultiLabelPainterReturns the index of the sublabel to paint.- Specified by:
getSubLabelIndexin interfaceILcdGXYMultiLabelPainter- Returns:
- the index of the sublabel to paint.
- See Also:
-
setSubLabelIndex
public void setSubLabelIndex(int aIndex) Description copied from interface:ILcdGXYMultiLabelPainterSets 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:
setSubLabelIndexin interfaceILcdGXYMultiLabelPainter- Parameters:
aIndex- The sub label index. This should be larger than or equal to0and less than the resultILcdGXYMultiLabelPainter.getSubLabelCount(int).- See Also:
-
getSubLabelCount
public int getSubLabelCount(int aIndex) Description copied from interface:ILcdGXYMultiLabelPainterReturn the number of sublabels in a label. The value should be 1 or higher.- Specified by:
getSubLabelCountin 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:ILcdGXYLabelPainterPaints the label of the set Object on
aGraphics.aGXYContextshould contain theILcdGXYViewfor which the label is painted andILcdGXYLayerto which the object belongsThe implementation of this method shall define how to paint the label of the set Object in the given mode, considering
aGXYContextand the possible locationsaLocationIndex(of multiple alternatives).The domain
Objectof the label to be painted and the location index should be set before calling this method using thesetObjectandsetLocationIndexmethods respectively.- Specified by:
paintLabelin interfaceILcdGXYLabelPainter- Parameters:
aGraphics- theGraphicsinstance on which to paint.aMode- a combination of ILcdGXYLabelPainter.DEFAULT and ILcdGXYLabelPainter.SELECTED.aContext- theILcdGXYContextin which the label painting has to be performed.- See Also:
-
getPossibleLocationCount
Description copied from interface:ILcdGXYLabelPainterReturns the number of possible locations where thisILcdGXYLabelPaintercan paint/draw the labels of the set domainObject.The domain
Objectfor which the location count is retrieved should be set before calling this method using theILcdGXYLabelPainter.setObject(java.lang.Object)method.- Specified by:
getPossibleLocationCountin interfaceILcdGXYLabelPainter- Parameters:
aGraphics- the Graphics the label will be painted on.- Returns:
- the number of possible locations where this
ILcdGXYLabelPaintercan 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:ILcdGXYLabelPainterCalculates the bounds of the label that can be painted. The bounds are set as a side effect in
aRectangleSFCT, the orientation ofaRectangleSFCTis 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:
labelBoundsSFCTin interfaceILcdGXYLabelPainter- Parameters:
aGraphics- theaGraphicsto consider.aMode- the representation mode of the label.aContext- theILcdGXYContextthe drawing depends on.aRectangle- theRectanglecontaining 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:ILcdGXYLabelPainterRedefinesObject.cloneto make it public.- Specified by:
clonein interfaceILcdGXYLabelPainter- Specified by:
clonein interfaceILcdGXYLabelPainterProvider- Overrides:
clonein classObject
-
getGXYLabelPainter
Description copied from interface:ILcdGXYLabelPainterProviderFinds anILcdGXYLabelPainterthat 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:
getGXYLabelPainterin 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.
-