Inheritance diagram for CanvasRectangle::
Public Methods | |
CanvasRectangle (double x, double y, double w, double h) | |
CanvasRectangle (double x, double y, double w, double h, Color color) | |
CanvasRectangle (double x, double y, double w, double h, Color color, boolean square) | |
CanvasRectangle (double x, double y, double w, double h, int mode, Color color, boolean stroke, float linew, float trans, boolean square, double ccsScale) | |
void | draw (Graphics g) |
Draw CanvasObject on 'g', using internal CCS values. More... | |
Object | clone () |
Return an identical copy of this CanvasObject. More... | |
boolean | isInside (double x, double y) |
boolean | isNear (double x, double y) |
void | setDimension (double w, double h) |
Resize CanvasObject to width 'w' and height 'h'. More... | |
void | doPixelFit (double zoomFactor) |
Round internal ICS values to nearest natural number. More... | |
boolean | isSquare () |
void | setSquare (boolean square) |
CanvasRectangle (int x, int y, int w, int h, int mode, Color color, boolean square, double ccs_scale) | |
boolean | isInsideCcs (int x, int y) |
To be removed. More... | |
boolean | isNearCcs (int x, int y) |
To be removed. More... | |
void | setDimension (int w, int h) |
int | changePoint (int index, int x, int y) |
Protected Attributes | |
boolean | square = false |
|
00031 { 00032 super(x, y, w, h); 00033 } |
|
00038 { 00039 super(x, y, w, h, color); 00040 } |
|
|
|
|
|
|
|
Draw CanvasObject on 'g', using internal CCS values.
Reimplemented from CanvasObject.
00065 { 00066 setupDrawMode(g); 00067 if (!getTransformOK()) { 00068 transformICStoCCS(); 00069 } 00070 if (DEBUG_OBJECTS) { 00071 OutputStreamArea.println("Draw rectangle called"); 00072 dump(); 00073 } 00074 g.drawRect(getX1Ccs(), getY1Ccs(), getWidthCcs(), getHeightCcs()); 00075 } |
|
Return an identical copy of this CanvasObject.
Reimplemented from CanvasObject.
00079 { 00080 Color color = drawColor; 00081 if (hasNoColor) { 00082 color = NO_COLOR; 00083 } 00084 return (new CanvasRectangle(getX1(), getY1(), getWidth(), getHeight(), getDrawMode(), 00085 color, strokeSet, lineWidth, 00086 transparency, square, getZoomFactor())); 00087 } |
|
00091 { 00092 return inBoundingBox(x, y); 00093 } |
|
00097 { 00098 // check if inside enlarged bounding box (== box + SPHERE), 00099 // but outside smaller bounding box (== box - SPHERE) 00100 00101 if ((x >= getX1() - SPHERE) && (x < getX1() + getWidth() + SPHERE) && 00102 (y >= getY1() - SPHERE) && (y < getY1() + getHeight() + SPHERE) && 00103 !((x >= getX1() + SPHERE) && (x < getX1() + getWidth() - SPHERE) && 00104 (y >= getY1() + SPHERE) && (y < getY1() + getHeight() - SPHERE))) { 00105 return true; 00106 } 00107 return false; 00108 } |
|
Resize CanvasObject to width 'w' and height 'h'. Parameters are assumed Image Coordinate System values. Reimplemented from ScribbleObject.
00112 { 00113 if (square) { 00114 00115 double ics_max = Math.max(Math.abs(w), Math.abs(h)); 00116 00117 setWidth(ics_max); 00118 setHeight(ics_max); 00119 00120 if (w <= 0.) { 00121 w = -getWidth(); 00122 } else { 00123 w = getWidth(); 00124 } 00125 00126 if (h <= 0.) { 00127 h = -getHeight(); 00128 } else { 00129 h = getHeight(); 00130 } 00131 } 00132 super.setDimension(w, h); 00133 } |
|
Round internal ICS values to nearest natural number. Although the ICS values are changed, they are not converted to 'integer' internally. Reimplemented from ScribbleObject.
|
|
00156 { 00157 return square; 00158 } |
|
|
|
To be removed.
Reimplemented from CanvasObject.
00193 { 00194 return inBoundingBoxCcs(x, y); 00195 } |
|
To be removed.
Reimplemented from CanvasObject.
00199 { 00200 if (!getTransformOK()) { 00201 transformICStoCCS(); 00202 } 00203 00204 // check if inside enlarged bounding box (== box + SPHERE), 00205 // but outside smaller bounding box (== box - SPHERE) 00206 00207 if ((x >= getX1Ccs() - SPHERE) && (x < getX1Ccs() + getWidthCcs() + SPHERE) && 00208 (y >= getY1Ccs() - SPHERE) && (y < getY1Ccs() + getHeightCcs() + SPHERE) && 00209 !((x >= getX1Ccs() + SPHERE) && (x < getX1Ccs() + getWidthCcs() - SPHERE) && 00210 (y >= getY1Ccs() + SPHERE) && (y < getY1Ccs() + getHeightCcs() - SPHERE))) { 00211 return true; 00212 } 00213 return false; 00214 } |
|
Reimplemented from ScribbleObject.
00218 { 00219 if (!getTransformOK()) { 00220 transformICStoCCS(); 00221 } 00222 00223 if (square) { 00224 00225 int ccs_max = Math.max(Math.abs(w), Math.abs(h)); 00226 00227 setWidthCcs(ccs_max); 00228 setHeightCcs(ccs_max); 00229 00230 if (w <= 0) { 00231 w = -getWidthCcs(); 00232 } else { 00233 w = getWidthCcs(); 00234 } 00235 00236 if (h <= 0) { 00237 h = -getHeightCcs(); 00238 } else { 00239 h = getHeightCcs(); 00240 } 00241 } 00242 super.setDimension(w, h); 00243 } |
|
Reimplemented from ScribbleFigure.
00247 { 00248 int retval = super.changePoint(index, x, y); 00249 int min = Math.min(Math.abs(getWidthCcs()), Math.abs(getHeightCcs())); 00250 int max = Math.max(Math.abs(getWidthCcs()), Math.abs(getHeightCcs())); 00251 00252 if (square && min > 0) { 00253 setWidthCcs(max); 00254 setHeightCcs(max); 00255 00256 if (getX1Ccs() != getStartXCcs()) { 00257 setX1Ccs(getStartXCcs() - getWidthCcs()); 00258 } 00259 if (getY1Ccs() != getStartYCcs()) { 00260 setY1Ccs(getStartYCcs() - getHeightCcs()); 00261 } 00262 00263 transformCCStoICS(); 00264 } 00265 00266 return (retval); 00267 } |
|
|