Q
- public class AxisRenderer2D<Q> extends AxisRenderer<Q> implements DataUnitsTransformer<Q,Double,double[]>
Modifier and Type | Field and Description |
---|---|
protected double |
axisLength
Desired size of the axis in pixels
|
config
Constructor and Description |
---|
AxisRenderer2D()
Default constructor
|
AxisRenderer2D(AxisConfig<Q> conf)
Constructor to set the config
|
Modifier and Type | Method and Description |
---|---|
double[] |
calculatePosition(Double units)
For a given coordinate in the units of the data, will calculate
the render coordinates
|
Double |
calculateUnitsAt(double[] position)
Calculates the data unit coordinate at the given render coordinates
|
void |
drawAxis(AxisConfig<Q> config)
Draw the major axis
|
void |
drawAxisLabel(AxisConfig<Q> config)
Draw the axis label
|
void |
drawMajorTick(double location,
AxisConfig<Q> config)
Draw a tick on the axis at the given location
|
void |
drawMajorTickGridline(double location,
AxisConfig<Q> config)
Draw a major grid line on the vis
|
void |
drawMinorTick(double location,
AxisConfig<Q> config)
Draw a minor tick on the axis
|
void |
drawMinorTickGridline(double location,
AxisConfig<Q> config)
Draw a minor grid on the vis
|
double |
getAxisLength() |
AxisConfig<Q> |
getConfig() |
double |
getCurrentScale() |
Image<Q,?> |
getImage() |
static void |
main(String[] args)
Simple test
|
void |
precalc()
Perform any precalculations that will allow the axes to
be drawn faster, or to allow the data transformer to work.
|
double[] |
scaleDimension(Double dimension)
Given a specific data dimension, calculates a render dimension.
|
void |
setAxisLength(double axisLength) |
void |
setConfig(AxisConfig<Q> config) |
void |
setImage(Image<Q,?> image) |
nearestHigherMajorTick, nearestLowerMajorTick, renderAxis
protected double axisLength
public AxisRenderer2D()
public AxisRenderer2D(AxisConfig<Q> conf)
conf
- The configpublic double[] scaleDimension(Double dimension)
DataUnitsTransformer
scaleDimension
in interface DataUnitsTransformer<Q,Double,double[]>
dimension
- The units/data dimensionpublic void precalc()
AxisRenderer
precalc
in interface DataUnitsTransformer<Q,Double,double[]>
precalc
in class AxisRenderer<Q>
public void drawAxis(AxisConfig<Q> config)
drawAxis
in class AxisRenderer<Q>
config
- The axis configurationAxisRenderer.drawAxis(org.openimaj.vis.general.AxisConfig)
public void drawAxisLabel(AxisConfig<Q> config)
drawAxisLabel
in class AxisRenderer<Q>
config
- The axis configurationAxisRenderer.drawAxisLabel(org.openimaj.vis.general.AxisConfig)
public void drawMajorTick(double location, AxisConfig<Q> config)
drawMajorTick
in class AxisRenderer<Q>
location
- The location (in data units)config
- The configAxisRenderer.drawMajorTick(double, org.openimaj.vis.general.AxisConfig)
public void drawMajorTickGridline(double location, AxisConfig<Q> config)
drawMajorTickGridline
in class AxisRenderer<Q>
location
- The location (in data units)config
- The configAxisRenderer.drawMajorTickGridline(double, org.openimaj.vis.general.AxisConfig)
public void drawMinorTick(double location, AxisConfig<Q> config)
drawMinorTick
in class AxisRenderer<Q>
location
- The location (in data units)config
- The configurationAxisRenderer.drawMinorTick(double, org.openimaj.vis.general.AxisConfig)
public void drawMinorTickGridline(double location, AxisConfig<Q> config)
drawMinorTickGridline
in class AxisRenderer<Q>
location
- The location (in data units)config
- The axis configurationAxisRenderer.drawMinorTickGridline(double, org.openimaj.vis.general.AxisConfig)
public double getAxisLength()
public void setAxisLength(double axisLength)
axisLength
- the axisLength to setpublic double[] calculatePosition(Double units)
calculatePosition
in interface DataUnitsTransformer<Q,Double,double[]>
units
- The unit to convert to render coordinatesDataUnitsTransformer.calculatePosition(java.lang.Object)
public Double calculateUnitsAt(double[] position)
calculateUnitsAt
in interface DataUnitsTransformer<Q,Double,double[]>
position
- The data rendered position to convertDataUnitsTransformer.calculateUnitsAt(java.lang.Object)
public double getCurrentScale()
public AxisConfig<Q> getConfig()
getConfig
in class AxisRenderer<Q>
public void setConfig(AxisConfig<Q> config)
setConfig
in class AxisRenderer<Q>
config
- the config to set