Beispiel #1
0
 /** Finds a top level Figure that intersects the given rectangle. */
 public Figure findFigure(Rectangle r) {
   FigureEnumeration k = figuresReverse();
   while (k.hasMoreElements()) {
     Figure figure = k.nextFigure();
     Rectangle fr = figure.displayBox();
     if (r.intersects(fr)) return figure;
   }
   return null;
 }
Beispiel #2
0
 /**
  * Finds a top level Figure that intersects the given rectangle. It supresses the passed in
  * figure. Use this method to ignore a figure that is temporarily inserted into the drawing.
  */
 public Figure findFigure(Rectangle r, Figure without) {
   if (without == null) return findFigure(r);
   FigureEnumeration k = figuresReverse();
   while (k.hasMoreElements()) {
     Figure figure = k.nextFigure();
     Rectangle fr = figure.displayBox();
     if (r.intersects(fr) && !figure.includes(without)) return figure;
   }
   return null;
 }