public abstract class AbstractAxisRenderer2D extends BasicSettingsStorage implements AxisRenderer, SettingsListener
Abstract class that provides function for rendering axes in two-dimensional space.
Functionality includes:
INTERSECTION, LABEL, LABEL_COLOR, LABEL_DISTANCE, LABEL_FONT, LABEL_ROTATION, SHAPE, SHAPE_COLOR, SHAPE_DIRECTION_SWAPPED, SHAPE_NORMAL_ORIENTATION_CLOCKWISE, SHAPE_STROKE, SHAPE_VISIBLE, TICK_LABELS, TICK_LABELS_DISTANCE, TICK_LABELS_FORMAT, TICK_LABELS_OUTSIDE, TICK_LABELS_ROTATION, TICKS, TICKS_ALIGNMENT, TICKS_AUTO_SPACING, TICKS_COLOR, TICKS_CUSTOM, TICKS_FONT, TICKS_LENGTH, TICKS_MINOR, TICKS_MINOR_ALIGNMENT, TICKS_MINOR_COLOR, TICKS_MINOR_COUNT, TICKS_MINOR_LENGTH, TICKS_MINOR_STROKE, TICKS_SPACING, TICKS_STROKE
Constructor and Description |
---|
AbstractAxisRenderer2D()
Initializes a new instance with default settings.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
createTicks(List<Tick> ticks,
Axis axis,
double min,
double max,
Set<Double> tickPositions,
boolean isAutoSpacing)
Adds minor and major ticks to a list of ticks.
|
protected void |
createTicksCustom(List<Tick> ticks,
Axis axis,
double min,
double max,
Set<Double> tickPositions)
Adds custom ticks to a list of ticks.
|
protected void |
evaluateShape(Shape shape)
Calculates important aspects of the specified shape.
|
PointND<Double> |
getNormal(Axis axis,
Number value,
boolean extrapolate,
boolean forceLinear)
Returns the normal vector at the position of the specified value.
|
PointND<Double> |
getPosition(Axis axis,
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.
|
protected double |
getShapeLength()
Returns the length of the shape path which is used to render axes.
|
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.
|
List<Tick> |
getTicks(Axis axis)
Returns a list of all tick element on the axis.
|
void |
settingChanged(SettingChangeEvent event)
Invoked if a setting has changed.
|
addSettingsListener, getSetting, hasSetting, hasSettingDefault, notifySettingChanged, removeSetting, removeSettingDefault, removeSettingsListener, setSetting, setSetting, setSettingDefault
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
viewToWorld, worldToView
getSetting, removeSetting, removeSettingDefault, setSetting, setSettingDefault
public AbstractAxisRenderer2D()
public Drawable getRendererComponent(Axis axis)
getRendererComponent
in interface AxisRenderer
axis
- axis to be displayedAxis
public List<Tick> getTicks(Axis axis)
getTicks
in interface AxisRenderer
axis
- AxisTick
instancesprotected abstract void createTicks(List<Tick> ticks, Axis axis, double min, double max, Set<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(List<Tick> ticks, Axis axis, double min, double max, Set<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<Double> getNormal(Axis axis, 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<Double> getPosition(Axis axis, 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 void evaluateShape(Shape shape)
shape
- Shape to be evaluated.public void settingChanged(SettingChangeEvent event)
settingChanged
in interface SettingsListener
event
- Event containing information about the changed setting.Copyright © 2009-2013. All Rights Reserved.