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

Constructor Index

 o Conversion()
Default constructor with unity conversion factors.
 o Conversion(double, double)
Constructor with specified conversion factors.

Method Index

 o getXFillFactor()
Returns the x-fillfactor.
 o getYFillFactor()
Returns the y-fillfactor.
 o set(Dimension, FloatRange, FloatRange)
Sets the conversion factors from the x-value range and y-value range.
 o setPhysToScr(double, double)
Sets the conversion factor from physical to screen.
 o setPhysToScrX(double)
Sets a new physical-to-screen x-conversion factor.
 o setPhysToScrY(double)
Sets a new physical-to-screen y-conversion factor.
 o setX(int, double)
X-conversion factor is caluculated from the screen x-width and the maximum x-physical range.
 o setXFillFactor(double)
Sets the x-fillfactor to a new value.
 o setY(int, double)
Y-conversion factor is caluculated from the screen y-height and the maximum y-physical range.
 o setYFillFactor(double)
Sets the y-fillfactor to a new value.
 o toPhysX(int)
Converts to the physical x-value.
 o toPhysY(int)
Converts to the physical y-value.
 o toScrX(double)
Converts to the screen x-scale.
 o toScrX(double[])
Converts to screen x-scale of entire x-array.
 o toScrX(int)
Converts to the screen x-scale.
 o toScrX(Vector)
Converts to screen x-scale for the entire Vector.
 o toScrY(double)
Converts to the screen y-scale.
 o toScrY(double[])
Converts to screen scale for an array of physical data.
 o toScrY(double[][])
Converts to the screen scale for the entire array.
 o toScrY(int)
Converts to the screen y-scale.
 o toScrY(Vector, Vector)
Converts to screen y-scale for the entire Vector.

Constructors

 o Conversion
 public Conversion()
Default constructor with unity conversion factors.

 o 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.

Methods

 o 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.
 o 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.
 o 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.
 o toScrX
 public int toScrX(int x)
Converts to the screen x-scale.

Parameters:
x - the physical x-value.
Returns:
the screen x-value.
 o 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.
 o toScrY
 public int toScrY(int y)
Converts to the screen y-scale.

Parameters:
y - the physical y-value.
Returns:
the screen y-value.
 o 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.
 o 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.
 o 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.
 o toPhysX
 public double toPhysX(int x)
Converts to the physical x-value.

Parameters:
x - the screen x-value.
Returns:
the physical x-value.
 o toPhysY
 public double toPhysY(int y)
Converts to the physical y-value.

Parameters:
y - the screen y-value.
Returns:
the physical y-value.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o getXFillFactor
 public double getXFillFactor()
Returns the x-fillfactor.

Returns:
the x-fillfactor.
 o getYFillFactor
 public double getYFillFactor()
Returns the y-fillfactor.

Returns:
the y-fillfactor.

All Packages  Class Hierarchy  This Package  Previous  Next  Index