|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectview.BasicMorpher
public class BasicMorpher
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 NumberFormat |
dxprim
A formatter for primary x distances. |
private NumberFormat |
dxsec
A formatter for secondary x distances. |
private NumberFormat |
dyprim
A formatter for primary y distances. |
private NumberFormat |
dysec
A formatter for secondary y distances. |
private Rectangle2D |
map
All parameters can be piped into a single rectangle. |
private NumberFormat |
xprim
A formatter for primary x coordinates. |
private NumberFormat |
xsec
A formatter for secondary x coordinates. |
private NumberFormat |
yprim
A formatter for primary y coordinates. |
private NumberFormat |
ysec
A formatter for secondary y coordinates. |
| Constructor Summary | |
|---|---|
BasicMorpher(double xsize,
double ysize)
Constructs a new basic morpher with a given range in x and y direction. |
|
BasicMorpher(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. |
|
BasicMorpher(Rectangle2D rect)
Constructs a new basic morpher with the basic conversion rectangle. |
|
| Method Summary | |
|---|---|
String |
deltaFormatPrimaryX(double dxprimary)
Formats the x-coordinate difference of a primary x-distance. |
String |
deltaFormatPrimaryY(double dyprimary)
Formats the y-coordinate difference of a primary y-distance. |
String |
deltaFormatSecondaryX(double dxsecondary)
Formats the x-coordinate difference of a secondary x-distance. |
String |
deltaFormatSecondaryY(double dysecondary)
Formats the y-coordinate difference of a secondary y-distance. |
String |
formatPrimaryX(double xprimary)
Formats the x-coordinate of a primary x-coordinate. |
String |
formatPrimaryY(double yprimary)
Formats the y-coordinate of a primary y-coordinate. |
String |
formatSecondaryX(double xsecondary)
Formats the x-coordinate of a secondary x-coordinate. |
String |
formatSecondaryY(double ysecondary)
Formats the y-coordinate of a secondary y-coordinate. |
Rectangle2D |
getDefiningRectangle()
Returns the defining rectangle of this morpher. |
NumberFormat |
getFormatPrimaryX()
Gets the formatter assigned to the primary x coordinate. |
NumberFormat |
getFormatPrimaryY()
Changes the default formatting for the primary y coordinate. |
NumberFormat |
getFormatSecondaryX()
Changes the default formatting for the secondary x coordinate. |
NumberFormat |
getFormatSecondaryY()
Changes the default formatting for the secondary x coordinate. |
void |
setDeltaFormatPrimaryX(NumberFormat nf)
Changes the default formatting for the primary x distance. |
void |
setDeltaFormatPrimaryY(NumberFormat nf)
Changes the default formatting for the primary y distance. |
void |
setDeltaFormatSecondaryX(NumberFormat nf)
Changes the default formatting for the secondary x distance. |
void |
setDeltaFormatSecondaryY(NumberFormat nf)
Changes the default formatting for the secondary y distance. |
void |
setFormatPrimaryX(NumberFormat nf)
Changes the default formatting for the primary x coordinate. |
void |
setFormatPrimaryY(NumberFormat nf)
Changes the default formatting for the primary y coordinate. |
void |
setFormatSecondaryX(NumberFormat nf)
Changes the default formatting for the secondary x coordinate. |
void |
setFormatSecondaryY(NumberFormat nf)
Changes the default formatting for the secondary x coordinate. |
Point2D |
toPrimary(Point2D xy)
We map x/y into pixel coordinates, normalized to a top-left point 0,0 and a plottable size of 1x1. |
Point2D |
toSecondary(Point2D ab)
This is the inverse to toPrimary(java.awt.geom.Point2D). |
String |
toString()
Returns the parameter that govern this morpher. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private Rectangle2D map
private NumberFormat xprim
private NumberFormat yprim
private NumberFormat xsec
private NumberFormat ysec
private NumberFormat dxprim
private NumberFormat dyprim
private NumberFormat dxsec
private NumberFormat dysec
| Constructor Detail |
|---|
public BasicMorpher(double xsize,
double ysize)
public BasicMorpher(double xoff,
double yoff,
double xsize,
double ysize)
public BasicMorpher(Rectangle2D rect)
| Method Detail |
|---|
public Point2D toPrimary(Point2D 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.
toPrimary in interface Morphingxy - A point in the secondary system.
public Point2D toSecondary(Point2D ab)
toPrimary(java.awt.geom.Point2D). 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.
toSecondary in interface Morphingab - The image coordinates.
public Rectangle2D getDefiningRectangle()
public String formatSecondaryX(double xsecondary)
Point2D.getX() from the toSecondary(java.awt.geom.Point2D)
return.
formatSecondaryX in interface FormattingMorphingpublic String formatSecondaryY(double ysecondary)
Point2D.getY() from the toSecondary(java.awt.geom.Point2D)
return.
formatSecondaryY in interface FormattingMorphingpublic String formatPrimaryX(double xprimary)
Point2D.getX() from the toPrimary(java.awt.geom.Point2D)
return.
formatPrimaryX in interface FormattingMorphingpublic String formatPrimaryY(double yprimary)
Point2D.getY() from the toPrimary(java.awt.geom.Point2D)
return.
formatPrimaryY in interface FormattingMorphingpublic String deltaFormatSecondaryX(double dxsecondary)
Point2D.getX() difference from
two toSecondary(java.awt.geom.Point2D) calls.
deltaFormatSecondaryX in interface DeltaFormattingMorphingpublic String deltaFormatSecondaryY(double dysecondary)
Point2D.getY() difference from
two toPrimary(java.awt.geom.Point2D) calls.
deltaFormatSecondaryY in interface DeltaFormattingMorphingpublic String deltaFormatPrimaryX(double dxprimary)
Point2D.getX() difference from
two toPrimary(java.awt.geom.Point2D) calls.
deltaFormatPrimaryX in interface DeltaFormattingMorphingpublic String deltaFormatPrimaryY(double dyprimary)
Point2D.getY() difference from
two toPrimary(java.awt.geom.Point2D) calls.
deltaFormatPrimaryY in interface DeltaFormattingMorphingpublic void setFormatPrimaryX(NumberFormat nf)
public NumberFormat getFormatPrimaryX()
public void setFormatPrimaryY(NumberFormat nf)
public NumberFormat getFormatPrimaryY()
public void setFormatSecondaryX(NumberFormat nf)
public NumberFormat getFormatSecondaryX()
public void setFormatSecondaryY(NumberFormat nf)
public NumberFormat getFormatSecondaryY()
public void setDeltaFormatPrimaryX(NumberFormat nf)
public void setDeltaFormatPrimaryY(NumberFormat nf)
public void setDeltaFormatSecondaryX(NumberFormat nf)
public void setDeltaFormatSecondaryY(NumberFormat nf)
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||