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

CanvasHxImageLarge Class Reference

Extension of CanvasImage to display a large 2D HxImageRep (C++ image). More...

Inheritance diagram for CanvasHxImageLarge::

CanvasImage CanvasObject List of all members.

Public Methods

 CanvasHxImageLarge (String imName, String displayMode)
 Constructor. More...

 CanvasHxImageLarge (String imName, String displayMode, int displayDimension, int displayPlane, double resolution, int interpType)
 Constructor. More...

void draw (Graphics g)
 Draw CanvasObject on 'g', using internal CCS values. More...

void setPixel (int x, int y, Color c)
BufferedImage getSubImage (int x, int y, int w, int h)
 Implementation CanvasImage interface. More...

String[] getPixelStrings (int x, int y, int w, int h)
 Implementation CanvasImage interface. More...

String getSaName ()
 Overrides CanvasObject interface. More...

String getDisplayMode ()
void setDisplayMode (String displayMode)
int getDisplayDimension ()
void setDisplayDimension (int displayDimension)
int getDisplayPlane ()
void setDisplayPlane (int displayPlane)
double getResolution ()
void setResolution (double resolution)
int getInterpolationType ()
void setInterpolationType (int interpType)
void refreshPixels ()
int getHxImageRepWidth ()
int getHxImageRepHeight ()
int getHxImageRepDepth ()
Vector getVisualChangeMethods ()
 Overrides CanvasObject interface. More...


Static Public Attributes

final int TYPE_NEAREST = 0
final int TYPE_LINEAR = 1

Detailed Description

Extension of CanvasImage to display a large 2D HxImageRep (C++ image).


Constructor & Destructor Documentation

CanvasHxImageLarge::CanvasHxImageLarge String    imName,
String    displayMode
[inline]
 

Constructor.

00033 {
00034     this(imName, displayMode, 3, 0, 1.0, TYPE_NEAREST);
00035 }

CanvasHxImageLarge::CanvasHxImageLarge String    imName,
String    displayMode,
int    displayDimension,
int    displayPlane,
double    resolution,
int    interpType
[inline]
 

Constructor.

00043 {
00044     super(Converter.ICS_ORIGIN, Converter.ICS_ORIGIN, 0., 0.);
00045     doInit(imName, displayMode, displayDimension, displayPlane, resolution,
00046            interpType);
00047 }


Member Function Documentation

void CanvasHxImageLarge::draw Graphics    g [inline, virtual]
 

Draw CanvasObject on 'g', using internal CCS values.

Reimplemented from CanvasObject.

00051 {
00052     setupDrawMode(g);
00053     if (!getTransformOK())
00054         transformICStoCCS();
00055 
00056     Rectangle vp = g.getClipBounds();
00057     if (vp == null)
00058         return; // don't know what to draw if clipping is not set
00059     if ((_bufIm == null) || (_bufImWidth != vp.width)
00060                          || (_bufImHeight != vp.height))
00061         newBufIm(vp.width, vp.height);
00062     updateBufIm(vp);
00063 if (DEBUG_OBJECTS) {
00064 OutputStreamArea.println("Draw HxImageLARGE called, image w: " +
00065                          _bufIm.getWidth(null) + ", h: " +
00066                          _bufIm.getHeight(null));
00067 dump();
00068 }
00069     g.drawImage(_bufIm, vp.x, vp.y, vp.width, vp.height, null);
00070 //    g.drawImage(_bufIm, getX1Ccs(), getY1Ccs(), getWidthCcs(),
00071 //                getHeightCcs(), null);
00072 }

void CanvasHxImageLarge::setPixel int    x,
int    y,
Color    c
[inline, virtual]
 

Reimplemented from CanvasImage.

00076 {
00077     // ignore
00078 }

BufferedImage CanvasHxImageLarge::getSubImage int    x,
int    y,
int    w,
int    h
[inline, virtual]
 

Implementation CanvasImage interface.

Takes care of possible changes in resolution set by the user.

Reimplemented from CanvasImage.

00085 {
00086     int nx = (int) Math.round(x * _resolution);
00087     int ny = (int) Math.round(y * _resolution);
00088     int nw = (int) Math.round(w * _resolution);
00089     int nh = (int) Math.round(h * _resolution);
00090     return _bufIm.getSubimage(nx, ny, nw, nh);
00091 }

String [] CanvasHxImageLarge::getPixelStrings int    x,
int    y,
int    w,
int    h
[inline, virtual]
 

Implementation CanvasImage interface.

Reimplemented from CanvasImage.

00097 {
00098     String[] strs = new String[w*h];
00099     String[] args = new String[3];
00100     args[2] = new String("int 0");
00101     for (int i=0; i<w; i++) {
00102         for (int j=0; j<h; j++) {
00103             if (x+i < 0 || y+j < 0 || x+i >= _dispImWidth || y+j >= _dispImHeight) {
00104                 strs[i+j*w] = new String("");
00105             } else {
00106                 args[0] = new String("int ") + (x+i);
00107                 args[1] = new String("int ") + (y+j);
00108                 strs[i+j*w] = _mediator.callMethod("HxImageRep", _name,
00109                                                    "getAt", "", args);
00110             }
00111         }
00112     }
00113     return strs;
00114 }

String CanvasHxImageLarge::getSaName   [inline]
 

Overrides CanvasObject interface.

Reimplemented from CanvasObject.

00120 {
00121     return _name;
00122 }

String CanvasHxImageLarge::getDisplayMode   [inline]
 

00126 {
00127     return _displayMode;
00128 }

void CanvasHxImageLarge::setDisplayMode String    displayMode [inline]
 

00132 {
00133     if (displayMode != _displayMode) {
00134         updatePixels(displayMode, _displayDimension, _displayPlane,
00135                      _resolution, _interpolationType);
00136     }
00137 }

int CanvasHxImageLarge::getDisplayDimension   [inline]
 

00141 {
00142     return _displayDimension;
00143 }

void CanvasHxImageLarge::setDisplayDimension int    displayDimension [inline]
 

00147 {
00148     if (displayDimension != _displayDimension) {
00149         updatePixels(_displayMode, displayDimension, _displayPlane,
00150                      _resolution, _interpolationType);
00151     }
00152 }

int CanvasHxImageLarge::getDisplayPlane   [inline]
 

00156 {
00157     return _displayPlane;
00158 }

void CanvasHxImageLarge::setDisplayPlane int    displayPlane [inline]
 

00162 {
00163     if (displayPlane != _displayPlane) {
00164         updatePixels(_displayMode, _displayDimension, displayPlane,
00165                      _resolution, _interpolationType);
00166     }
00167 }

double CanvasHxImageLarge::getResolution   [inline]
 

00171 {
00172     return _resolution;
00173 }

void CanvasHxImageLarge::setResolution double    resolution [inline]
 

00177 {
00178     if (resolution != _resolution) {
00179         updatePixels(_displayMode, _displayDimension, _displayPlane,
00180                      resolution, _interpolationType);
00181     }
00182 }

int CanvasHxImageLarge::getInterpolationType   [inline]
 

00186 {
00187     return _interpolationType;
00188 }

void CanvasHxImageLarge::setInterpolationType int    interpType [inline]
 

00192 {
00193     if (interpType != _interpolationType) {
00194         updatePixels(_displayMode, _displayDimension, _displayPlane,
00195                      _resolution, interpType);
00196     }
00197 }

void CanvasHxImageLarge::refreshPixels   [inline]
 

00201 {
00202 //long startTime = System.currentTimeMillis();
00203     _mediator.hxImageGetPixels(_name, _pixels, _displayMode, _displayDimension,
00204                                _displayPlane, _bufImWidth, _bufImHeight,
00205                                _interpolationType);
00206 //long endTime = System.currentTimeMillis();
00207 //endTime = endTime - startTime;
00208 //OutputStreamArea.println("display time: " + endTime);
00209 }

int CanvasHxImageLarge::getHxImageRepWidth   [inline]
 

00213 {
00214     String[] args = { "int 1" };
00215     String result = _mediator.callMethod("HxImageRep", _name,
00216                                          "dimensionSize", "", args);
00217     return java.lang.Integer.parseInt(result);
00218 }

int CanvasHxImageLarge::getHxImageRepHeight   [inline]
 

00222 {
00223     String[] args = { "int 2" };
00224     String result = _mediator.callMethod("HxImageRep", _name,
00225                                          "dimensionSize", "", args);
00226     return java.lang.Integer.parseInt(result);
00227 }

int CanvasHxImageLarge::getHxImageRepDepth   [inline]
 

00231 {
00232     String[] args = { "int 3" };
00233     String result = _mediator.callMethod("HxImageRep", _name,
00234                                          "dimensionSize", "", args);
00235     return java.lang.Integer.parseInt(result);
00236 }

Vector CanvasHxImageLarge::getVisualChangeMethods   [inline]
 

Overrides CanvasObject interface.

Extends the list of callable functions obtained from the parent with the functions for this class.

Reimplemented from CanvasObject.

00244 {
00245     Vector v = super.getVisualChangeMethods();
00246     v.add(new CallableMethod("setDisplayMode", "String", "m", "rgb"));
00247     v.add(new CallableMethod("setDisplayDimension", "int", "d", "int"));
00248     v.add(new CallableMethod("setDisplayPlane", "int", "nr", "int"));
00249     v.add(new CallableMethod("setResolution", "double", "r", "double"));
00250     v.add(new CallableMethod("setInterpolationType", "int", "i", "HxGeoIntType"));
00251     return v;
00252 }


Member Data Documentation

final int CanvasHxImageLarge::TYPE_NEAREST = 0 [static]
 

final int CanvasHxImageLarge::TYPE_LINEAR = 1 [static]
 


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