Logo Search packages:      
Sourcecode: wims version File versions  Download package

edu::hws::jcm::draw::CoordinateRect Class Reference

Inheritance diagram for edu::hws::jcm::draw::CoordinateRect:

edu::hws::jcm::awt::Tieable edu::hws::jcm::awt::Limits edu::hws::jcm::awt::Computable edu::hws::jcm::awt::InputObject

List of all members.


Detailed Description

A CoordinateRect represents a rectagular region in the xy-plane, specified by values xmin,xmax,ymin,ymax. The conditions ymin < ymax and xmin < xmax are enforced. (Values are swapped if necessary, and if min==max, they are reset to -1 and +1. If any of the values are set to an infinite or NaN value, then the coordinate rect won't display anything except the message "Error: undefined limits".)

When the Rect is mapped onto the screen, there can be a gap of a specified number of pixels between the min,max values and the edges of the rectangle on the screen. If the gap is non-zero, then the actual range of coordinates on the rect is larger than the range from the specifed min to max. (This is done mainly so I could have axes that don't quite reach the edges of the rect.)

A CoordinateRect maintains a list of Drawable items. When the Rect's draw() method is called, it calls the draw() method of each of the Drawable items it contains. When its compute() method is called, it calls the compute() method of any Drawable that is a Computable. When its checkInput() method is called, it calls the checkInput() method of any Drawable that is an InputObject.

A CoordinateRect represents a rectangular region in a DisplayCanvas. It has a reference to that Canvas, which is set automatically when it is added to the canvas. If the size, range, or gap on the CoordinateRect change, it will ask the Canvas to redraw the area it occupies.

The values of xmin, xmax, ymin, ymax are exported as Value objects, which can be used elsewhere in your program. The Value objects can be obtained by calling getValueObject(). If you do this, you should add the objects that depend on those values to a Controller and register the Controller to listen for changes from this CoordinateRect by calling the CoordinateRect.setOnChange(Controller) method.

Definition at line 63 of file CoordinateRect.java.


Public Member Functions

synchronized void add (Drawable d)
void checkInput ()
void clearRestoreBuffer ()
void compute ()
 CoordinateRect (double xmin, double xmax, double ymin, double ymax)
 CoordinateRect ()
synchronized void draw (Graphics g, int left, int top, int width, int height)
void draw (Graphics g, int width, int height)
double[] equalizeAxes ()
Drawable getDrawable (int i)
int getDrawableCount ()
int getGap ()
int getHeight ()
int getLeft ()
double[] getLimits ()
Controller getOnChange ()
double getPixelHeight ()
double getPixelWidth ()
long getSerialNumber ()
int getTop ()
Value getValueObject (final int which)
int getWidth ()
double getXmax ()
double getXmin ()
double getYmax ()
double getYmin ()
void notifyControllerOnChange (Controller c)
double pixelToX (int h)
double pixelToY (int y)
synchronized void remove (Drawable d)
double[] restore ()
void setGap (int g)
void setLimits (double[] d)
void setLimits (double xmin, double xmax, double ymin, double ymax)
void setOnChange (Controller c)
void setRestoreBuffer ()
void setSyncWith (Tie tie)
void sync (Tie tie, Tieable newest)
int xToPixel (double x)
int yToPixel (double y)
double[] zoomIn ()
double[] zoomInOnPixel (int x, int y)
double[] zoomOut ()
double[] zoomOutFromPixel (int x, int y)

Static Public Attributes

static final int XMAX = 1
static final int XMIN = 0
static final int YMAX = 3
static final int YMIN = 2

Protected Member Functions

void doDraw (Graphics g)

Protected Attributes

boolean changed
Vector drawItems = new Vector()
Controller onChange
Tie syncWith

Package Functions

Draggable checkDraggables (java.awt.event.MouseEvent evt)
void setOwner (DisplayCanvas canvas)

Private Member Functions

boolean badData ()
void checkLimits ()
void needsRedraw ()

Private Attributes

DisplayCanvas canvas
int gap = 5
int height = -1
int left
double restore_xmax
double restore_xmin = Double.NaN
double restore_ymax
double restore_ymin
long serialNumber
int top
int width = -1
double xmax
double xmin
double ymax
double ymin

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index