Inheritance diagram for CanvasOval::
Public Methods | |
CanvasOval (double x, double y, double w, double h) | |
CanvasOval (double x, double y, double w, double h, Color color) | |
CanvasOval (double x, double y, double w, double h, Color color, boolean circle) | |
CanvasOval (double x, double y, double w, double h, int mode, Color color, boolean stroke, float linew, float trans, boolean circle, double ccs_scale) | |
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 | isCircle () |
void | setCircle (boolean circle) |
CanvasOval (int x, int y, int w, int h, int mode, Color color, boolean circle, 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 | circle = false |
|
00030 { 00031 super(x, y, w, h); 00032 } |
|
00037 { 00038 super(x, y, w, h, color); 00039 } |
|
|
|
|
|
|
|
Draw CanvasObject on 'g', using internal CCS values.
Reimplemented from CanvasObject.
00063 { 00064 setupDrawMode(g); 00065 if (!getTransformOK()) { 00066 transformICStoCCS(); 00067 } 00068 g.drawOval(getX1Ccs(), getY1Ccs(), getWidthCcs(), getHeightCcs()); 00069 } |
|
Return an identical copy of this CanvasObject.
Reimplemented from CanvasObject.
00073 { 00074 Color color = drawColor; 00075 if (hasNoColor) { 00076 color = NO_COLOR; 00077 } 00078 return (new CanvasOval(getX1(), getY1(), getWidth(), getHeight(), getDrawMode(), 00079 color, strokeSet, lineWidth, 00080 transparency, circle, getZoomFactor())); 00081 } |
|
00085 { 00086 if (inBoundingBox(x, y)) { 00087 00088 x -= getX1(); 00089 y -= getY1(); 00090 00091 double trueX = x - getWidth() / 2; 00092 double trueY = y - getHeight() / 2; 00093 00094 double val = (trueX * trueX) / ((getWidth()/2) * (getWidth()/2)) + 00095 (trueY * trueY) / ((getHeight()/2) * (getHeight()/2)); 00096 return (val <= 1.0); 00097 } 00098 return false; 00099 } |
|
00103 { 00104 if (!((x >= getX1() - SPHERE) && (x < getX1() + getWidth() + SPHERE) && 00105 (y >= getY1() - SPHERE) && (y < getY1() + getHeight() + SPHERE))) { 00106 return false; 00107 } 00108 00109 CanvasOval oval1 = new CanvasOval(getX1()-SPHERE, getY1()-SPHERE, 00110 getWidth()+2*SPHERE, getHeight()+2*SPHERE); 00111 CanvasOval oval2 = new CanvasOval(getX1()+SPHERE, getY1()+SPHERE, 00112 getWidth()-2*SPHERE, getHeight()-2*SPHERE); 00113 if (oval1.isInside(x, y) && !oval2.isInside(x, y)) { 00114 return true; 00115 } 00116 return false; 00117 } |
|
Resize CanvasObject to width 'w' and height 'h'. Parameters are assumed Image Coordinate System values. Reimplemented from ScribbleObject.
00121 { 00122 if (circle) { 00123 00124 double ics_max = Math.max(Math.abs(w), Math.abs(h)); 00125 00126 setWidth(ics_max); 00127 setHeight(ics_max); 00128 00129 if (w <= 0.) { 00130 w = -getWidth(); 00131 } else { 00132 w = getWidth(); 00133 } 00134 00135 if (h <= 0) { 00136 h = -getHeight(); 00137 } else { 00138 h = getHeight(); 00139 } 00140 } 00141 super.setDimension(w, h); 00142 } |
|
Round internal ICS values to nearest natural number. Although the ICS values are changed, they are not converted to 'integer' internally. Reimplemented from ScribbleObject.
|
|
00165 { 00166 return circle; 00167 } |
|
|
|
To be removed.
Reimplemented from CanvasObject.
00202 { 00203 if (!getTransformOK()) { 00204 transformICStoCCS(); 00205 } 00206 00207 if (inBoundingBoxCcs(x, y)) { 00208 00209 x -= getX1Ccs(); 00210 y -= getY1Ccs(); 00211 00212 double trueX = (double)x - getWidthCcs() / 2; 00213 double trueY = (double)y - getHeightCcs() / 2; 00214 00215 double val = (trueX * trueX) / ((getWidthCcs()/2) * (getWidthCcs()/2)) + 00216 (trueY * trueY) / ((getHeightCcs()/2) * (getHeightCcs()/2)); 00217 return (val <= 1.0); 00218 } 00219 return false; 00220 } |
|
To be removed.
Reimplemented from CanvasObject.
00224 { 00225 if (!getTransformOK()) { 00226 transformICStoCCS(); 00227 } 00228 00229 if (!((x >= getX1Ccs() - SPHERE) && (x < getX1Ccs() + getWidthCcs() + SPHERE) && 00230 (y >= getY1Ccs() - SPHERE) && (y < getY1Ccs() + getHeightCcs() + SPHERE))) { 00231 return false; 00232 } 00233 00234 CanvasOval oval1 = new CanvasOval(getX1Ccs()-SPHERE, getY1Ccs()-SPHERE, 00235 getWidthCcs()+2*SPHERE, getHeightCcs()+2*SPHERE); 00236 CanvasOval oval2 = new CanvasOval(getX1Ccs()+SPHERE, getY1Ccs()+SPHERE, 00237 getWidthCcs()-2*SPHERE, getHeightCcs()-2*SPHERE); 00238 if (oval1.isInsideCcs(x, y) && !oval2.isInsideCcs(x, y)) { 00239 return true; 00240 } 00241 return false; 00242 } |
|
Reimplemented from ScribbleObject.
00246 { 00247 if (!getTransformOK()) { 00248 transformICStoCCS(); 00249 } 00250 00251 if (circle) { 00252 int ccs_max = Math.max(Math.abs(w), Math.abs(h)); 00253 00254 setWidthCcs(ccs_max); 00255 setHeightCcs(ccs_max); 00256 00257 if (w <= 0) { 00258 w = -getWidthCcs(); 00259 } else { 00260 w = getWidthCcs(); 00261 } 00262 00263 if (h <= 0) { 00264 h = -getHeightCcs(); 00265 } else { 00266 h = getHeightCcs(); 00267 } 00268 } 00269 super.setDimension(w, h); 00270 } |
|
Reimplemented from ScribbleFigure.
00274 { 00275 int retval = super.changePoint(index, x, y); 00276 int min = Math.min(Math.abs(getWidthCcs()), Math.abs(getHeightCcs())); 00277 int max = Math.max(Math.abs(getWidthCcs()), Math.abs(getHeightCcs())); 00278 00279 if (circle && min > 0) { 00280 setWidthCcs(max); 00281 setHeightCcs(max); 00282 00283 if (getX1Ccs() != getStartXCcs()) { 00284 setX1Ccs(getStartXCcs() - getWidthCcs()); 00285 } 00286 if (getY1Ccs() != getStartYCcs()) { 00287 setY1Ccs(getStartYCcs() - getHeightCcs()); 00288 } 00289 00290 transformCCStoICS(); 00291 } 00292 00293 return (retval); 00294 } |
|
|