|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjview.AbstractFormattingTransform
jview.BasicTransform
public class BasicTransform
This class is a basic morpher in the way that it comprises a linear
mapping in x and y to pixel space starting at 0,0 with an extend of 1x1.
It can be constructed either giving the extend of
the true coordinate space or the true coordinate space with an offset.
The default formatting is done with the default number format instances,
as returned by NumberFormat.getNumberInstance(). It may be changed
with a call to the appropriate set...Format methods.
| Field Summary | |
|---|---|
private double |
ax
For logarithmic means, we pre-calculate this. |
private double |
axf
For logarithmic means, we pre-calculate this. |
private double |
ay
For logarithmic means, we pre-calculate this. |
private double |
ayf
For logarithmic means, we pre-calculate this. |
private double |
kx
For logarithmic means, we pre-calculate this. |
private double |
ky
For logarithmic means, we pre-calculate this. |
private Rectangle2D |
map
All parameters can be piped into a single rectangle. |
private boolean |
xdate
If true, x scale is a date in ms. |
private boolean |
xflip
If true, x-values are flipped. |
private boolean |
xlog
If true, x scales logarithmic. |
private boolean |
ydate
If true, y scale is a date in ms. |
private boolean |
yflip
If true, y-values are flipped (thus showing a mathematical system). |
private boolean |
ylog
If true, y scales logarithmic. |
| Constructor Summary | |
|---|---|
BasicTransform(double xsize,
double ysize)
Constructs a new basic morpher with a given range in x and y direction. |
|
BasicTransform(double xoff,
double yoff,
double xsize,
double ysize)
Constructs a new basic morpher with a given range in x and y direction and appropriate offsets for the 0,0 point. |
|
BasicTransform(Rectangle2D rect)
Constructs a new basic morpher with the basic conversion rectangle. |
|
| Method Summary | |
|---|---|
private Format |
deduceFormat(double size,
boolean date)
From a given size, we try to deduce a good format. |
Format |
estimateX(double xstep)
Tries to approximate an formatter for x, giving a typical length scale. |
Format |
estimateY(double ystep)
Tries to approximate an formatter for x, giving a typical length scale. |
Rectangle2D |
getDefiningRectangle()
Returns the defining rectangle of this morpher. |
Point2D |
invertUserXY(Vector2D xy)
Invertable transform means the x coordinate in the argument translates to an x in normalized coordinates. |
boolean |
setDateX(boolean date)
Sets the x-scale to transform dates. |
boolean |
setDateY(boolean date)
Sets the y-scale to transform dates. |
boolean |
setFlipX(boolean flip)
Sets the flip state in the x coordinate. |
boolean |
setFlipY(boolean flip)
Sets the flip state in the y coordinate. |
boolean |
setLogarithmicX(boolean log)
Sets the x-scale to transform logarithmically. |
boolean |
setLogarithmicY(boolean log)
Sets the y-scale to transform logarithmically. |
Point2D |
toNormalizedDistance(VectorG ignore,
VectorG delta)
In the this simple case, a delta transformation is simply scaled by the boxing rectangle size. |
Point2D |
toNormalizedSpace(VectorG xy)
We map x/y into pixel coordinates, normalized to a top-left point 0,0 and a plottable size of 1x1. |
String |
toString()
Returns the parameter that govern this morpher. |
VectorG |
toUserDistance(Rectangle2D delta)
In the this simple case, a delta transformation is simply scaled by the boxing rectangle size. |
VectorG |
toUserSpace(Point2D ab)
This is the inverse to toNormalizedSpace(vec_math.VectorG). |
void |
useEstimatedFormats(Rectangle2D view,
int xp,
int yp)
Estimates the decimal formatter to use on the axis. |
| Methods inherited from class jview.AbstractFormattingTransform |
|---|
deltaFormatUserSpaceX, deltaFormatUserSpaceY, formatUserCoordinates, formatUserSpaceX, formatUserSpaceY, getFormatUserX, getFormatUserY, setDeltaFormatUserX, setDeltaFormatUserY, setFormatUserX, setFormatUserY |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private Rectangle2D map
private double kx
private double ky
private double ax
private double ay
private double axf
private double ayf
private boolean xflip
private boolean yflip
private boolean xlog
private boolean ylog
private boolean xdate
private boolean ydate
| Constructor Detail |
|---|
public BasicTransform(double xsize,
double ysize)
public BasicTransform(double xoff,
double yoff,
double xsize,
double ysize)
public BasicTransform(Rectangle2D rect)
| Method Detail |
|---|
public boolean setFlipX(boolean flip)
public boolean setFlipY(boolean flip)
public boolean setLogarithmicX(boolean log)
public boolean setLogarithmicY(boolean log)
public boolean setDateX(boolean date)
public boolean setDateY(boolean date)
public Point2D invertUserXY(Vector2D xy)
toNormalizedSpace(vec_math.VectorG) here.
invertUserXY in interface InvertableTransformingpublic Point2D toNormalizedSpace(VectorG xy)
a = (x-xoff)/width
b = (y-yoff)/height,
where xoff and yoff are the upper left coordinates of the underlying
rectangle, width and height is the size.
toNormalizedSpace in interface CoordinateTransformingxy - A vector of user coordinates.
public VectorG toUserSpace(Point2D ab)
toNormalizedSpace(vec_math.VectorG).
Here we transform pixel
coordinates a/b, which must be normalized to a top-left point 0,0
and a plottable size of 1x1, into x/y of the underlying system.
x = xoff+width*a
y = yoff+height*b,
where xoff and yoff are the upper left coordinates of the underlying
rectangle, width and height is the size.
toUserSpace in interface CoordinateTransformingab - A pixel in normalized coordinates.
public VectorG toUserDistance(Rectangle2D delta)
toUserDistance in interface DeltaTransforming
public Point2D toNormalizedDistance(VectorG ignore,
VectorG delta)
toNormalizedDistance in interface DeltaTransforming
public void useEstimatedFormats(Rectangle2D view,
int xp,
int yp)
useEstimatedFormats in interface FormattedTransforminguseEstimatedFormats in class AbstractFormattingTransformpublic Format estimateX(double xstep)
estimateX in interface FormattedTransformingpublic Format estimateY(double ystep)
estimateY in interface FormattedTransformingpublic Rectangle2D getDefiningRectangle()
public String toString()
toString in class Object
private Format deduceFormat(double size,
boolean date)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||