public class TLcdDefaultVVRendererJ2D extends Object implements ILcdVVRenderer
ILcdVVRenderer
.
This class has get and set methods for customizing its default behavior.
For example the rendering mode can be set for all the sub-profiles at once.
The vertical-cursor will automatically be painted using the Paint
that the user has set for the vertical-cursor. A default
ILcdIcon
can be set to be displayed at each points of
the main-profile etc.BOTTOM_LINE, DEFAULT, FILLED, LEFT_LINE, NO_PAINTING, POLYGON, RIGHT_LINE, TOP_LINE
Constructor and Description |
---|
TLcdDefaultVVRendererJ2D() |
Modifier and Type | Method and Description |
---|---|
void |
drawProfileLine(Graphics aGraphics,
TLcdVVJPanel aVV,
int aState,
int aSegmentIndex,
int aX1,
int aY1,
int aX2,
int aY2)
Draws the line of the main profile that corresponds to the segment with the given index.
|
void |
drawSubProfileLine(Graphics aGraphics,
TLcdVVJPanel aVV,
int aState,
int aRenderingMode,
int aSubProfileStepIndex,
int aSegmentIndex,
int aSubProfileIndex,
int aX1,
int aY1,
int aX2,
int aY2) |
void |
fillSubProfileStepPolygon(Graphics aGraphics,
TLcdVVJPanel aVV,
int aState,
int aRenderingMode,
int aSubProfileStepIndex,
int aSegmentIndex,
int aSubProfileIndex,
int[] aXArray,
int[] aYArray) |
Paint |
getMainProfileLabelPaint()
Returns the Paint that is used when painting label for the main profile points.
|
int |
getMainProfileRenderingMode() |
Format |
getPointFormat()
Returns the format to display labels for the main profile points.
|
ILcdIcon |
getPointIcon(int aPointIndex) |
Dimension |
getPointIconDimension(int aIndex) |
Paint |
getProfilePaint() |
Paint[] |
getProfilePaintArray() |
Stroke |
getProfileStroke() |
int |
getRenderingMode() |
Paint |
getSubProfilePaint() |
Paint[] |
getSubProfilePaintArray() |
int |
getSubProfileRenderingMode() |
int |
getSubProfileRenderingMode(int aSubProfileIndex) |
Stroke |
getSubProfileStroke() |
Paint |
getVerticalCursorPaint() |
Paint |
getYAxisParallelLinePaint() |
Stroke |
getYAxisParallelLineStoke() |
boolean |
isAntiAliasing()
Returns whether to use anti-aliasing when painting.
|
boolean |
isPaintYAxisParallelLine() |
boolean |
isTraceOn()
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
paintPointIcon(Graphics aGraphics,
TLcdVVJPanel aVV,
int aPointIndex,
int aXPosition,
Rectangle aBounds)
Paints the icon of the point with the given index on the graphics.
|
void |
paintPointLabel(Graphics g,
TLcdVVJPanel aVerticalView,
int aPointIndex,
int aXPos,
int aYPos)
Used for painting a label when a point is moved over with the mouse.
|
void |
paintVerticalCursor(Graphics aGraphics,
TLcdVVJPanel aVV,
int aCurrentXPosition,
int aYOffset,
int aHeight,
int aLeftPointIndex,
int aRightPointIndex,
int aMouseY,
double aPercentage)
Paints the VerticalCursor.
|
void |
paintYAxisParallelLine(Graphics aGraphics,
TLcdVVJPanel aVV,
int aPointIndex,
int aX,
Rectangle aBounds)
Paints a vertical line from the point with the given point index on the main profile to the X-axis.
|
void |
setAntiAliasing(boolean aAntiAliasing)
Sets whether to use anti-aliasing when painting.
|
static void |
setClassTraceOn(boolean aClassTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
setMainProfileLabelArray(String[] aLabelArray)
Defines the labels to be painted for the main profile points.
|
void |
setMainProfileLabelPaint(Paint aLabelPaint)
Sets the Paint to use when painting labels for the main profile points.
|
void |
setMainProfileRenderingMode(int aMode)
Sets the rendering mode for the main-profile.
|
void |
setPaintYAxisParallelLine(boolean aBoolean) |
void |
setPointFormat(Format aPointFormat)
Sets the format to display labels for the points.
|
void |
setPointIcon(ILcdIcon aIcon)
Sets the default
ILcdIcon for the main-profile-points. |
void |
setProfilePaint(Paint aPaint)
Sets the
Paint for painting the main-profile. |
void |
setProfilePaintArray(Paint[] aPaintArray) |
void |
setProfileStroke(Stroke aStroke)
Sets the stroke for painting the main-profile.
|
void |
setSubProfilePaint(Paint aPaint)
Configures the visualization
Paint for the sub-profiles. |
void |
setSubProfilePaintArray(Paint[] aPaintArray) |
void |
setSubProfileRenderingMode(int aMode)
Sets one value for all the sub-profiles
|
void |
setSubProfileRenderingMode(int[] aModeArray)
Sets the rendering modes for each of the sub-profiles.
|
void |
setSubProfileStroke(Stroke aStroke)
Sets the
Stroke to use when painting a sub-profile. |
void |
setSubProfileStrokeArray(Stroke[] aStrokeArray) |
void |
setTraceOn(boolean aTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
setVerticalCursorPaint(Paint aCursorPaint)
Sets the
Paint to use for painting the vertical-cursor. |
void |
setYAxisParallelLinePaint(Paint aPaint)
Sets the
Paint to use for painting the YAxisParallelLine. |
void |
setYAxisParallelLineStroke(Stroke aStroke)
Sets the
Stroke to use for painting the YAxisParallelLine. |
void |
subprofilesPaintEpilogue(Graphics aGraphics)
Is called once per painting cycle.
|
void |
subprofilesPaintPrologue(Graphics aGraphics)
Is called once per painting cycle.
|
public static void setClassTraceOn(boolean aClassTraceOn)
true
then all log messages are recorded, otherwise only
the informative, warning and error messages are recorded.aClassTraceOn
- if true then all log messages are recorded,
otherwise only the informative, warning and error messages are recorded.public void setTraceOn(boolean aTraceOn)
true
or false
as argument automatically turns
off tracing for all other class instances for which
setTraceOn
has not been called.
If the argument is false
then only the informative, warning
and error log messages are recorded.aTraceOn
- if true then all log messages are recorded for this
instance. If false, then only the informative, warning and
error log messages are recorded.public boolean isTraceOn()
true
if tracing is enabled for this class.public void setVerticalCursorPaint(Paint aCursorPaint)
Paint
to use for painting the vertical-cursor.public Paint getVerticalCursorPaint()
setVerticalCursorPaint(java.awt.Paint)
public void setSubProfileStroke(Stroke aStroke)
Stroke
to use when painting a sub-profile.public void setSubProfileStrokeArray(Stroke[] aStrokeArray)
aStrokeArray
- configures which Stroke should be used for each sub-profile.
The first element is used for the first subProfile, and so on. If the sub-profile index
is outside this array, the default setSubProfileStroke(java.awt.Stroke)
is used.public Stroke getSubProfileStroke()
setSubProfileStroke(java.awt.Stroke)
public void subprofilesPaintEpilogue(Graphics aGraphics)
ILcdVVRenderer
subprofilesPaintEpilogue
in interface ILcdVVRenderer
aGraphics
- The Graphics on which the sub profiles will be paintedpublic void subprofilesPaintPrologue(Graphics aGraphics)
ILcdVVRenderer
subprofilesPaintPrologue
in interface ILcdVVRenderer
aGraphics
- The Graphics on which the sub profiles will be paintedpublic void paintPointIcon(Graphics aGraphics, TLcdVVJPanel aVV, int aPointIndex, int aXPosition, Rectangle aBounds)
ILcdVVRenderer
paintPointIcon
in interface ILcdVVRenderer
aGraphics
- the graphics to paint the icon on.aVV
- the source object of this call.aPointIndex
- the point index within the main profile.aXPosition
- the X position on the screen for the icon.aBounds
- the location
of this bounds
is positioned on the screen coordinate that has the Y value of the
main profile point's altitude
and the X of the first point on the grid. The width is equal to the
portion between the first X on the grid and the last X on the grid.
The height is equal to the portion between the lowest grid line and
the main profile point.public void setPaintYAxisParallelLine(boolean aBoolean)
aBoolean
- should the YAxisParallelLine be painted or notpublic boolean isPaintYAxisParallelLine()
true
if the YAxisParallelLine should be painted, else false
.public void setProfilePaint(Paint aPaint)
Paint
for painting the main-profile.public void setProfilePaintArray(Paint[] aPaintArray)
aPaintArray
- an array that holds for each segment of the profile a Paintpublic Paint[] getProfilePaintArray()
public Paint getProfilePaint()
setProfilePaint(java.awt.Paint)
public void setSubProfilePaint(Paint aPaint)
Paint
for the sub-profiles.
This value is used in drawSubProfileLine(java.awt.Graphics, com.luciad.view.vertical.TLcdVVJPanel, int, int, int, int, int, int, int, int, int)
.
See setProfilePaintArray(java.awt.Paint[])
for more fine-grained configuration.public void setYAxisParallelLinePaint(Paint aPaint)
Paint
to use for painting the YAxisParallelLine.public Paint getYAxisParallelLinePaint()
Paint
to use for painting the YAxisParallelLine.public void setYAxisParallelLineStroke(Stroke aStroke)
Stroke
to use for painting the YAxisParallelLine.public Stroke getYAxisParallelLineStoke()
Stroke
to use for painting the YAxisParallelLine.public void setSubProfilePaintArray(Paint[] aPaintArray)
aPaintArray
- configures which Paint should be used for each sub-profile.
The first element is used for the first subProfile, and so on. If the sub-profile index
is outside this array, the default setSubProfilePaint(java.awt.Paint)
is used.public void setMainProfileLabelArray(String[] aLabelArray)
setPointFormat(java.text.Format)
is a more convenient way to define the labels for these points.aLabelArray
- an array of Strings containing a label for every
main-profile point.paintPointLabel(java.awt.Graphics, com.luciad.view.vertical.TLcdVVJPanel, int, int, int)
,
setPointFormat(java.text.Format)
public void setMainProfileLabelPaint(Paint aLabelPaint)
aLabelPaint
- the Paint to use when painting labels for the main profile points,
or null if no Paint should be configuredpublic Paint getMainProfileLabelPaint()
public Format getPointFormat()
configured
labels are displayed.
The default value is null.paintPointLabel(java.awt.Graphics, com.luciad.view.vertical.TLcdVVJPanel, int, int, int)
public void setPointFormat(Format aPointFormat)
configured labels
.aPointFormat
- the format to display labels for the points.paintPointLabel(java.awt.Graphics, TLcdVVJPanel, int, int, int)
,
setMainProfileLabelArray(String[])
public Paint getSubProfilePaint()
setSubProfilePaint(java.awt.Paint)
public Paint[] getSubProfilePaintArray()
public void setProfileStroke(Stroke aStroke)
public Stroke getProfileStroke()
setProfileStroke(java.awt.Stroke)
public void setPointIcon(ILcdIcon aIcon)
ILcdIcon
for the main-profile-points.public void setMainProfileRenderingMode(int aMode)
aMode
- see constants defined in ILcdVVRenderer
public int getMainProfileRenderingMode()
setMainProfileRenderingMode(int)
public void setSubProfileRenderingMode(int aMode)
aMode
- see constants defined in ILcdVVRenderer
public int getSubProfileRenderingMode()
setSubProfileRenderingMode(int)
public void setSubProfileRenderingMode(int[] aModeArray)
aModeArray
- this array contains the values for the mode for all the
sub-profiles. See constants defined in ILcdVVRenderer
public boolean isAntiAliasing()
setAntiAliasing(boolean)
public void setAntiAliasing(boolean aAntiAliasing)
aAntiAliasing
- if true
, uses anti-aliasing when paintingisAntiAliasing()
public ILcdIcon getPointIcon(int aPointIndex)
public Dimension getPointIconDimension(int aIndex)
getPointIconDimension
in interface ILcdVVRenderer
aIndex
- the point index within the main profile.public int getRenderingMode()
getRenderingMode
in interface ILcdVVRenderer
public void drawProfileLine(Graphics aGraphics, TLcdVVJPanel aVV, int aState, int aSegmentIndex, int aX1, int aY1, int aX2, int aY2)
ILcdVVRenderer
drawProfileLine
in interface ILcdVVRenderer
aGraphics
- the graphics to paint the line on.aVV
- the source object of this call.aState
- Not used yetaSegmentIndex
- The segment index within the main-profile.aX1
- the X-coordinate of the start of the line.aY1
- the Y-coordinate of the start of the line.aX2
- the X-coordinate of the end of the line.aY2
- the Y-coordinate of the end of the line.public void paintYAxisParallelLine(Graphics aGraphics, TLcdVVJPanel aVV, int aPointIndex, int aX, Rectangle aBounds)
ILcdVVRenderer
paintYAxisParallelLine
in interface ILcdVVRenderer
aGraphics
- the graphics to paint onaVV
- the source of this callaPointIndex
- the point index of the main profileaX
- the X position on the screenaBounds
- the location
of this bounds
is positioned on the screen coordinate that has the X of the first point on the grid
and the Y value of altitude of the point with the given index on the main profile.
The width is equal to the portion between the first X on the grid and the last X on the grid.
The height is equal to the portion between the lowest grid line and
the main profile point.public int getSubProfileRenderingMode(int aSubProfileIndex)
getSubProfileRenderingMode
in interface ILcdVVRenderer
aSubProfileIndex
- the index of the sub-profile.public void drawSubProfileLine(Graphics aGraphics, TLcdVVJPanel aVV, int aState, int aRenderingMode, int aSubProfileStepIndex, int aSegmentIndex, int aSubProfileIndex, int aX1, int aY1, int aX2, int aY2)
drawSubProfileLine
in interface ILcdVVRenderer
aGraphics
- the graphics to paint the line of the profile on.aState
- Not used yetaRenderingMode
- See constants defined in this interfaceaSubProfileStepIndex
- The segment-index of the subprofile. Can go
from zero until ILcdVVModel.subProfilePointCount(int, int)
- 2.aSegmentIndex
- The segment index within the main-profile.aSubProfileIndex
- the index of the sub-profile.aX1
- the X-coordinate of the start of the line.aY1
- the Y-coordinate of the start of the line.aX2
- the X-coordinate of the end of the line.aY2
- the Y-coordinate of the end of the line.public void fillSubProfileStepPolygon(Graphics aGraphics, TLcdVVJPanel aVV, int aState, int aRenderingMode, int aSubProfileStepIndex, int aSegmentIndex, int aSubProfileIndex, int[] aXArray, int[] aYArray)
fillSubProfileStepPolygon
in interface ILcdVVRenderer
aGraphics
- the graphics to paint on.aState
- Not used yetaRenderingMode
- See constants defined in this interfaceaSubProfileStepIndex
- The segment-index of the subprofile. Can go
from zero until ILcdVVModel.subProfilePointCount(int, int)
- 2.aSegmentIndex
- The segment index within the main-profile.aSubProfileIndex
- the index of the sub-profile.aXArray
- an array of int
that contains the X-values of the
points of the polygon in clockwise direction.aYArray
- an array of int
that contains the Y-values of the
points of the polygon in clockwise direction.public void paintPointLabel(Graphics g, TLcdVVJPanel aVerticalView, int aPointIndex, int aXPos, int aYPos)
ILcdVVRenderer
paintPointLabel
in interface ILcdVVRenderer
g
- the graphics to paint label of the point on.aXPos
- the X-coordinate of the point.aYPos
- the Y-coordinate of the point.public void paintVerticalCursor(Graphics aGraphics, TLcdVVJPanel aVV, int aCurrentXPosition, int aYOffset, int aHeight, int aLeftPointIndex, int aRightPointIndex, int aMouseY, double aPercentage)
ILcdVVRenderer
paintVerticalCursor
in interface ILcdVVRenderer
aGraphics
- the graphics to paint the vertical cursor on.aCurrentXPosition
- The position on aGraphics where the cursor
should be drawn.aYOffset
- The position indicating the top Y position for the cursor.aHeight
- The amount of pixels in the Y dimension.aLeftPointIndex
- The main profile point on the left of the cursor.aRightPointIndex
- The main profile point on the right of the cursor.aMouseY
- The Y value indicating where the mouse was last located
(while dragging of the cursor occurred). Can be useful
for painting the label on the cursor. Will be -1
if no dragging has appeared yet.aPercentage
- If the total delta between left and right point is 1, then
this ratio indicates the cursor's new position relative
to the first point.