|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.ttools.plot2.Axis
@Equality public abstract class Axis
Does geometry and drawing for a straight line axis.
Linear and logarithmic scales are supported; obtain one using
the createAxis
factory method.
Constructor Summary | |
---|---|
protected |
Axis(int glo,
int ghi,
double dlo,
double dhi)
Constructor. |
Method Summary | |
---|---|
static Axis |
createAxis(int glo,
int ghi,
double dlo,
double dhi,
boolean log,
boolean flip)
Factory method to create a linear or logarithmic axis. |
abstract double[] |
dataPan(double d0,
double d1)
Returns the data bounds that result from performing an axis pan between two given data positions. |
abstract double |
dataToGraphics(double d)
Converts a data coordinate to the graphics position on this axis. |
abstract double[] |
dataZoom(double d0,
double factor)
Returns the data bounds that result from performing an axis zoom about a given data position. |
void |
drawLabels(Tick[] ticks,
String title,
Captioner captioner,
Orientation orient,
boolean invert,
Graphics g)
Draws an axis title and supplied tickmarks. |
double[] |
getDataLimits()
Returns the axis data bounds. |
int[] |
getGraphicsLimits()
Returns the axis graphics bounds. |
Rectangle |
getLabelBounds(Tick[] ticks,
String title,
Captioner captioner,
Orientation orient,
boolean invert)
Determines the bounds for axis and tickmark annotations. |
abstract double |
graphicsToData(double g)
Converts a graphics position on this axis to a data coordinate. |
abstract boolean |
isLinear()
Indicates whether the scaling on this axis is linear. |
static double[] |
pan(double dlo,
double dhi,
double d0,
double d1,
boolean isLog)
Utility method for axis panning. |
static double[] |
zoom(double dlo,
double dhi,
double d0,
double factor,
boolean isLog)
Utility method for axis zooming. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Axis(int glo, int ghi, double dlo, double dhi)
glo
- minimum graphics coordinateghi
- maximum graphics coordinatedlo
- minimum data coordinatedhi
- maximum data coordinateMethod Detail |
---|
public abstract double dataToGraphics(double d)
d
- data coordinate
public abstract double graphicsToData(double g)
g
- graphics coordinate
public abstract double[] dataZoom(double d0, double factor)
d0
- data reference position for zoomfactor
- amount to zoom
public abstract double[] dataPan(double d0, double d1)
d0
- source data positiond1
- destination data position
public int[] getGraphicsLimits()
glo
)
is always strictly less than the second (ghi
).
public double[] getDataLimits()
dlo
)
is always strictly less than the second (dhi
).
public abstract boolean isLinear()
public void drawLabels(Tick[] ticks, String title, Captioner captioner, Orientation orient, boolean invert, Graphics g)
ticks
- tickmark arraytitle
- axis label text, may be nullcaptioner
- text positioning objectorient
- axis orientation codeinvert
- whether to reverse sense of axisg
- graphics contextpublic Rectangle getLabelBounds(Tick[] ticks, String title, Captioner captioner, Orientation orient, boolean invert)
drawLabels(uk.ac.starlink.ttools.plot2.Tick[], java.lang.String, uk.ac.starlink.ttools.plot2.Captioner, uk.ac.starlink.ttools.plot2.Orientation, boolean, java.awt.Graphics)
.
ticks
- tickmark arraytitle
- axis label text, may be nullcaptioner
- text positioning objectorient
- axis orientation codeinvert
- whether to reverse sense of axis
public static Axis createAxis(int glo, int ghi, double dlo, double dhi, boolean log, boolean flip)
glo
- minimum graphics coordinateghi
- maximum graphics coordinatedlo
- minimum data coordinatedhi
- maximum data coordinatelog
- true for logarithmic scaling, false for linearflip
- true if the data coordinates should run
in the opposite sense to the graphics coordinatespublic static double[] pan(double dlo, double dhi, double d0, double d1, boolean isLog)
dlo
- initial axis lower bounddhi
- initial axis upper boundd0
- pan gesture start positiond1
- pan gesture end positionisLog
- false for linear axis, true for logarithmic
public static double[] zoom(double dlo, double dhi, double d0, double factor, boolean isLog)
dlo
- initial axis lower bounddhi
- initial axis upper boundd0
- zoom gesture reference positionfactor
- zoom factorisLog
- false for linear axis, true for logarithmic
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |