All Packages Class Hierarchy This Package Previous Next Index
Class crw.awt.Conversion
java.lang.Object
|
+----crw.awt.Conversion
- public class Conversion
- extends Object
A class to perform conversion between physical values
and screen scales. Converts between (screen, physical) =
(int, double) pairs for both x and y. This class is somewhat redundant,
and is replaced by Conversion2.
- Version:
- 1.0, 1997/5/8
- Author:
- C. R. Wie
-
Conversion()
-
Default constructor with unity conversion factors.
-
Conversion(double, double)
-
Constructor with specified conversion factors.
-
getXFillFactor()
-
Returns the x-fillfactor.
-
getYFillFactor()
-
Returns the y-fillfactor.
-
set(Dimension, FloatRange, FloatRange)
- Sets the conversion factors from the x-value range and
y-value range.
-
setPhysToScr(double, double)
-
Sets the conversion factor from physical to screen.
-
setPhysToScrX(double)
-
Sets a new physical-to-screen x-conversion factor.
-
setPhysToScrY(double)
-
Sets a new physical-to-screen y-conversion factor.
-
setX(int, double)
-
X-conversion factor is caluculated from the screen
x-width and the maximum x-physical range.
-
setXFillFactor(double)
-
Sets the x-fillfactor to a new value.
-
setY(int, double)
-
Y-conversion factor is caluculated from the screen
y-height and the maximum y-physical range.
-
setYFillFactor(double)
-
Sets the y-fillfactor to a new value.
-
toPhysX(int)
-
Converts to the physical x-value.
-
toPhysY(int)
-
Converts to the physical y-value.
-
toScrX(double)
-
Converts to the screen x-scale.
-
toScrX(double[])
- Converts to screen x-scale of entire x-array.
-
toScrX(int)
-
Converts to the screen x-scale.
-
toScrX(Vector)
- Converts to screen x-scale for the entire Vector.
-
toScrY(double)
-
Converts to the screen y-scale.
-
toScrY(double[])
- Converts to screen scale for an array of physical data.
-
toScrY(double[][])
- Converts to the screen scale for the entire array.
-
toScrY(int)
-
Converts to the screen y-scale.
-
toScrY(Vector, Vector)
- Converts to screen y-scale for the entire Vector.
Conversion
public Conversion()
- Default constructor with unity conversion factors.
Conversion
public Conversion(double xfact,
double yfact)
- Constructor with specified conversion factors.
- Parameters:
- xfact - the physical-to-screen x-conversion factor.
- yfact - the physical-to-screen x-conversion factor.
toScrX
public int toScrX(double x)
- Converts to the screen x-scale.
- Parameters:
- x - the physical x-value to convert.
- Returns:
- the screen x-value.
toScrX
public int[] toScrX(double x[])
- Converts to screen x-scale of entire x-array.
- Parameters:
- x - the physical x-array.
- Returns:
- the screen x-array.
toScrX
public Vector toScrX(Vector phys)
- Converts to screen x-scale for the entire Vector.
- Parameters:
- phys - the Vector that constains the physical x-values, Double objects.
- Returns:
- the corresponding Vector of screen x-scales, Integer objects.
toScrX
public int toScrX(int x)
- Converts to the screen x-scale.
- Parameters:
- x - the physical x-value.
- Returns:
- the screen x-value.
toScrY
public int toScrY(double y)
- Converts to the screen y-scale.
- Parameters:
- y - the physical y-value to convert.
- Returns:
- the screen y-valye.
toScrY
public int toScrY(int y)
- Converts to the screen y-scale.
- Parameters:
- y - the physical y-value.
- Returns:
- the screen y-value.
toScrY
public int[][] toScrY(double y[][])
- Converts to the screen scale for the entire array.
- Parameters:
- y - the physical 2D array.
- Returns:
- the 2D array of screen values.
toScrY
public int[] toScrY(double y[])
- Converts to screen scale for an array of physical data.
- Parameters:
- y - the physical data array.
- Returns:
- the 1D array of screen equivalents.
toScrY
public void toScrY(Vector phys,
Vector scr)
- Converts to screen y-scale for the entire Vector.
- Parameters:
- phys - the Vector that constains the physical y-values.
- Returns:
- the corresponding Vector of screen y-scales.
toPhysX
public double toPhysX(int x)
- Converts to the physical x-value.
- Parameters:
- x - the screen x-value.
- Returns:
- the physical x-value.
toPhysY
public double toPhysY(int y)
- Converts to the physical y-value.
- Parameters:
- y - the screen y-value.
- Returns:
- the physical y-value.
setPhysToScr
public void setPhysToScr(double xfact,
double yfact)
- Sets the conversion factor from physical to screen.
It also sets the conversion factor for screen-to-physical.
- Parameters:
- xfact - the new physical-to-screen x-conversion factor.
- yfact - the new physical-to-screen y-conversion factor.
setPhysToScrX
public void setPhysToScrX(double xfact)
- Sets a new physical-to-screen x-conversion factor.
It automatically sets a new screen-to-physical conversion
factor to its inverse value.
- Parameters:
- xfact - the new x-conversion factor.
setPhysToScrY
public void setPhysToScrY(double yfact)
- Sets a new physical-to-screen y-conversion factor.
It automatically sets a new screen-to-physical conversion
factor to its inverse value.
- Parameters:
- yfact - the new y-conversion factor.
setX
public void setX(int screenWidth,
double xmax)
- X-conversion factor is caluculated from the screen
x-width and the maximum x-physical range. Default fill
factor is 0.75.
- Parameters:
- screenWidth - the screen x-width.
- xmax - the maximum x-range of physical value.
setY
public void setY(int screenHeight,
double ymax)
- Y-conversion factor is caluculated from the screen
y-height and the maximum y-physical range. Default fill
factor is 0.75.
- Parameters:
- screenWidth - the screen y-height.
- ymax - the maximum y-range of physical value.
set
public void set(Dimension size,
FloatRange xrange,
FloatRange yrange)
- Sets the conversion factors from the x-value range and
y-value range.
- Parameters:
- size - the screen dimension.
- xrange - the x-value range.
- yrange - the y-value range.
setXFillFactor
public void setXFillFactor(double x)
- Sets the x-fillfactor to a new value. 0.0 < x <= 1.0
The x-conversion factors adjust to the new fillFactor.
- Parameters:
- x - the new x-fillfactor.
setYFillFactor
public void setYFillFactor(double y)
- Sets the y-fillfactor to a new value. 0.0 < y <= 1.0
- Parameters:
- y - the new y-fillfactor.
getXFillFactor
public double getXFillFactor()
- Returns the x-fillfactor.
- Returns:
- the x-fillfactor.
getYFillFactor
public double getYFillFactor()
- Returns the y-fillfactor.
- Returns:
- the y-fillfactor.
All Packages Class Hierarchy This Package Previous Next Index