1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845
|
//******************************************************************************
//
// File: Drawing.java
// Package: edu.rit.draw
// Unit: Class edu.rit.draw.Drawing
//
// This Java source file is copyright (C) 2008 by Alan Kaminsky. All rights
// reserved. For further information, contact the author, Alan Kaminsky, at
// ark@cs.rit.edu.
//
// This Java source file is part of the Parallel Java Library ("PJ"). PJ is free
// software; you can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation; either
// version 3 of the License, or (at your option) any later version.
//
// PJ is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
// A PARTICULAR PURPOSE. See the GNU General Public License for more details.
//
// Linking this library statically or dynamically with other modules is making a
// combined work based on this library. Thus, the terms and conditions of the
// GNU General Public License cover the whole combination.
//
// As a special exception, the copyright holders of this library give you
// permission to link this library with independent modules to produce an
// executable, regardless of the license terms of these independent modules, and
// to copy and distribute the resulting executable under terms of your choice,
// provided that you also meet, for each linked independent module, the terms
// and conditions of the license of that module. An independent module is a
// module which is not derived from or based on this library. If you modify this
// library, you may extend this exception to your version of the library, but
// you are not obligated to do so. If you do not wish to do so, delete this
// exception statement from your version.
//
// A copy of the GNU General Public License is provided in the file gpl.txt. You
// may also obtain a copy of the GNU General Public License on the World Wide
// Web at http://www.gnu.org/licenses/gpl.html.
//
//******************************************************************************
package edu.rit.draw;
import edu.rit.draw.item.ColorFill;
import edu.rit.draw.item.DrawingItem;
import edu.rit.draw.item.Group;
import edu.rit.draw.item.Point;
import edu.rit.draw.item.Size;
import edu.rit.swing.Displayable;
import edu.rit.swing.DisplayableFrame;
import edu.rit.swing.Viewable;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.RenderingHints;
import java.awt.Stroke;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.io.Externalizable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import java.util.LinkedList;
/**
* Class Drawing provides a drawing. A drawing consists of a sequence of
* {@linkplain DrawingItem}s, which are displayed in order. Thus, a drawing item
* later in the sequence will obscure a drawing item earlier in the sequence if
* the items overlap.
* <P>
* A drawing contains a {@linkplain ColorFill} object that tells how to color
* the drawing's background.
* <P>
* A drawing contains the size of the rectangular region within which the
* drawing items are to be displayed. By default, the display region is just
* large enough to contain all the drawing items, plus a border. Methods are
* provided to specify a different display region if desired.
* <P>
* An instance of class Drawing may be serialized. Class Drawing provides static
* convenience methods to write a drawing to a file and read a drawing from a
* file. A drawing file is simply a binary file that contains a serialized
* drawing object. The {@linkplain View} program can be used to display the
* drawing file.
* <P>
* There is a default drawing. Initially, the default drawing is a new drawing
* object. The default drawing may be changed, or set to null to signify that
* there is no default drawing. A {@linkplain DrawingItem}'s <TT>add()</TT> and
* <TT>addFirst()</TT> methods add the drawing item to the default drawing (if
* there is one).
*
* @author Alan Kaminsky
* @version 18-Jul-2008
*/
public class Drawing
implements Externalizable, Viewable
{
// Exported enumerations.
/**
* Enumeration Drawing.Alignment specifies how a {@linkplain Drawing}'s
* items are to be aligned within the drawing's display region.
*
* @author Alan Kaminsky
* @version 10-Jul-2006
*/
public enum Alignment
{
/**
* No alignment. Items are drawn at their own locations and are not
* aligned to the display region.
*/
NONE,
/**
* Align the northwest corner of the drawing items to the northwest
* corner point of the display region, inset by the border.
*/
NORTHWEST,
/**
* Align the north middle of the drawing items to the north middle point
* of the display region, inset by the border.
*/
NORTH,
/**
* Align the northeast corner of the drawing items to the northeast
* corner point of the display region, inset by the border.
*/
NORTHEAST,
/**
* Align the west middle of the drawing items to the west middle point
* of the display region, inset by the border.
*/
WEST,
/**
* Align the center of the drawing items to the center point of the
* display region, inset by the border.
*/
CENTER,
/**
* Align the east middle of the drawing items to the east middle point
* of the display region, inset by the border.
*/
EAST,
/**
* Align the southwest corner of the drawing items to the southwest
* corner point of the display region, inset by the border.
*/
SOUTHWEST,
/**
* Align the south middle of the drawing items to the south middle point
* of the display region, inset by the border.
*/
SOUTH,
/**
* Align the southeast corner of the drawing items to the southeast
* corner point of the display region, inset by the border.
*/
SOUTHEAST,
}
// Exported constants.
/**
* Signifies that the drawing's display region's size should be determined
* automatically based on the drawing items in the drawing. A {@linkplain
* Size} of (0,0) is used for this purpose.
*/
public static final Size AUTOMATIC_SIZE = new Size (0.0, 0.0);
/**
* The normal display region size (automatic).
*/
public static final Size NORMAL_SIZE = AUTOMATIC_SIZE;
/**
* The normal display region border width (2).
*/
public static final double NORMAL_BORDER = 2.0;
/**
* The normal display region/drawing item alignment (northwest).
*/
public static final Alignment NORMAL_ALIGNMENT = Alignment.NORTHWEST;
/**
* The normal background color (white).
*/
public static final ColorFill NORMAL_BACKGROUND = ColorFill.WHITE;
// Hidden data members.
private static final long serialVersionUID = -3240330399842161140L;
private LinkedList<DrawingItem> myItems =
new LinkedList<DrawingItem>();
private Size mySize = NORMAL_SIZE;
private double myBorder = NORMAL_BORDER;
private Alignment myAlignment = NORMAL_ALIGNMENT;
private ColorFill myBackground = NORMAL_BACKGROUND;
private Point myItemsNW;
private Point myItemsSE;
private String myTitle;
private static Drawing theDefaultDrawing = new Drawing();
// Exported constructors.
/**
* Construct a new drawing. The drawing contains no drawing items. The
* normal size (automatic), normal border (2), normal alignment (northwest),
* and normal background color (white) are used.
*/
public Drawing()
{
}
// Exported operations.
/**
* Returns the default drawing.
*
* @return Default drawing, or null if there is no default drawing.
*/
public static Drawing defaultDrawing()
{
return theDefaultDrawing;
}
/**
* Set the default drawing.
*
* @param theDrawing Default drawing, or null if there is no default
* drawing.
*/
public static void defaultDrawing
(Drawing theDrawing)
{
theDefaultDrawing = theDrawing;
}
/**
* Clear this drawing's sequence of drawing items.
*/
public void clear()
{
myItems.clear();
}
/**
* Add the given drawing item to the end of this drawing's sequence of
* drawing items.
*
* @param theItem Drawing item.
*
* @exception NullPointerException
* (unchecked exception) Thrown if <TT>theItem</TT> is null.
*/
public void add
(DrawingItem theItem)
{
if (theItem == null) throw new NullPointerException();
myItems.add (theItem);
}
/**
* Add the given drawing item to the beginning of this drawing's sequence of
* drawing items.
*
* @param theItem Drawing item.
*
* @exception NullPointerException
* (unchecked exception) Thrown if <TT>theItem</TT> is null.
*/
public void addFirst
(DrawingItem theItem)
{
if (theItem == null) throw new NullPointerException();
myItems.addFirst (theItem);
}
/**
* Returns this drawing's display region's size. This includes the border if
* any. If the return value is equal to <TT>Drawing.AUTOMATIC_SIZE</TT>
* (0,0), it signifies that the drawing's display region's size should be
* determined automatically based on the drawing items in the drawing.
*
* @return Display region size.
*/
public Size size()
{
return mySize;
}
/**
* Set this drawing's display region's size. This includes the border if
* any. If <TT>theSize</TT> is equal to <TT>Drawing.AUTOMATIC_SIZE</TT>
* (0,0), or if either the width or the height of <TT>theSize</TT> is
* negative, it signifies that the drawing's display region's size should be
* determined automatically based on the drawing items in the drawing.
*
* @param theSize Display region size.
*
* @return This drawing object.
*
* @exception NullPointerException
* (unchecked exception) Thrown if <TT>theSize</TT> is null.
*/
public Drawing size
(Size theSize)
{
if (theSize.width() <= 0.0 || theSize.height() <= 0.0)
{
mySize = AUTOMATIC_SIZE;
}
else
{
mySize = theSize;
}
return this;
}
/**
* Returns this drawing's display region's border.
*
* @return Display region border width.
*/
public double border()
{
return myBorder;
}
/**
* Set this drawing's display region's border.
*
* @param theBorder Display region border width.
*
* @return This drawing object.
*
* @exception IllegalArgumentException
* (unchecked exception) Thrown if <TT>theBorder</TT> is less than 0.
*/
public Drawing border
(double theBorder)
{
if (theBorder < 0.0) throw new IllegalArgumentException();
myBorder = theBorder;
return this;
}
/**
* Returns this drawing's alignment. The alignment determines where this
* drawing's drawing items are displayed relative to this drawing's display
* region.
*
* @return Alignment.
*/
public Alignment alignment()
{
return myAlignment;
}
/**
* Set this drawing's alignment. The alignment determines where this
* drawing's drawing items are displayed relative to this drawing's display
* region.
*
* @param theAlignment Alignment.
*
* @return This drawing object.
*
* @exception NullPointerException
* (unchecked exception) Thrown if <TT>theAlignment</TT> is null.
*/
public Drawing alignment
(Alignment theAlignment)
{
if (theAlignment == null) throw new NullPointerException();
myAlignment = theAlignment;
return this;
}
/**
* Returns this drawing's background color fill.
*
* @return Background color fill.
*/
public ColorFill background()
{
return myBackground;
}
/**
* Set this drawing's background color fill.
*
* @param theBackground Background color fill.
*
* @return This drawing object.
*
* @exception NullPointerException
* (unchecked exception) Thrown if <TT>theBackground</TT> is null.
*/
public Drawing background
(ColorFill theBackground)
{
if (theBackground == null) throw new NullPointerException();
myBackground = theBackground;
return this;
}
/**
* Returns a {@linkplain edu.rit.draw.item.Group Group} consisting of the
* drawing items in this drawing. In this way, one drawing can be embedded
* (as a Grouip) inside another drawing.
*
* @return Group.
*/
public Group asGroup()
{
Group group = new Group();
for (DrawingItem item : myItems)
{
group.append (item);
}
return group;
}
/**
* Write this drawing to the given object output stream.
*
* @param out Object output stream.
*
* @exception IOException
* Thrown if an I/O error occurred.
*/
public void writeExternal
(ObjectOutput out)
throws IOException
{
out.writeInt (myItems.size());
for (DrawingItem item : myItems)
{
out.writeObject (item);
}
out.writeObject (mySize);
out.writeDouble (myBorder);
out.writeObject (myAlignment);
out.writeObject (myBackground);
out.writeObject (myTitle);
}
/**
* Read this drawing from the given object input stream.
*
* @param in Object input stream.
*
* @exception IOException
* Thrown if an I/O error occurred.
* @exception ClassNotFoundException
* Thrown if a class needed to deserialize this drawing cannot be found.
*/
public void readExternal
(ObjectInput in)
throws IOException, ClassNotFoundException
{
int n = in.readInt();
myItems.clear();
for (int i = 0; i < n; ++ i)
{
myItems.add ((DrawingItem) in.readObject());
}
mySize = (Size) in.readObject();
myBorder = in.readDouble();
myAlignment = (Alignment) in.readObject();
myBackground = (ColorFill) in.readObject();
myTitle = (String) in.readObject();
}
/**
* Write the default drawing to the file with the given name. The default
* drawing is written in serialized form to the file. If there is no default
* drawing, the <TT>write()</TT> method does nothing.
*
* @param theFileName File name.
*
* @exception IOException
* Thrown if an I/O error occurred.
*/
public static void write
(String theFileName)
throws IOException
{
if (theDefaultDrawing != null)
{
write (theDefaultDrawing, new File (theFileName));
}
}
/**
* Write the default drawing to the given file. The default drawing is
* written in serialized form to <TT>theFile</TT>. If there is no default
* drawing, the <TT>write()</TT> method does nothing.
*
* @param theFile File.
*
* @exception IOException
* Thrown if an I/O error occurred.
*/
public static void write
(File theFile)
throws IOException
{
if (theDefaultDrawing != null)
{
write (theDefaultDrawing, theFile);
}
}
/**
* Write the given drawing to the file with the given name.
* <TT>theDrawing</TT> is written in serialized form to the file.
*
* @param theDrawing Drawing.
* @param theFileName File name.
*
* @exception IOException
* Thrown if an I/O error occurred.
*/
public static void write
(Drawing theDrawing,
String theFileName)
throws IOException
{
write (theDrawing, new File (theFileName));
}
/**
* Write the given drawing to the given file. <TT>theDrawing</TT> is written
* in serialized form to <TT>theFile</TT>.
*
* @param theDrawing Drawing.
* @param theFile File.
*
* @exception IOException
* Thrown if an I/O error occurred.
*/
public static void write
(Drawing theDrawing,
File theFile)
throws IOException
{
FileOutputStream fos = null;
ObjectOutputStream oos = null;
try
{
fos = new FileOutputStream (theFile);
oos = new ObjectOutputStream (fos);
oos.writeObject (theDrawing);
oos.close();
}
catch (IOException exc)
{
if (fos != null)
{
try { fos.close(); } catch (IOException exc2) {}
}
throw exc;
}
}
/**
* Read a drawing from the file with the given name. The file must contain
* one instance of class Drawing in serialized form; for example, as written
* by the static <TT>Drawing.write()</TT> method.
*
* @param theFileName File name.
*
* @return Drawing.
*
* @exception IOException
* Thrown if an I/O error occurred.
* @exception ClassNotFoundException
* Thrown if any class needed to deserialize the drawing cannot be
* found.
*/
public static Drawing read
(String theFileName)
throws IOException, ClassNotFoundException
{
return read (new File (theFileName));
}
/**
* Read a drawing from the given file. The file must contain one instance of
* class Drawing in serialized form; for example, as written by the static
* <TT>Drawing.write()</TT> method.
*
* @param theFile File.
*
* @return Drawing.
*
* @exception IOException
* Thrown if an I/O error occurred.
* @exception ClassNotFoundException
* Thrown if any class needed to deserialize the drawing cannot be
* found.
*/
public static Drawing read
(File theFile)
throws IOException, ClassNotFoundException
{
FileInputStream fis = null;
ObjectInputStream ois = null;
Drawing result = null;
try
{
fis = new FileInputStream (theFile);
ois = new ObjectInputStream (fis);
result = (Drawing) ois.readObject();
ois.close();
return result;
}
catch (IOException exc)
{
if (fis != null)
{
try { fis.close(); } catch (IOException exc2) {}
}
throw exc;
}
}
// Exported operations implemented from interface Drawable.
/**
* Draw this drawable object in the given graphics context. Upon return from
* this method, the given graphics context's state (color, font, transform,
* clip, and so on) is the same as it was upon entry to this method.
*
* @param g2d 2-D graphics context.
*/
public void draw
(Graphics2D g2d)
{
// Compute translation needed to put the drawing items at the right
// spot.
computeItemsNWSE();
Size itemSize = myItemsSE.difference (myItemsNW);
Size displaySize =
mySize.equals (AUTOMATIC_SIZE) ?
itemSize.add (2.0 * myBorder) :
mySize;
double dwidth = displaySize.width() - itemSize.width();
double dheight = displaySize.height() - itemSize.height();
double dx = 0.0;
double dy = 0.0;
switch (myAlignment)
{
case NONE:
break;
case NORTHWEST:
dx = myBorder - myItemsNW.x();
dy = myBorder - myItemsNW.y();
break;
case NORTH:
dx = 0.5 * dwidth - myItemsNW.x();
dy = myBorder - myItemsNW.y();
break;
case NORTHEAST:
dx = dwidth - myBorder - myItemsNW.x();
dy = myBorder - myItemsNW.y();
break;
case WEST:
dx = myBorder - myItemsNW.x();
dy = 0.5 * dheight - myItemsNW.y();
break;
case CENTER:
dx = 0.5 * dwidth - myItemsNW.x();
dy = 0.5 * dheight - myItemsNW.y();
break;
case EAST:
dx = dwidth - myBorder - myItemsNW.x();
dy = 0.5 * dheight - myItemsNW.y();
break;
case SOUTHWEST:
dx = myBorder - myItemsNW.x();
dy = dheight - myBorder - myItemsNW.y();
break;
case SOUTH:
dx = 0.5 * dwidth - myItemsNW.x();
dy = dheight - myBorder - myItemsNW.y();
break;
case SOUTHEAST:
dx = dwidth - myBorder - myItemsNW.x();
dy = dheight - myBorder - myItemsNW.y();
break;
}
// Save graphics context's state.
Stroke oldStroke = g2d.getStroke();
Paint oldPaint = g2d.getPaint();
AffineTransform oldTransform = g2d.getTransform();
Object oldAntialiasing =
g2d.getRenderingHint
(RenderingHints.KEY_ANTIALIASING);
Object oldTextAntialiasing =
g2d.getRenderingHint
(RenderingHints.KEY_TEXT_ANTIALIASING);
Object oldFractionalMetrics =
g2d.getRenderingHint
(RenderingHints.KEY_FRACTIONALMETRICS);
// Turn on antialiasing.
g2d.setRenderingHint
(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint
(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g2d.setRenderingHint
(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
// Iterate over all drawing items.
for (DrawingItem item : myItems)
{
// Restore graphics context.
g2d.setStroke (oldStroke);
g2d.setPaint (oldPaint);
g2d.setTransform (oldTransform);
g2d.translate (dx, dy);
// Draw item.
item.draw (g2d);
}
// Restore graphics context's state.
g2d.setStroke (oldStroke);
g2d.setPaint (oldPaint);
g2d.setTransform (oldTransform);
g2d.setRenderingHint
(RenderingHints.KEY_ANTIALIASING,
oldAntialiasing);
g2d.setRenderingHint
(RenderingHints.KEY_TEXT_ANTIALIASING,
oldTextAntialiasing);
g2d.setRenderingHint
(RenderingHints.KEY_FRACTIONALMETRICS,
oldFractionalMetrics);
}
// Exported operations implemented from interface Displayable.
/**
* Returns this displayable object's bounding box. This is the smallest
* rectangle that encloses all of this displayable object.
*/
public Rectangle2D getBoundingBox()
{
computeItemsNWSE();
Size displaySize =
mySize.equals (AUTOMATIC_SIZE) ?
myItemsSE.difference (myItemsNW) .add (2.0 * myBorder) :
mySize;
return new Rectangle2D.Double
(0.0, 0.0, displaySize.width(), displaySize.height());
}
/**
* Returns this displayable object's background paint.
*/
public Paint getBackgroundPaint()
{
return myBackground.color();
}
// Exported operations implemented from interface Viewable.
/**
* Get a displayable frame in which to view this viewable object. Initially,
* the returned frame is displaying this viewable object.
*
* @return Displayable frame.
*/
public DisplayableFrame getFrame()
{
return new DrawingFrame (getTitle(), this);
}
/**
* Get the title for the frame used to view this viewable object. If the
* title is null, a default title is used.
*
* @return Title.
*/
public String getTitle()
{
return myTitle;
}
/**
* Set the title for the frame used to view this viewable object. If the
* title is null, a default title is used.
*
* @param theTitle Title.
*/
public void setTitle
(String theTitle)
{
myTitle = theTitle;
}
// Hidden operations.
/**
* Compute the furthest northwest and furthest southeast points of all this
* drawing's drawing items. Store the results in myItemsNW and myItemsSE.
*/
private void computeItemsNWSE()
{
Rectangle2D bbox = new Rectangle2D.Double();
for (DrawingItem item : myItems)
{
bbox = bbox.createUnion (item.boundingBox());
}
myItemsNW = new Point (bbox.getX(), bbox.getY());
myItemsSE = new Point
(bbox.getX()+bbox.getWidth(), bbox.getY()+bbox.getHeight());
}
}
|