Inheritance diagram for ScribbleFigure::
Public Methods | |
void | addPoint (double x, double y) |
boolean | removePoint (int index) |
boolean | removeLastPoint () |
boolean | hasNoColor () |
Color | getColor () |
void | setColor (Color newColor) |
boolean | getStroke () |
void | setStroke (boolean stroke) |
boolean | hasLineWidth () |
float | getLineWidth () |
void | setLineWidth (float linew) |
float | getTransparency () |
void | setTransparency (float trans) |
boolean | isComplex () |
boolean | isResizeable () |
Vector | getVisualChangeMethods () |
Builds up a list of functions that are to fill a menu for changing the visualization aspects of an object. More... | |
ScribbleFigure (int x, int y, int w, int h, int mode, Color color, double ccs_scale) | |
ScribbleFigure (int x, int y, int w, int h, int mode, Color color, boolean complex, double ccs_scale) | |
int | changePoint (int index, int x, int y) |
void | addPoint (int x, int y) |
Static Public Attributes | |
final Color | NO_COLOR = (Color)null |
final Color | DEF_COLOR = Color.red |
final float | DEF_LINEW = 1.0f |
final float | DEF_TRANS = 1.0f |
Protected Methods | |
void | initFigure (Color color, boolean stroke, float linew, float trans, boolean complex) |
void | setupDrawMode (Graphics g) |
Setup drawmode for 'g'. More... | |
void | setComplex (boolean complex) |
Protected Attributes | |
boolean | complex = false |
boolean | resizeable = true |
boolean | strokeSet = false |
boolean | hasLineWidth = true |
boolean | hasNoColor = true |
Color | drawColor = NO_COLOR |
float | lineWidth = DEF_LINEW |
float | transparency = DEF_TRANS |
|
00236 { 00237 super(x, y, w, h, mode, ccs_scale); 00238 initFigure(color, false, DEF_LINEW, DEF_TRANS, false); 00239 } |
|
00244 { 00245 super(x, y, w, h, mode, ccs_scale); 00246 initFigure(color, false, DEF_LINEW, DEF_TRANS, complex); 00247 } |
|
Reimplemented in CanvasPolyline.
00089 { 00090 // Implement this method in case of a complex figure 00091 // (such as: Polygon, Polyline, etc.) 00092 } |
|
Reimplemented in CanvasColoredPolyline, and CanvasPolyline.
00096 { 00097 // Implement this method in case of a complex figure 00098 // (such as: Polygon, Polyline, etc.) 00099 00100 return false; 00101 } |
|
Reimplemented in CanvasPolyline.
00105 { 00106 // Implement this method in case of a complex figure 00107 // (such as: Polygon, Polyline, etc.) 00108 00109 return false; 00110 } |
|
00114 { 00115 return hasNoColor; 00116 } |
|
00120 { 00121 return drawColor; 00122 } |
|
Reimplemented in CanvasBlob, CanvasChain, CanvasColoredPolyline, CanvasFigureAggregate, and CanvasMask.
00126 { 00127 if (newColor == NO_COLOR) { 00128 drawColor = DEF_COLOR; 00129 hasNoColor = true; 00130 } else { 00131 drawColor = newColor; 00132 hasNoColor = false; 00133 } 00134 } |
|
00138 { 00139 return strokeSet; 00140 } |
|
Reimplemented in CanvasFigureAggregate.
00144 { 00145 if (hasLineWidth) { // no stroke without a linewidth 00146 strokeSet = stroke; 00147 } 00148 } |
|
00152 { 00153 return hasLineWidth; 00154 } |
|
00158 { 00159 return lineWidth; 00160 } |
|
Reimplemented in CanvasFigureAggregate.
|
|
00175 { 00176 return transparency; 00177 } |
|
Reimplemented in CanvasBlob, CanvasFigureAggregate, and CanvasMask.
00181 { 00182 if (trans < 0.0f) { 00183 trans = 0.0f; 00184 } else if (trans > DEF_TRANS) { 00185 trans = DEF_TRANS; 00186 } 00187 transparency = trans; 00188 } |
|
00192 { 00193 return complex; 00194 } |
|
00198 { 00199 return resizeable; 00200 } |
|
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 from CanvasObject. Reimplemented in CanvasArrow, CanvasBlob, and CanvasPolyline.
00207 { 00208 Vector v = super.getVisualChangeMethods(); 00209 //v.add(new CallableMethod("setColor", "Color", "c", "Color")); 00210 //v.add(new CallableMethod("setStroke", "boolean", "b", "boolean")); 00211 //v.add(new CallableMethod("setLineWidth", "float", "w", "float")); 00212 v.add(new CallableProperty("color", "setColor", "Color", drawColor)); 00213 v.add(new CallableProperty("stroke", "setStroke", "boolean", new Boolean(strokeSet))); 00214 v.add(new CallableProperty("line width", "setLineWidth", "float", new Float(lineWidth))); 00215 v.add(new CallableMethod("setTransparency", "float", "t", "float")); 00216 return v; 00217 } |
|
Reimplemented in CanvasArrow, CanvasBlob, CanvasChain, CanvasLine, CanvasMask, CanvasOval, CanvasPolyline, and CanvasRectangle.
00269 { 00270 if (!getTransformOK()) { 00271 transformICStoCCS(); 00272 } 00273 00274 int xval = 0; 00275 int yval = 0; 00276 setStartXCcs(getX1Ccs()); 00277 setStartYCcs(getY1Ccs()); 00278 00279 switch (index) { 00280 case 0 : setStartXCcs(getStartXCcs() + getWidthCcs()); 00281 setStartYCcs(getStartYCcs() + getHeightCcs()); 00282 if (x > getX1Ccs() + getWidthCcs()) { 00283 xval = 1; 00284 } 00285 if (y > getY1Ccs() + getHeightCcs()) { 00286 yval = 2; 00287 } 00288 break; 00289 case 1 : setStartYCcs(getStartYCcs() + getHeightCcs()); 00290 if (x < getX1Ccs()) { 00291 xval = -1; 00292 } 00293 if (y > getY1Ccs() + getHeightCcs()) { 00294 yval = 2; 00295 } 00296 break; 00297 case 2 : setStartXCcs(getStartXCcs() + getWidthCcs()); 00298 if (x > getX1Ccs() + getWidthCcs()) { 00299 xval = 1; 00300 } 00301 if (y < getY1Ccs()) { 00302 yval = -2; 00303 } 00304 break; 00305 case 3 : if (x < getX1Ccs()) { 00306 xval = -1; 00307 } 00308 if (y < getY1Ccs()) { 00309 yval = -2; 00310 } 00311 break; 00312 default : return -1; 00313 } 00314 00315 setDimension(x-getStartXCcs(), y-getStartYCcs()); 00316 return (xval + yval + index); 00317 } |
|
Reimplemented in CanvasPolyline.
00321 { 00322 // Implement this method in case of a complex figure 00323 // (such as: Polygon, Polyline, etc.) 00324 } |
|
00339 { 00340 setComplex(complex); 00341 setColor(color); 00342 setStroke(stroke); 00343 setLineWidth(linew); 00344 setTransparency(trans); 00345 } |
|
Setup drawmode for 'g'.
Reimplemented from CanvasObject.
00349 { 00350 if (g instanceof Graphics2D) { 00351 00352 Graphics2D g2d = (Graphics2D)g; 00353 switch (getDrawMode()) { 00354 case COPY_MODE : 00355 g2d.setPaintMode(); 00356 g2d.setComposite(AlphaComposite.getInstance( 00357 AlphaComposite.SRC_OVER, transparency)); 00358 if (drawColor != null) { 00359 g2d.setColor(drawColor); 00360 } 00361 break; 00362 00363 case XOR_MODE : 00364 g2d.setXORMode(XOR_COLOR); 00365 g2d.setColor(DEF_COLOR); 00366 g2d.setComposite(AlphaComposite.getInstance( 00367 AlphaComposite.SRC_OVER, 1.f)); 00368 g2d.setStroke(new BasicStroke()); 00369 return; 00370 } 00371 00372 float lwidth; 00373 00374 if (hasLineWidth) { 00375 lwidth = lineWidth; 00376 } else { 00377 lwidth = DEF_LINEW; 00378 } 00379 00380 float[] dash = { 6.f }; 00381 if (!(strokeSet && hasLineWidth)) { 00382 dash = null; 00383 } 00384 g2d.setStroke(new BasicStroke(lwidth, 00385 BasicStroke.CAP_BUTT, 00386 BasicStroke.JOIN_MITER, 00387 10.f, dash, 0.f)); 00388 } else { 00389 super.setupDrawMode(g); 00390 if (getDrawMode() == XOR_MODE) { 00391 g.setColor(DEF_COLOR); 00392 } else { 00393 g.setColor(drawColor); 00394 } 00395 } 00396 } |
|
00400 { 00401 this.complex = complex; 00402 } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|