Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

CanvasObject Class Reference

Base class of all objects that can be drawn on a canvas (still under construction). More...

Inheritance diagram for CanvasObject::

CanvasFigure CanvasImage ScribbleObject CanvasCorbaBlob2d CanvasCorbaBSplineCurve CanvasCorbaHistogram CanvasCorbaPolyline2d CanvasCorbaSampledBSplineCurve CanvasHxBlob2d CanvasHxBSplineCurve CanvasHxHistogram CanvasHxPolyline2d CanvasHxSampledBSplineCurve CanvasCorbaImage CanvasCorbaSequence CanvasHxHistogram3d CanvasHxImage CanvasHxImageLarge CanvasJavaImage ScribbleFigure List of all members.

Public Methods

 CanvasObject (double x1, double y1, double x2, double y2)
 Create CanvasObject with top-left corner of bounding box at position (x1, y1), and bottom-right corner at position (x2, y2). More...

 CanvasObject (double x1, double y1, double x2, double y2, int mode)
 Create CanvasObject with top-left corner of bounding box at position (x1, y1), and bottom-right corner at position (x2, y2). More...

 CanvasObject (double x1, double y1, double x2, double y2, int mode, double zoomFactor)
 Create CanvasObject with top-left corner of bounding box at position (x1, y1), and bottom-right corner at position (x2, y2). More...

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

abstract Object clone ()
 Return an identical copy of this CanvasObject. More...

boolean inBoundingBox (double x, double y)
 Check if given position is inside CanvasObject's bounding box. More...

double getX1 ()
 Return x-value of upper left corner of CanvasObject's bounding box. More...

double getY1 ()
 Return y-value of upper left corner of CanvasObject's bounding box. More...

double getX2 ()
 Return x-value of lower right corner of CanvasObject's bounding box. More...

double getY2 ()
 Return y-value of lower right corner of CanvasObject's bounding box. More...

double getWidth ()
 Return width of CanvasObject's bounding box, i.e. More...

double getHeight ()
 Return height of CanvasObject's bounding box, i.e. More...

int getX1Pcs ()
 Return x-value of upper left corner of CanvasObject's bounding box. More...

int getY1Pcs ()
 Return y-value of upper left corner of CanvasObject's bounding box. More...

int getX2Pcs ()
 Return x-value of lower right corner of CanvasObject's bounding box. More...

int getY2Pcs ()
 Return y-value of lower right corner of CanvasObject's bounding box. More...

int getDrawMode ()
 Return current draw-mode. More...

void setDrawMode (int mode)
 Set current draw-mode. More...

double getZoomFactor ()
 Return current ICS to CCS zoom-factor. More...

void setZoomFactor (double zoomFactor)
 Scale CanvasObject according to 'zoomFactor'. More...

int getInputSource ()
 Return input source, i.e. More...

void setInputSource (int source)
 Set input source. More...

String getSaName ()
 Return name of the string addressable object (if valid). More...

boolean getEditable ()
 Return whether the object is editable at this moment, i.e. More...

void setEditable (boolean edit)
 Set whether the object is editable at this moment, i.e. More...

Vector getVisualChangeMethods ()
 Builds up a list of functions that are to fill a menu for changing the visualization aspects of an object. More...

 CanvasObject (int x1, int y1, int x2, int y2, int mode, double zoomFactor)
 To be removed. More...

boolean isInsideCcs (int x, int y)
 To be removed. More...

boolean isNearCcs (int x, int y)
 To be removed. More...

boolean isHitCcs (int x, int y)
 Checks whether this object is selected (hit) based on the bounding box. More...

boolean isHitCcs (int x, int y, Graphics2D g)
 Interface for a more specialized version of isHitCcs for CanvasFigures. More...

boolean inBoundingBoxCcs (int x, int y)
int getX1Ccs ()
int getY1Ccs ()
int getX2Ccs ()
int getY2Ccs ()
int getWidthCcs ()
int getHeightCcs ()
int getStartXCcs ()
int getStartYCcs ()
Dimension getDimensionCcs ()
void dump ()

Static Public Attributes

final int INP_USER = 0
 The user created the object. More...

final int INP_SASYSTEM = 1
 Some other source created the object. More...

final int INP_CORBA = 1
final int COPY_MODE = 0
 Copy draw mode. More...

final int XOR_MODE = 1
 Xor draw mode. More...

final Color XOR_COLOR = Color.cyan
 Xor draw color. More...

final int SPHERE = 3
 Influence region for isHit. More...

final double DEF_SCALE = 1.0f
 Default scale factor. More...

boolean DEBUG_OBJECTS = false

Protected Methods

void doInit (double x1, double y1, double x2, double y2, int mode, double zoomFactor)
 Initialize CanvasObject. More...

void setX1 (double x)
void setY1 (double y)
void setX2 (double x)
void setY2 (double y)
void setWidth (double w)
void setHeight (double h)
double getStartX ()
void setStartX (double x)
double getStartY ()
void setStartY (double y)
void setX1Ccs (int x)
void setY1Ccs (int y)
void setX2Ccs (int x)
void setY2Ccs (int y)
void setWidthCcs (int w)
void setHeightCcs (int h)
void setStartXCcs (int x)
void setStartYCcs (int y)
void setupDrawMode (Graphics g)
 Setup drawmode for 'g'. More...

boolean getTransformOK ()
void setTransformOK (boolean ok)
void transformICStoCCS ()
 Perform a full ICS to CCS coordinate transformation. More...

void transformCCStoICS ()
 Perform a full CCS to ICS coordinate transformation. More...

void setAdditionalPoints (double[] xCoords, double[] yCoords)
 Set additional points in ICS that will be sync-ed with coordinate transformations. More...

int[] getAddXCcs ()
 This function returns a reference (!) to the array of x-coordinates in CCS of the additional points specified by extensions of this class. More...

int[] getAddYCcs ()
 This function returns a reference (!) to the array of y-coordinates in CCS of the additional points specified by extensions of this class. More...


Detailed Description

Base class of all objects that can be drawn on a canvas (still under construction).

There are two subclasses of objects that can be visualized: bitmap (or raster) images (specializations of CanvasImage) and vector (or line) graphics (specialization of CanvasFigure). The two types of objects differ in the way their internal data is stored, and how it is interpreted to visually represent it on screen. The common behaviour of the objects is combined in this class.

CanvasObjects may originate from different sources. The source is indicated by getInputSource. For now, the sources are the scribbles of the user in the editor and visualizations of string addressable objects. The latter are not editable while the former are, of course. However, editing of scribble objects can be disabled temporarily via the setEditable method.

A CanvasObject defines the smallest bounding box of a visualizable object. The upper left corner of the box in denoted by (X1, Y1) and the lower right corner is denoted by (X1, Y2). These coordinates are stored both in ICS and in CCS format. Subclasses may provide additional coordinates that will be maintained in both formats by CanvasObject via setAdditionalPoints.

Hit Draw Shape VisualChangeSupport


Constructor & Destructor Documentation

CanvasObject::CanvasObject double    x1,
double    y1,
double    x2,
double    y2
[inline]
 

Create CanvasObject with top-left corner of bounding box at position (x1, y1), and bottom-right corner at position (x2, y2).

Parameters are assumed Image Coordinate System values.

CanvasObject::CanvasObject double    x1,
double    y1,
double    x2,
double    y2,
int    mode
[inline]
 

Create CanvasObject with top-left corner of bounding box at position (x1, y1), and bottom-right corner at position (x2, y2).

Parameters are assumed Image Coordinate System values.

CanvasObject::CanvasObject double    x1,
double    y1,
double    x2,
double    y2,
int    mode,
double    zoomFactor
[inline]
 

Create CanvasObject with top-left corner of bounding box at position (x1, y1), and bottom-right corner at position (x2, y2).

Parameters are assumed Image Coordinate System values.

CanvasObject::CanvasObject int    x1,
int    y1,
int    x2,
int    y2,
int    mode,
double    zoomFactor
[inline]
 

To be removed.


Member Function Documentation

abstract void CanvasObject::draw Graphics    g [pure virtual]
 

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

Reimplemented in CanvasArrow, CanvasArrowGrid, CanvasBlob, CanvasChain, CanvasColoredPolyline, CanvasFigure, CanvasFigureAggregate, CanvasHxBlob2d, CanvasHxHistogram3d, CanvasHxImage, CanvasHxImageLarge, CanvasJavaImage, CanvasLine, CanvasMask, CanvasOval, CanvasPoint, CanvasPolyline, CanvasRectangle, CanvasString, CanvasCorbaBlob2d, CanvasCorbaImage, and CanvasCorbaSequence.

abstract Object CanvasObject::clone   [pure virtual]
 

Return an identical copy of this CanvasObject.

Reimplemented in CanvasArrow, CanvasArrowGrid, CanvasBlob, CanvasChain, CanvasColoredPolyline, CanvasFigure, CanvasFigureAggregate, CanvasImage, CanvasLine, CanvasMask, CanvasOval, CanvasPoint, CanvasPolyline, CanvasRectangle, and CanvasString.

boolean CanvasObject::inBoundingBox double    x,
double    y
[inline]
 

Check if given position is inside CanvasObject's bounding box.

Parameters are assumed Image Coordinate System values.

double CanvasObject::getX1   [inline]
 

Return x-value of upper left corner of CanvasObject's bounding box.

Returned value represents the Image Coordinate System value.

double CanvasObject::getY1   [inline]
 

Return y-value of upper left corner of CanvasObject's bounding box.

Returned value represents the Image Coordinate System value.

double CanvasObject::getX2   [inline]
 

Return x-value of lower right corner of CanvasObject's bounding box.

Returned value represents the Image Coordinate System value.

double CanvasObject::getY2   [inline]
 

Return y-value of lower right corner of CanvasObject's bounding box.

Returned value represents the Image Coordinate System value.

double CanvasObject::getWidth   [inline]
 

Return width of CanvasObject's bounding box, i.e.

X2 - X1. Returned value represents the Image Coordinate System value.

double CanvasObject::getHeight   [inline]
 

Return height of CanvasObject's bounding box, i.e.

Y2 - Y1. Returned value represents the Image Coordinate System value.

int CanvasObject::getX1Pcs   [inline]
 

Return x-value of upper left corner of CanvasObject's bounding box.

Returned value represents the Pixel Coordinate System value.

int CanvasObject::getY1Pcs   [inline]
 

Return y-value of upper left corner of CanvasObject's bounding box.

Returned value represents the Pixel Coordinate System value.

int CanvasObject::getX2Pcs   [inline]
 

Return x-value of lower right corner of CanvasObject's bounding box.

Returned value represents the Pixel Coordinate System value. A small correction to the ICS value is made to ensure it falls within the bounding image box.

int CanvasObject::getY2Pcs   [inline]
 

Return y-value of lower right corner of CanvasObject's bounding box.

Returned value represents the Pixel Coordinate System value. A small correction to the ICS value is made to ensure it falls within the bounding image box.

int CanvasObject::getDrawMode   [inline]
 

Return current draw-mode.

void CanvasObject::setDrawMode int    mode [inline]
 

Set current draw-mode.

Reimplemented in CanvasBlob, and CanvasFigureAggregate.

double CanvasObject::getZoomFactor   [inline]
 

Return current ICS to CCS zoom-factor.

void CanvasObject::setZoomFactor double    zoomFactor [inline]
 

Scale CanvasObject according to 'zoomFactor'.

The internal ICS values are taken as base values to calculate the associated CCS values.

Reimplemented in CanvasArrow, CanvasArrowGrid, CanvasBlob, CanvasFigureAggregate, and CanvasString.

int CanvasObject::getInputSource   [inline]
 

Return input source, i.e.

who/what created the object.

void CanvasObject::setInputSource int    source [inline]
 

Set input source.

String CanvasObject::getSaName   [inline]
 

Return name of the string addressable object (if valid).

Reimplemented in CanvasHxBlob2d, CanvasHxBSplineCurve, CanvasHxHistogram, CanvasHxImage, CanvasHxImageLarge, CanvasHxPolyline2d, and CanvasHxSampledBSplineCurve.

boolean CanvasObject::getEditable   [inline]
 

Return whether the object is editable at this moment, i.e.

whether the object is selectable when moving, copying, reshaping, etc.

void CanvasObject::setEditable boolean    edit [inline]
 

Set whether the object is editable at this moment, i.e.

whether the object is selectable when moving, copying, reshaping, etc.

Vector CanvasObject::getVisualChangeMethods   [inline]
 

Builds up a list of functions that are to fill a menu for changing the visualization aspects of an object.

Classes derived from this one typically add their class-specific methods to their parents' methods by first calling the parent to fill the vector and then add their own. The result is a Vector of CallableMethods.

Reimplemented in CanvasArrow, CanvasBlob, CanvasFigure, CanvasHxBlob2d, CanvasHxBSplineCurve, CanvasHxImage, CanvasHxImageLarge, CanvasHxSampledBSplineCurve, CanvasPolyline, ScribbleFigure, CanvasCorbaBlob2d, CanvasCorbaBSplineCurve, CanvasCorbaImage, and CanvasCorbaSampledBSplineCurve.

boolean CanvasObject::isInsideCcs int    x,
int    y
[inline]
 

To be removed.

Reimplemented in CanvasArrow, CanvasArrowGrid, CanvasBlob, CanvasChain, CanvasFigureAggregate, CanvasImage, CanvasLine, CanvasMask, CanvasOval, CanvasPoint, CanvasPolyline, CanvasRectangle, and CanvasString.

boolean CanvasObject::isNearCcs int    x,
int    y
[inline]
 

To be removed.

Reimplemented in CanvasArrow, CanvasArrowGrid, CanvasBlob, CanvasChain, CanvasFigureAggregate, CanvasImage, CanvasLine, CanvasMask, CanvasOval, CanvasPoint, CanvasPolyline, CanvasRectangle, and CanvasString.

boolean CanvasObject::isHitCcs int    x,
int    y
[inline]
 

Checks whether this object is selected (hit) based on the bounding box.

boolean CanvasObject::isHitCcs int    x,
int    y,
Graphics2D    g
[inline]
 

Interface for a more specialized version of isHitCcs for CanvasFigures.

The default implementation is the same as isHitCcs(int x, int y) but CanvasFigure provides a more accurate version based on the figures shape.

Reimplemented in CanvasFigure.

boolean CanvasObject::inBoundingBoxCcs int    x,
int    y
[inline]
 

int CanvasObject::getX1Ccs   [inline]
 

int CanvasObject::getY1Ccs   [inline]
 

int CanvasObject::getX2Ccs   [inline]
 

int CanvasObject::getY2Ccs   [inline]
 

int CanvasObject::getWidthCcs   [inline]
 

int CanvasObject::getHeightCcs   [inline]
 

int CanvasObject::getStartXCcs   [inline]
 

int CanvasObject::getStartYCcs   [inline]
 

Dimension CanvasObject::getDimensionCcs   [inline]
 

void CanvasObject::dump   [inline]
 

void CanvasObject::doInit double    x1,
double    y1,
double    x2,
double    y2,
int    mode,
double    zoomFactor
[inline, protected]
 

Initialize CanvasObject.

void CanvasObject::setX1 double    x [inline, protected]
 

void CanvasObject::setY1 double    y [inline, protected]
 

void CanvasObject::setX2 double    x [inline, protected]
 

void CanvasObject::setY2 double    y [inline, protected]
 

void CanvasObject::setWidth double    w [inline, protected]
 

Deprecated:

void CanvasObject::setHeight double    h [inline, protected]
 

Deprecated:

double CanvasObject::getStartX   [inline, protected]
 

void CanvasObject::setStartX double    x [inline, protected]
 

double CanvasObject::getStartY   [inline, protected]
 

void CanvasObject::setStartY double    y [inline, protected]
 

void CanvasObject::setX1Ccs int    x [inline, protected]
 

void CanvasObject::setY1Ccs int    y [inline, protected]
 

void CanvasObject::setX2Ccs int    x [inline, protected]
 

void CanvasObject::setY2Ccs int    y [inline, protected]
 

void CanvasObject::setWidthCcs int    w [inline, protected]
 

Deprecated:

void CanvasObject::setHeightCcs int    h [inline, protected]
 

Deprecated:

void CanvasObject::setStartXCcs int    x [inline, protected]
 

void CanvasObject::setStartYCcs int    y [inline, protected]
 

void CanvasObject::setupDrawMode Graphics    g [inline, protected]
 

Setup drawmode for 'g'.

Reimplemented in CanvasFigure, and ScribbleFigure.

boolean CanvasObject::getTransformOK   [inline, protected]
 

void CanvasObject::setTransformOK boolean    ok [inline, protected]
 

void CanvasObject::transformICStoCCS   [inline, protected]
 

Perform a full ICS to CCS coordinate transformation.

Reimplemented in CanvasArrow, CanvasArrowGrid, CanvasChain, CanvasColoredPolyline, CanvasLine, and CanvasPolyline.

void CanvasObject::transformCCStoICS   [inline, protected]
 

Perform a full CCS to ICS coordinate transformation.

This function is used only for scribbled objects.

Reimplemented in CanvasArrowGrid, CanvasColoredPolyline, CanvasLine, and CanvasPolyline.

void CanvasObject::setAdditionalPoints double    xCoords[],
double    yCoords[]
[inline, protected]
 

Set additional points in ICS that will be sync-ed with coordinate transformations.

Warning: the references to the arrays given will be stored.

int [] CanvasObject::getAddXCcs   [inline, protected]
 

This function returns a reference (!) to the array of x-coordinates in CCS of the additional points specified by extensions of this class.

int [] CanvasObject::getAddYCcs   [inline, protected]
 

This function returns a reference (!) to the array of y-coordinates in CCS of the additional points specified by extensions of this class.


Member Data Documentation

final int CanvasObject::INP_USER = 0 [static]
 

The user created the object.

final int CanvasObject::INP_SASYSTEM = 1 [static]
 

Some other source created the object.

final int CanvasObject::INP_CORBA = 1 [static]
 

final int CanvasObject::COPY_MODE = 0 [static]
 

Copy draw mode.

final int CanvasObject::XOR_MODE = 1 [static]
 

Xor draw mode.

final Color CanvasObject::XOR_COLOR = Color.cyan [static]
 

Xor draw color.

final int CanvasObject::SPHERE = 3 [static]
 

Influence region for isHit.

final double CanvasObject::DEF_SCALE = 1.0f [static]
 

Default scale factor.

boolean CanvasObject::DEBUG_OBJECTS = false [static]
 


The documentation for this class was generated from the following file:
Generated on Tue Jan 8 14:14:23 2002 for JavaReference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001