Inheritance diagram for CanvasFigureAggregate::
Public Methods | |
CanvasFigureAggregate (ScribbleFigure[] figs) | |
CanvasFigureAggregate (ScribbleFigure[] figs, int mode, Color color) | |
CanvasFigureAggregate (Vector figs) | |
CanvasFigureAggregate (Vector figs, int mode, Color color) | |
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) |
void | setDimension (double w, double h) |
Resize CanvasObject to width 'w' and height 'h'. More... | |
void | setZoomFactor (double zoomFactor) |
Scale CanvasObject according to 'zoomFactor'. More... | |
void | doPixelFit (double zoomFactor) |
Round internal ICS values to nearest natural number. More... | |
void | doMove (double w, double h) |
Move CanvasObject 'w' positions in x-direction, and 'h' posi- tions in y-direction. More... | |
void | setColor (Color newColor) |
void | setStroke (boolean stroke) |
void | setLineWidth (float linew) |
void | setTransparency (float trans) |
void | setDrawMode (int mode) |
Set current draw-mode. More... | |
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) |
void | doMove (int w, int h) |
Protected Methods | |
void | initAggregate (int mode, Color color) |
void | setFigures (ScribbleFigure[] figs) |
void | setFigures (Vector figs) |
void | setBox () |
boolean | noneHaveColor () |
Protected Attributes | |
Vector | figures = null |
|
00031 { 00032 this(figs, -1, NO_COLOR); 00033 } |
|
00038 { 00039 super(0., 0., 0., 0.); 00040 setFigures(figs); 00041 initAggregate(mode, color); 00042 } |
|
00046 { 00047 this(figs, -1, NO_COLOR); 00048 } |
|
00052 { 00053 super(0., 0., 0., 0.); 00054 setFigures(figs); 00055 initAggregate(mode, color); 00056 } |
|
Draw CanvasObject on 'g', using internal CCS values.
Reimplemented from CanvasObject.
00063 { 00064 if (figures != null) { 00065 if (!getTransformOK()) { 00066 transformICStoCCS(); 00067 } 00068 for (int i=0; i<figures.size(); i++) { 00069 ((ScribbleFigure)figures.elementAt(i)).draw(g); 00070 } 00071 } 00072 } |
|
Return an identical copy of this CanvasObject.
Reimplemented from CanvasObject.
00076 { 00077 Vector figs = (Vector)figures.clone(); 00078 return (new CanvasFigureAggregate(figs)); 00079 } |
|
00083 { 00084 return (inBoundingBox(x, y)); 00085 } |
|
Resize CanvasObject to width 'w' and height 'h'. Parameters are assumed Image Coordinate System values. Reimplemented from ScribbleObject.
00102 { 00103 if (figures != null) { 00104 ScribbleFigure cf; 00105 double w_scale = Math.abs(w)/getWidth(); 00106 double h_scale = Math.abs(h)/getHeight(); 00107 double d_w = 0; 00108 double d_h = 0; 00109 00110 for (int i=0; i<figures.size(); i++) { 00111 cf = ((ScribbleFigure)figures.elementAt(i)); 00112 d_w = (double)((cf.getX1()-getX1())*w_scale) - (cf.getX1()-getX1()); 00113 d_h = (double)((cf.getY1()-getY1())*h_scale) - (cf.getY1()-getY1()); 00114 00115 cf.doMove(d_w, d_h); 00116 cf.setDimension(cf.getWidth()*w_scale, cf.getHeight()*h_scale); 00117 } 00118 setBox(); 00119 } 00120 00121 if (w < 0. || h < 0.) { 00122 double move_w = 0.; 00123 double move_h = 0.; 00124 00125 if (w < 0.) { 00126 move_w = w; 00127 } 00128 if (h < 0.) { 00129 move_h = h; 00130 } 00131 doMove(move_w, move_h); 00132 } 00133 } |
|
Scale CanvasObject according to 'zoomFactor'. The internal ICS values are taken as base values to calculate the associated CCS values. Reimplemented from CanvasObject.
|
|
Round internal ICS values to nearest natural number. Although the ICS values are changed, they are not converted to 'integer' internally. Reimplemented from ScribbleObject.
|
|
Move CanvasObject 'w' positions in x-direction, and 'h' posi- tions in y-direction. Parameters are assumed Image Coordinate System values. Reimplemented from ScribbleObject.
|
|
Reimplemented from ScribbleFigure.
|
|
Reimplemented from ScribbleFigure.
|
|
Reimplemented from ScribbleFigure.
|
|
Reimplemented from ScribbleFigure.
|
|
Set current draw-mode.
Reimplemented from CanvasObject.
|
|
To be removed.
Reimplemented from CanvasObject.
00246 { 00247 return (inBoundingBoxCcs(x, y)); 00248 } |
|
To be removed.
Reimplemented from CanvasObject.
|
|
Reimplemented from ScribbleObject.
00265 { 00266 if (!getTransformOK()) { 00267 transformICStoCCS(); 00268 } 00269 00270 if (figures != null) { 00271 ScribbleFigure cf; 00272 double w_scale = (double)(Math.abs(w))/(double)getWidthCcs(); 00273 double h_scale = (double)(Math.abs(h))/(double)getHeightCcs(); 00274 int d_w = 0; 00275 int d_h = 0; 00276 00277 for (int i=0; i<figures.size(); i++) { 00278 cf = ((ScribbleFigure)figures.elementAt(i)); 00279 d_w = (int)((cf.getX1Ccs()-getX1Ccs())*w_scale + 0.5) - (cf.getX1Ccs()-getX1Ccs()); 00280 d_h = (int)((cf.getY1Ccs()-getY1Ccs())*h_scale + 0.5) - (cf.getY1Ccs()-getY1Ccs()); 00281 00282 cf.doMove(d_w, d_h); 00283 cf.setDimension((int)(cf.getWidthCcs()*w_scale + 0.5), 00284 (int)(cf.getHeightCcs()*h_scale + 0.5)); 00285 } 00286 setBox(); 00287 } 00288 00289 if (w < 0 || h < 0) { 00290 int move_w = 0; 00291 int move_h = 0; 00292 00293 if (w < 0) { 00294 move_w = w; 00295 } 00296 if (h < 0) { 00297 move_h = h; 00298 } 00299 doMove(move_w, move_h); 00300 } 00301 } |
|
Reimplemented from ScribbleObject.
|
|
00326 { 00327 if (mode > -1) { 00328 setDrawMode(mode); 00329 } 00330 if (color == NO_COLOR) { 00331 if (noneHaveColor()) { 00332 hasNoColor = true; 00333 } else { 00334 hasNoColor = false; 00335 } 00336 } else { 00337 setColor(color); 00338 } 00339 setBox(); 00340 transformICStoCCS(); 00341 } |
|
00345 { 00346 figures = new Vector(figs.length); 00347 for (int i=0; i<figs.length; i++) { 00348 figures.addElement(figs[i].clone()); 00349 ScribbleFigure cf = (ScribbleFigure)figures.elementAt(i); 00350 if (cf instanceof CanvasOval) { 00351 ((CanvasOval)cf).setCircle(false); 00352 } 00353 if (cf instanceof CanvasRectangle) { 00354 ((CanvasRectangle)cf).setSquare(false); 00355 } 00356 } 00357 } |
|
00361 { 00362 figures = new Vector(figs.size()); 00363 for (int i=0; i<figs.size(); i++) { 00364 ScribbleFigure cf = (ScribbleFigure)figs.elementAt(i); 00365 if (cf instanceof CanvasOval) { 00366 ((CanvasOval)cf).setCircle(false); 00367 } 00368 if (cf instanceof CanvasRectangle) { 00369 ((CanvasRectangle)cf).setSquare(false); 00370 } 00371 figures.addElement(cf.clone()); 00372 } 00373 } |
|
00377 { 00378 double ics_maxX = 0.; 00379 double ics_maxY = 0.; 00380 00381 setX1(Double.MAX_VALUE); 00382 setY1(Double.MAX_VALUE); 00383 00384 ScribbleFigure fig; 00385 00386 for (int i=0; i<figures.size(); i++) { 00387 fig = (ScribbleFigure)figures.elementAt(i); 00388 00389 if (fig.getX1() < getX1()) { 00390 setX1(fig.getX1()); 00391 } 00392 if (fig.getY1() < getY1()) { 00393 setY1(fig.getY1()); 00394 } 00395 if (fig.getX1() + fig.getWidth() > ics_maxX) { 00396 ics_maxX = fig.getX1() + fig.getWidth(); 00397 } 00398 if (fig.getY1() + fig.getHeight() > ics_maxY) { 00399 ics_maxY = fig.getY1() + fig.getHeight(); 00400 } 00401 } 00402 00403 setWidth(ics_maxX - getX1()); 00404 setHeight(ics_maxY - getY1()); 00405 setStartX(getX1()); 00406 setStartY(getY1()); 00407 setTransformOK(false); 00408 } |
|
|
|
|