Horus Doc || Java GUI Reference || Doxygen's quick Index  

Converter Class Reference

Functions for conversion between CCS and ICS. More...

List of all members.

Static Public Methods

int ICStoCCS (double icsVal, double zoomFactor)
 Converts the given ics value to ccs value. More...

int[] ICStoCCS (double[] icsVals, double zoomFactor)
 Converts the given set of ics values to ccs values. More...

void ICStoCCS (double[] icsVals, int[] ccsVals, double zoomFactor)
 Converts the given set of ics values to ccs values. More...

double CCStoICS (int ccsVal, double zoomFactor)
 Converts the given ccs value to ics value. More...

double[] CCStoICS (int[] ccsVals, double zoomFactor)
 Converts the given set of ccs values to ics values. More...

void CCStoICS (int[] ccsVals, double[] icsVals, double zoomFactor)
 Converts the given set of ccs values to ics values. More...

Dimension ICStoCCS (Dimension ics, double zoomFactor)
 Converts the given ics dimension to ccs dimension. More...

Dimension CCStoICS (Dimension ccs, double zoomFactor)
 Converts the given ccs dimension to ics dimension. More...

int ICStoPCS (double icsVal)
 Converts the given ics value to pcs value. More...

int ICStoPCS (double icsVal, boolean doEps)
 Converts the given ics value to pcs value. More...


Static Public Attributes

double ICS_ORIGIN = -0.5
 The origin of the ICS is at (-0.5, -0.5). More...

double ICS_EPS = 0.001
 The correction factor makes sure that a point is mappend onto the correct CCS value, i.e. More...


Detailed Description

Functions for conversion between CCS and ICS.


Member Function Documentation

int Converter::ICStoCCS double    icsVal,
double    zoomFactor
[inline, static]
 

Converts the given ics value to ccs value.

00044 {
00045     // Scale image coordinates to canvas coordinates (zoom).
00046 
00047     return (int) Math.round((icsVal+ICS_TO_CCS_F)*zoomFactor);
00048 }

int [] Converter::ICStoCCS double    icsVals[],
double    zoomFactor
[inline, static]
 

Converts the given set of ics values to ccs values.

00054 {
00055     // Scale image coordinates to canvas coordinates (zoom).
00056 
00057     int[] ccsVals = new int[icsVals.length];
00058     for (int i=0; i < ccsVals.length; i++)
00059         ccsVals[i] = (int) Math.round((icsVals[i]+ICS_TO_CCS_F)*zoomFactor);
00060     return ccsVals;
00061 }

void Converter::ICStoCCS double    icsVals[],
int    ccsVals[],
double    zoomFactor
[inline, static]
 

Converts the given set of ics values to ccs values.

00067 {
00068     // Scale image coordinates to canvas coordinates (zoom).
00069 
00070     for (int i=0; i < ccsVals.length; i++)
00071         ccsVals[i] = (int) Math.round((icsVals[i]+ICS_TO_CCS_F)*zoomFactor);
00072 }

double Converter::CCStoICS int    ccsVal,
double    zoomFactor
[inline, static]
 

Converts the given ccs value to ics value.

00078 {
00079     // Scale canvas coordinates to image coordinates.
00080 
00081     return (double) ccsVal / zoomFactor + CCS_TO_ICS_F;
00082 }

double [] Converter::CCStoICS int    ccsVals[],
double    zoomFactor
[inline, static]
 

Converts the given set of ccs values to ics values.

00088 {
00089     // Scale canvas coordinates to image coordinates.
00090 
00091     double[] icsVals = new double[ccsVals.length];
00092 
00093     for (int i=0; i < ccsVals.length; i++)
00094         icsVals[i] = (double) ccsVals[i] / zoomFactor + CCS_TO_ICS_F;
00095     return icsVals;
00096 }

void Converter::CCStoICS int    ccsVals[],
double    icsVals[],
double    zoomFactor
[inline, static]
 

Converts the given set of ccs values to ics values.

00102 {
00103     // Scale canvas coordinates to image coordinates.
00104 
00105     for (int i=0; i < ccsVals.length; i++)
00106         icsVals[i] = (double) ccsVals[i] / zoomFactor + CCS_TO_ICS_F;
00107 }

Dimension Converter::ICStoCCS Dimension    ics,
double    zoomFactor
[inline, static]
 

Converts the given ics dimension to ccs dimension.

00113 {
00114     int width  = (int) Math.round((double) ics.width  * zoomFactor);
00115     int height = (int) Math.round((double) ics.height * zoomFactor);
00116     return new Dimension(width, height);
00117 }

Dimension Converter::CCStoICS Dimension    ccs,
double    zoomFactor
[inline, static]
 

Converts the given ccs dimension to ics dimension.

00123 {
00124     int width  = (int) Math.round((double) ccs.width  / zoomFactor);
00125     int height = (int) Math.round((double) ccs.height / zoomFactor);
00126     return new Dimension(width, height);
00127 }

int Converter::ICStoPCS double    icsVal [inline, static]
 

Converts the given ics value to pcs value.

00133 {
00134     // should actually check whether we are on the upper right or
00135     // lower left corner of the pixel and based doEps on that...
00136     return ICStoPCS(icsVal, false);
00137 }

int Converter::ICStoPCS double    icsVal,
boolean    doEps
[inline, static]
 

Converts the given ics value to pcs value.

00143 {
00144     if (doEps)
00145         return (int) Math.round(icsVal - Converter.ICS_EPS);
00146     return (int) Math.round(icsVal);
00147 }


Member Data Documentation

double Converter::ICS_ORIGIN = -0.5 [static]
 

The origin of the ICS is at (-0.5, -0.5).

double Converter::ICS_EPS = 0.001 [static]
 

The correction factor makes sure that a point is mappend onto the correct CCS value, i.e.

the point (0,0) has to be mapped onto (0,0), and not (1,1).


The documentation for this class was generated from the following file:
Generated on Tue Feb 3 14:19:41 2004 for JavaReference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001