|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.monitorenter.gui.chart.axis.AAxis.AChart2DDataAccessor
public abstract class AAxis.AChart2DDataAccessor
An internal connector class that will connect the axis to the a Chart2D.
It is aggregated to the AAxis
in order to access either y values or
x values of the Chart2D thus making the IAxis an Y Axis or X axis. This
strategy reduces redundant code for label creation. It avoids complex
inheritance / interface implements for different IAxis implementation that
would be necessary for y-axis / x-axis implementations.
Field Summary | |
---|---|
protected Chart2D |
m_chart
The chart that is accessed. |
Constructor Summary | |
---|---|
protected |
AAxis.AChart2DDataAccessor(Chart2D chart)
Constructor with the chart that is accessed. |
Method Summary | |
---|---|
Chart2D |
getChart()
Returns the chart that is accessed. |
abstract int |
getDimension()
Returns the constant for the dimension that is accessed on the chart. |
abstract int |
getHeight(java.awt.Graphics g2d)
Returns the height in pixel the corresponding axis needs to paint itself. |
protected abstract double |
getMaximumPixelForLabel(java.awt.Graphics g2d)
Returns the maximum pixels that will be needed to paint a label. |
protected abstract double |
getMaxValue(ITrace2D trace)
Returns the max value of the given trace according to the dimension the outer axis belongs to. |
abstract double |
getMinimumValueDistanceForLabels(java.awt.Graphics g2d)
Returns the minimum amount of increase in the value that will be needed to display all labels without overwriting each others. |
protected abstract double |
getMinValue(ITrace2D trace)
Returns the min value of the given trace according to the dimension the outer axis belongs to. |
protected abstract int |
getPixelRange()
Returns the amount of pixel available for displaying the values on the chart in the dimension this accessor stands for. |
protected abstract double |
getValue(ITracePoint2D point)
Returns the value of the given point according to the dimension the outer axis belongs to. |
protected abstract double |
getValueDistanceForPixel(int pixel)
Returns the value distance on the current chart that exists for the given amount of pixel distance in the given direction of this AAxis . |
abstract int |
getWidth(java.awt.Graphics g2d)
Returns the width in pixel the corresponding axis needs to paint itself. |
protected abstract void |
scaleTrace(ITrace2D trace,
Range range)
Scales the given trace in the dimension represented by this axis. |
abstract double |
translateMousePosition(java.awt.event.MouseEvent mouseEvent)
Returns the translation of the mouse event coordinates of the given mouse event to the value within the chart for the dimension (x,y) covered by this axis. |
abstract double |
translatePxToValue(int pixel)
Transforms the given pixel value (which has to be a awt value like MouseEvent.getX() into the chart value. |
abstract int |
translateValueToPx(double value)
Transforms the given chart data value into the corresponding awt pixel value for the chart. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Chart2D m_chart
Constructor Detail |
---|
protected AAxis.AChart2DDataAccessor(Chart2D chart)
chart
- the chart that is accessed.Method Detail |
---|
public final Chart2D getChart()
public abstract int getDimension()
Chart2D.X
, Chart2D.Y
or -1 if this axis is not
assigned to a chart.public abstract int getHeight(java.awt.Graphics g2d)
This includes the axis line, it's ticks and labels and it's title.
g2d
- needed for font metric information.
protected abstract double getMaximumPixelForLabel(java.awt.Graphics g2d)
g2d
- provides information about the graphics context to paint on
(e.g. font size).
protected abstract double getMaxValue(ITrace2D trace)
This is either an x or an y value depending on the dimension the outer axis is working in.
trace
- the trace to read the maximum of.
public abstract double getMinimumValueDistanceForLabels(java.awt.Graphics g2d)
This procedure needs the amount of pixels needed by the largest possible
label and relies on the implementation of
getMaximumPixelForLabel(Graphics)
, whose result is multiplied
with the "value per pixel" quantifier.
g2d
- the current graphic context to use in case further information
is required.
protected abstract double getMinValue(ITrace2D trace)
This is either an x or an y value depending on the dimension the outer axis is working in.
trace
- the trace to read the maximum of.
protected abstract int getPixelRange()
This method must not be called within the first lines of a paint cycle (necessary underlying values then are computed new).
protected abstract double getValue(ITracePoint2D point)
This is either
or
ITracePoint2D.getX()
.
ITracePoint2D.getY()
point
- the point to read ITracePoint2D.getX()
or
ITracePoint2D.getY()
from.
protected abstract double getValueDistanceForPixel(int pixel)
AAxis
.
Depending on the width of the actual Chart2D and the contained values,
the relation between displayed distances (pixel) and value distances (the
values of the added
instances
changes.
ITrace2D
This method calculates depending on the actual painting area of the
Chart2D, the shift in value between two points that have a screen
distance of the given pixel.
This method is not used by the chart itself but a helper for outside use.
pixel
- The desired distance between to scale points of the x- axis in
pixel.
public abstract int getWidth(java.awt.Graphics g2d)
This includes the axis line, it's ticks and labels and it's title.
g2d
- needed for font metric information.
protected abstract void scaleTrace(ITrace2D trace, Range range)
This method is not deadlock - safe and should be called by the
only!
Chart2D
trace
- the trace to scale.range
- the range to use as scaler.public abstract double translateMousePosition(java.awt.event.MouseEvent mouseEvent)
Note that the mouse event has to be an event fired on this component!
mouseEvent
- a mouse event that has been fired on this component.
public abstract double translatePxToValue(int pixel)
MouseEvent.getX()
into the chart value.
Internal use only, the interface does not guarantee that the pixel corresponds to any valid awt pixel value within the chart component.
Warning: A value transformed to a pixel by
translateValueToPx(double)
and then retransformed by
translatePxToValue(int)
will most often have changed, as the
transformation from value to px a) has to hit an exact int b) most often
will map from a bigger domain (value range) to a smaller one (range of
chart on the screen).
pixel
- a pixel value of the chart component as used by awt.
public abstract int translateValueToPx(double value)
The inverse transformation to translatePxToValue(int)
.
value
- a chart data value.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |