Demos and Usage of java.awt.geom.Rectangle2D.add(Rectangle2D r)


   1: import java.awt.*;
   2: import java.awt.geom.Rectangle2D;
   3: import java.util.ArrayList;
   4:         ...
   5:     public void add(Figure f) {
   6:         figures.add(f);
   7:     }
   8:         ...
   9: 
  10:     public Rectangle2D getBounds(Graphics2D g) {
  11:         Iterator it = figures.iterator();
  12:         ...
  13:         if (!it.hasNext()) return null;
  14:         Rectangle2D r = ((Figure) it.next()).getBounds(g);

View Full Code Here
   1: import java.awt.geom.Point2D;
   2: import java.awt.geom.Rectangle2D;
   3: 
   4:         ...
   5:     private Line2D      m_line = new Line2D.Double();
   6:     private Rectangle2D m_box  = new Rectangle2D.Double();
   7:     
   8:         ...
   9:         } else {
  10:             m_box.add(m_line.getX1(),m_line.getY1());
  11:         ...
  12:             m_box.add(m_line.getX2(),m_line.getY2());

View Full Code Here
   1: import java.awt.geom.Point2D;
   2: import java.awt.geom.Rectangle2D;
   3: 
   4:         ...
   5: 
   6:     public Rectangle2D getPaintedBounds2D(){
   7:         if (painters == null) 
   8:         ...
   9: 
  10:         Rectangle2D bounds = null;
  11:         for (int i=0; i < count; ++i) {
  12:         ...
  13:             if (bounds == null) bounds = (Rectangle2D)pb.clone();
  14:             else                bounds.add(pb);

View Full Code Here
   1: import java.awt.geom.Point2D;
   2: import java.awt.geom.Rectangle2D;
   3: import java.util.ArrayList;
   4:         ...
   5: 
   6:     protected Rectangle2D marqueeBounds;
   7: 
   8:         ...
   9:                 JGraph graph = (JGraph) e.getSource();
  10:                 Rectangle2D bounds = graph
  11:                         .fromScreen((Rectangle2D) marqueeBounds.clone());
  12:         ...
  13:             if (bounds.contains(views[i].getBounds()))
  14:                 list.add(views[i].getCell());

View Full Code Here
   1:   private Rectangle mat;
   2:   private Rectangle2D bounds;
   3:   private Paint paint = Color.white;
   4:         ...
   5:       at = coords.getToWorldTransform(clip.stepToFrame(n));
   6:       bounds.add(at.createTransformedShape(mat).getBounds2D());
   7:     }
   8:     isValidMeasure = true;
   9:   }

View Full Code Here
   1: import java.awt.geom.Point2D;
   2: import java.awt.geom.Rectangle2D;
   3: import java.util.ArrayList;
   4:         ...
   5:             Point2D p1 = points.get(i);
   6:             pointList.add(p0);
   7:             Point2D sp[] = split(p0, p1, maxLength);
   8:         ...
   9:                 for (int j = 0; j < sp.length; ++j) {
  10:                     pointList.add(sp[j]);
  11:                 }
  12:         ...
  13:         }
  14:         pointList.add(points.get(n-1));

View Full Code Here
   1: import java.awt.geom.Point2D;
   2: import java.awt.geom.Rectangle2D;
   3: 
   4:         ...
   5: 
   6:     public static Rectangle2D copyRectangle(Rectangle2D r) {
   7:         return new Rectangle2D.Double(r.getMinX(),r.getMinY(),r.getWidth(),r.getHeight());
   8:         ...
   9:         for (int i = 1; i < p.length; ++i) {
  10:             if (p[i] != null) result.add(p[i]);
  11:         }
  12:         ...
  13:         r.setRect(p[0].getX(), p[0].getY(), 0.0 ,0.0);
  14:         for (int i=1; i<p.length; ++i) r.add(p[i]);

View Full Code Here
   1: 
   2:     protected Rectangle2D calculateRectangle(double posX, double posY, double radius) {
   3:         if (radius == 0) {
   4:         ...
   5: 
   6:         return new Rectangle2D.Double(x, y, width, height);
   7:     }
   8:         ...
   9: 
  10:     private AffineTransform createRotateTransform(Rectangle2D rectangle, double direction) {
  11:         return AffineTransform.getRotateInstance(direction, rectangle.getCenterX(), rectangle.getCenterY());
  12:         ...
  13:         Rectangle2D rectangle = calculateRectangle(posX, posY, radius);
  14:         rectangle.add(rectangle.getWidth() + 1, rectangle.getHeight() + 1);

View Full Code Here
   1: import java.awt.geom.PathIterator;
   2: import java.awt.geom.Rectangle2D;
   3: import java.awt.geom.RectangularShape;
   4:         ...
   5:         }
   6:         Rectangle2D bounds=null;
   7:         for (int i=0; i<shapes.length; i++) {
   8:         ...
   9:                 if (bounds!=null) {
  10:                     bounds.add(point);
  11:                 } else {
  12:         ...
  13:                     bounds = new Rectangle2D.Double(point.getX(), point.getY(), 0, 0);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.Rectangle2D;
   3: import java.awt.image.BufferedImage;
   4:         ...
   5:         if (allowResize) {
   6:             Rectangle2D maxBounds = getBounds();        
   7:             _w = (_w - 2*MARGIN)  * text.length() / oldText.length() + 2*MARGIN;
   8:         ...
   9:             fitText();
  10:             maxBounds.add(getBounds());
  11:             dirtyRectangle = maxBounds.getBounds();
  12:         ...
  13:         String[] actions = super.getActions(x,y,o,context);
  14:         for (int i=0; i<actions.length; ++i) v.add(actions[i]);

View Full Code Here
   1: import java.awt.geom.Dimension2D;
   2: import java.awt.geom.Rectangle2D;
   3: import java.awt.geom.AffineTransform;
   4:         ...
   5: 
   6:     private transient Rectangle2D axisBounds;
   7: 
   8:         ...
   9:     private transient Rectangle2D labelBounds;
  10: 
  11:         ...
  12:         final Rectangle2D bounds = (Rectangle2D) axisBounds.clone();
  13:         if (labelBounds !=null) bounds.add(labelBounds );

View Full Code Here