public abstract class AbstractAxisRenderer2D extends java.lang.Object implements AxisRenderer, java.io.Serializable
Abstract class that provides function for rendering axes in two-dimensional space.
Functionality includes:
Constructor and Description |
---|
AbstractAxisRenderer2D()
Initializes a new instance with default settings.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
createTicks(java.util.List<Tick> ticks,
Axis axis,
double min,
double max,
java.util.Set<java.lang.Double> tickPositions,
boolean isAutoSpacing)
Adds minor and major ticks to a list of ticks.
|
protected void |
createTicksCustom(java.util.List<Tick> ticks,
Axis axis,
double min,
double max,
java.util.Set<java.lang.Double> tickPositions)
Adds custom ticks to a list of ticks.
|
protected void |
evaluateShape(java.awt.Shape shape)
Calculates important aspects of the specified shape.
|
java.util.Map<java.lang.Double,java.lang.String> |
getCustomTicks()
Returns custom ticks with their respective position and label.
|
java.lang.Number |
getIntersection()
Returns the intersection point of the axis.
|
java.lang.String |
getLabel()
Returns the label text of the axis.
|
java.awt.Paint |
getLabelColor()
Returns the paint used to draw the axis label.
|
double |
getLabelDistance()
Returns the distance from the axis to the label.
|
java.awt.Font |
getLabelFont()
Returns the font used to display the axis label text.
|
double |
getLabelRotation()
Returns the rotation of the axis label.
|
double |
getMinorTickAlignment()
Returns the alignment of minor ticks.
0.0 means outside the plotting area, 0.5 means centered on the axis,
1.0 means inside the plotting area.
|
java.awt.Paint |
getMinorTickColor()
Returns the paint used to draw the shapes of minor ticks.
|
double |
getMinorTickLength()
Returns the length of minor tick strokes.
|
int |
getMinorTicksCount()
Returns the count of minor ticks.
|
java.awt.Stroke |
getMinorTickStroke()
Returns the stroke used to draw all minor ticks.
|
PointND<java.lang.Double> |
getNormal(Axis axis,
java.lang.Number value,
boolean extrapolate,
boolean forceLinear)
Returns the normal vector at the position of the specified value.
|
PointND<java.lang.Double> |
getPosition(Axis axis,
java.lang.Number value,
boolean extrapolate,
boolean forceLinear)
Returns the position of the specified value on the axis.
|
Drawable |
getRendererComponent(Axis axis)
Returns a component that displays the specified axis.
|
java.awt.Shape |
getShape()
Returns the shape of the axis.
|
java.awt.Paint |
getShapeColor()
Returns the paint used to draw the axis, its ticks and its labels.
|
protected double |
getShapeLength()
Returns the length of the shape path which is used to render axes.
|
java.awt.Stroke |
getShapeStroke()
Returns the stroke which defines the shape of the axis.
|
protected Tick |
getTick(Tick.TickType type,
Axis axis,
double tickPositionWorld)
Returns the point of the tick mark (in pixel coordinates) on the
specified axis with the specified value.
|
double |
getTickAlignment()
Returns the alignment of major ticks relative to the axis.
0.0 means outside the plotting area, 0.5 means centered on the axis,
1.0 means inside the plotting area.
|
java.awt.Paint |
getTickColor()
Returns the paint used to draw the shapes of major ticks.
|
java.awt.Font |
getTickFont()
Returns the font used to display the text of major ticks.
|
double |
getTickLabelDistance()
Returns the distance of labels to their ticks.
|
protected double |
getTickLabelDistanceAbsolute()
Returns the absolute distance between ticks and labels.
|
java.text.Format |
getTickLabelFormat()
Returns the format which converts the tick values to labels.
|
double |
getTickLabelRotation()
Returns the rotation of the tick labels.
|
double |
getTickLength()
Returns the length of major tick strokes.
|
protected double |
getTickLengthAbsolute()
Returns the absolute length of a major tick.
|
protected double |
getTickMinorLengthAbsolute()
Returns the absolute length of a minor tick.
|
java.util.List<Tick> |
getTicks(Axis axis)
Returns a list of all tick element on the axis.
|
java.lang.Number |
getTickSpacing()
Returns the interval for major ticks.
|
java.awt.Stroke |
getTickStroke()
Returns the stroke which is used to draw all major ticks.
|
boolean |
isMinorTicksVisible()
Returns whether minor ticks are drawn.
|
boolean |
isShapeDirectionSwapped()
Returns whether the axis direction is changed.
|
boolean |
isShapeNormalOrientationClockwise()
Returns whether the normal vector of the shape is calculated using
clockwise or counterclockwise rotation.
|
boolean |
isShapeVisible()
Returns whether the shape of the axis will be drawn.
|
boolean |
isTickLabelsOutside()
Returns whether the tick labels are drawn outside of the plot.
|
boolean |
isTickLabelsVisible()
Returns whether tick labels will be shown.
|
boolean |
isTicksAutoSpaced()
Returns whether the interval for major and minor ticks is chosen automatically.
|
boolean |
isTicksVisible()
Returns whether major ticks are drawn.
|
void |
setCustomTicks(java.util.Map<java.lang.Double,java.lang.String> positionsAndLabels)
Sets custom ticks with their respective position and label.
|
void |
setIntersection(java.lang.Number intersection)
Sets the intersection point of the axis.
|
void |
setLabel(java.lang.String label)
Sets the label text of the axis.
|
void |
setLabelColor(java.awt.Paint color)
Sets the paint used to draw the axis label.
|
void |
setLabelDistance(double distance)
Sets the distance from the axis to the label.
|
void |
setLabelFont(java.awt.Font font)
Sets the font used to display the axis label text.
|
void |
setLabelRotation(double angle)
Sets the rotation of the axis label.
|
void |
setMinorTickAlignment(double alignment)
Sets the alignment of minor ticks.
0.0 means outside the plotting area, 0.5 means centered on the axis,
1.0 means inside the plotting area.
|
void |
setMinorTickColor(java.awt.Paint color)
Sets the paint used to draw the shapes of minor ticks.
|
void |
setMinorTickLength(double length)
Sets the length of minor tick strokes.
|
void |
setMinorTicksCount(int count)
Sets the count of minor ticks.
|
void |
setMinorTickStroke(java.awt.Stroke stroke)
Sets the stroke used to draw all minor ticks.
|
void |
setMinorTicksVisible(boolean minorTicksVisible)
Sets whether minor ticks are drawn.
|
void |
setShape(java.awt.Shape shape)
Sets the shape of the axis.
|
void |
setShapeColor(java.awt.Paint color)
Sets the paint used to draw the axis, its ticks and its labels.
|
void |
setShapeDirectionSwapped(boolean directionSwapped)
Sets whether the axis direction will be changed.
|
void |
setShapeNormalOrientationClockwise(boolean clockwise)
Sets whether the normal vector of the shape is calculated using
clockwise or counterclockwise rotation.
|
void |
setShapeStroke(java.awt.Stroke stroke)
Sets the stroke which defines the shape of the axis.
|
void |
setShapeVisible(boolean shapeVisible)
Sets whether the shape of the axis will be drawn.
|
void |
setTickAlignment(double alignment)
Sets the alignment of major ticks relative to the axis.
0.0 means outside the plotting area, 0.5 means centered on the axis,
1.0 means inside the plotting area.
|
void |
setTickColor(java.awt.Paint color)
Sets the paint used to draw the shapes of major ticks.
|
void |
setTickFont(java.awt.Font font)
Sets the font used to display the text of major ticks.
|
void |
setTickLabelDistance(double distance)
Sets the distance of labels to their ticks.
|
void |
setTickLabelFormat(java.text.Format format)
Sets the format which converts the tick values to labels.
|
void |
setTickLabelRotation(double angle)
Sets the rotation of the tick labels.
|
void |
setTickLabelsOutside(boolean labelsOutside)
Sets whether the tick labels are drawn outside of the plot.
|
void |
setTickLabelsVisible(boolean tickLabelsVisible)
Sets whether tick labels will be shown.
|
void |
setTickLength(double length)
Sets the length of major tick strokes.
|
void |
setTicksAutoSpaced(boolean autoSpaced)
Sets whether the interval for major and minor ticks is chosen automatically.
|
void |
setTickSpacing(java.lang.Number spacing)
Sets the interval for major ticks.
|
void |
setTickStroke(java.awt.Stroke stroke)
Sets the stroke which is used to draw all major ticks.
|
void |
setTicksVisible(boolean ticksVisible)
Sets whether major ticks will be drawn.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
viewToWorld, worldToView
public AbstractAxisRenderer2D()
public Drawable getRendererComponent(Axis axis)
getRendererComponent
in interface AxisRenderer
axis
- axis to be displayedAxis
public java.util.List<Tick> getTicks(Axis axis)
getTicks
in interface AxisRenderer
axis
- AxisTick
instancesprotected double getTickLengthAbsolute()
protected double getTickMinorLengthAbsolute()
protected double getTickLabelDistanceAbsolute()
protected abstract void createTicks(java.util.List<Tick> ticks, Axis axis, double min, double max, java.util.Set<java.lang.Double> tickPositions, boolean isAutoSpacing)
ticks
- List of ticksaxis
- Axismin
- Minimum value of axismax
- Maximum value of axistickPositions
- Set of tick positionsisAutoSpacing
- Use automatic scalingprotected void createTicksCustom(java.util.List<Tick> ticks, Axis axis, double min, double max, java.util.Set<java.lang.Double> tickPositions)
ticks
- List of ticksaxis
- Axismin
- Minimum value of axismax
- Maximum value of axistickPositions
- Set of tick positionsprotected Tick getTick(Tick.TickType type, Axis axis, double tickPositionWorld)
type
- Type of tick mark.axis
- Axis containing the tick mark.tickPositionWorld
- Displayed value on the axis.public PointND<java.lang.Double> getNormal(Axis axis, java.lang.Number value, boolean extrapolate, boolean forceLinear)
getNormal
in interface AxisRenderer
axis
- Axisvalue
- World coordinate value to convertextrapolate
- Option to activate extrapolation value that are not
on the axisforceLinear
- Force linear interpolation.protected double getShapeLength()
public PointND<java.lang.Double> getPosition(Axis axis, java.lang.Number value, boolean extrapolate, boolean forceLinear)
getPosition
in interface AxisRenderer
axis
- Axisvalue
- World coordinate value to convertextrapolate
- Option to activate extrapolation value that are not
on the axisforceLinear
- Force linear interpolation.protected final void evaluateShape(java.awt.Shape shape)
shape
- Shape to be evaluated.public java.lang.Number getIntersection()
AxisRenderer
getIntersection
in interface AxisRenderer
public void setIntersection(java.lang.Number intersection)
AxisRenderer
setIntersection
in interface AxisRenderer
intersection
- Point at which this axis intersects other axes.public java.awt.Shape getShape()
AxisRenderer
getShape
in interface AxisRenderer
public void setShape(java.awt.Shape shape)
AxisRenderer
setShape
in interface AxisRenderer
shape
- Shape used for drawing.public boolean isShapeVisible()
AxisRenderer
isShapeVisible
in interface AxisRenderer
true
if the shape should be drawn, false otherwise.public void setShapeVisible(boolean shapeVisible)
AxisRenderer
setShapeVisible
in interface AxisRenderer
shapeVisible
- true
if the shape should be drawn, false otherwise.public boolean isShapeNormalOrientationClockwise()
AxisRenderer
isShapeNormalOrientationClockwise
in interface AxisRenderer
true
if the orientation is clockwise, false
if it is
counterclockwise.public void setShapeNormalOrientationClockwise(boolean clockwise)
AxisRenderer
setShapeNormalOrientationClockwise
in interface AxisRenderer
clockwise
- true
if the orientation is clockwise,
false
if it is counterclockwise.public java.awt.Paint getShapeColor()
AxisRenderer
getShapeColor
in interface AxisRenderer
public void setShapeColor(java.awt.Paint color)
AxisRenderer
setShapeColor
in interface AxisRenderer
color
- Paint used for drawing.public java.awt.Stroke getShapeStroke()
AxisRenderer
getShapeStroke
in interface AxisRenderer
public void setShapeStroke(java.awt.Stroke stroke)
AxisRenderer
setShapeStroke
in interface AxisRenderer
stroke
- Stroke used for drawing the shape.public boolean isShapeDirectionSwapped()
AxisRenderer
isShapeDirectionSwapped
in interface AxisRenderer
true
if the shape of the axis is inverted,
false
otherwise.public void setShapeDirectionSwapped(boolean directionSwapped)
AxisRenderer
setShapeDirectionSwapped
in interface AxisRenderer
directionSwapped
- true
if the shape of the axis
should be inverted, false
otherwise.public boolean isTicksVisible()
AxisRenderer
isTicksVisible
in interface AxisRenderer
true
if major ticks are drawn, false
otherwise.public void setTicksVisible(boolean ticksVisible)
AxisRenderer
setTicksVisible
in interface AxisRenderer
ticksVisible
- true
if major ticks should be drawn,
false
otherwise.public java.lang.Number getTickSpacing()
AxisRenderer
getTickSpacing
in interface AxisRenderer
public void setTickSpacing(java.lang.Number spacing)
AxisRenderer
setTickSpacing
in interface AxisRenderer
spacing
- Distance on axis in which major ticks are drawn.public boolean isTicksAutoSpaced()
AxisRenderer
isTicksAutoSpaced
in interface AxisRenderer
true
if auto-spacing is enabled, false
otherwise.public void setTicksAutoSpaced(boolean autoSpaced)
AxisRenderer
setTicksAutoSpaced
in interface AxisRenderer
autoSpaced
- true
if auto-spacing is enabled, false
otherwise.public double getTickLength()
AxisRenderer
getTickLength
in interface AxisRenderer
public void setTickLength(double length)
AxisRenderer
setTickLength
in interface AxisRenderer
length
- Tick length relative to the font height.public java.awt.Stroke getTickStroke()
AxisRenderer
getTickStroke
in interface AxisRenderer
public void setTickStroke(java.awt.Stroke stroke)
AxisRenderer
setTickStroke
in interface AxisRenderer
stroke
- Stroke used for major tick drawing.public double getTickAlignment()
AxisRenderer
getTickAlignment
in interface AxisRenderer
public void setTickAlignment(double alignment)
AxisRenderer
setTickAlignment
in interface AxisRenderer
alignment
- Major tick alignment relative to the axis.public java.awt.Font getTickFont()
AxisRenderer
getTickFont
in interface AxisRenderer
public void setTickFont(java.awt.Font font)
AxisRenderer
setTickFont
in interface AxisRenderer
font
- Font used for tick labels.public java.awt.Paint getTickColor()
AxisRenderer
getTickColor
in interface AxisRenderer
public void setTickColor(java.awt.Paint color)
AxisRenderer
setTickColor
in interface AxisRenderer
color
- Paint used for major tick drawing.public boolean isTickLabelsVisible()
AxisRenderer
isTickLabelsVisible
in interface AxisRenderer
true
if tick labels will be drawn, false
otherwise.public void setTickLabelsVisible(boolean tickLabelsVisible)
AxisRenderer
setTickLabelsVisible
in interface AxisRenderer
tickLabelsVisible
- true
if tick labels will be drawn, false
otherwise.public java.text.Format getTickLabelFormat()
AxisRenderer
getTickLabelFormat
in interface AxisRenderer
public void setTickLabelFormat(java.text.Format format)
AxisRenderer
setTickLabelFormat
in interface AxisRenderer
format
- Format used for tick labels.public double getTickLabelDistance()
AxisRenderer
getTickLabelDistance
in interface AxisRenderer
public void setTickLabelDistance(double distance)
AxisRenderer
setTickLabelDistance
in interface AxisRenderer
distance
- Label distance relative to the font height.public boolean isTickLabelsOutside()
AxisRenderer
isTickLabelsOutside
in interface AxisRenderer
true
if the labels are drawn outside of the plot, false
otherwise.public void setTickLabelsOutside(boolean labelsOutside)
AxisRenderer
setTickLabelsOutside
in interface AxisRenderer
labelsOutside
- true
if the labels are drawn outside of the plot,
false
otherwise.public double getTickLabelRotation()
AxisRenderer
getTickLabelRotation
in interface AxisRenderer
public void setTickLabelRotation(double angle)
AxisRenderer
setTickLabelRotation
in interface AxisRenderer
angle
- Tick label rotation in degrees.public boolean isMinorTicksVisible()
AxisRenderer
isMinorTicksVisible
in interface AxisRenderer
true
if minor ticks are drawn, false
otherwise.public void setMinorTicksVisible(boolean minorTicksVisible)
AxisRenderer
setMinorTicksVisible
in interface AxisRenderer
minorTicksVisible
- true
if minor ticks are drawn, false
otherwise.public int getMinorTicksCount()
AxisRenderer
getMinorTicksCount
in interface AxisRenderer
public void setMinorTicksCount(int count)
AxisRenderer
setMinorTicksCount
in interface AxisRenderer
count
- Number of minor ticks between two major ticks.public double getMinorTickLength()
AxisRenderer
getMinorTickLength
in interface AxisRenderer
public void setMinorTickLength(double length)
AxisRenderer
setMinorTickLength
in interface AxisRenderer
length
- Tick length relative to font height.public java.awt.Stroke getMinorTickStroke()
AxisRenderer
getMinorTickStroke
in interface AxisRenderer
public void setMinorTickStroke(java.awt.Stroke stroke)
AxisRenderer
setMinorTickStroke
in interface AxisRenderer
stroke
- Stroke used for minor tick drawing.public double getMinorTickAlignment()
AxisRenderer
getMinorTickAlignment
in interface AxisRenderer
public void setMinorTickAlignment(double alignment)
AxisRenderer
setMinorTickAlignment
in interface AxisRenderer
alignment
- Minor tick alignment relative to the axis.public java.awt.Paint getMinorTickColor()
AxisRenderer
getMinorTickColor
in interface AxisRenderer
public void setMinorTickColor(java.awt.Paint color)
AxisRenderer
setMinorTickColor
in interface AxisRenderer
color
- Paint used for minor tick drawing.public java.util.Map<java.lang.Double,java.lang.String> getCustomTicks()
AxisRenderer
getCustomTicks
in interface AxisRenderer
public void setCustomTicks(java.util.Map<java.lang.Double,java.lang.String> positionsAndLabels)
AxisRenderer
setCustomTicks
in interface AxisRenderer
positionsAndLabels
- A map of custom tick positions and labels.public java.lang.String getLabel()
AxisRenderer
getLabel
in interface AxisRenderer
public void setLabel(java.lang.String label)
AxisRenderer
setLabel
in interface AxisRenderer
label
- Axis label.public double getLabelDistance()
AxisRenderer
getLabelDistance
in interface AxisRenderer
public void setLabelDistance(double distance)
AxisRenderer
setLabelDistance
in interface AxisRenderer
distance
- Distance relative to font height.public double getLabelRotation()
AxisRenderer
getLabelRotation
in interface AxisRenderer
public void setLabelRotation(double angle)
AxisRenderer
setLabelRotation
in interface AxisRenderer
angle
- Axis label rotation in degrees.public java.awt.Font getLabelFont()
AxisRenderer
getLabelFont
in interface AxisRenderer
public void setLabelFont(java.awt.Font font)
AxisRenderer
setLabelFont
in interface AxisRenderer
font
- Font for axis label text.public java.awt.Paint getLabelColor()
AxisRenderer
getLabelColor
in interface AxisRenderer
public void setLabelColor(java.awt.Paint color)
AxisRenderer
setLabelColor
in interface AxisRenderer
color
- Paint for axis label drawing.