java.awt.geom

Class Rectangle2D

Implemented Interfaces:
Cloneable, Shape
Known Direct Subclasses:
Rectangle, Rectangle2D.Double, Rectangle2D.Float

public abstract class Rectangle2D
extends RectangularShape

The Rectangle2D class describes a rectangle defined by a location (x, y) and dimension (w x h).

This class is only the abstract superclass for all objects that store a 2D rectangle. The actual storage representation of the coordinates is left to the subclass.

Nested Class Summary

static class
Rectangle2D.Double
The Double class defines a rectangle specified in double coordinates.
static class
Rectangle2D.Float
The Float class defines a rectangle specified in float coordinates.

Field Summary

static int
OUT_BOTTOM
The bitmask that indicates that a point lies below this Rectangle2D.
static int
OUT_LEFT
The bitmask that indicates that a point lies to the left of this Rectangle2D.
static int
OUT_RIGHT
The bitmask that indicates that a point lies to the right of this Rectangle2D.
static int
OUT_TOP
The bitmask that indicates that a point lies above this Rectangle2D.

Constructor Summary

Rectangle2D()
This is an abstract class that cannot be instantiated directly.

Method Summary

void
add(double newx, double newy)
Adds a point, specified by the double precision arguments newx and newy, to this Rectangle2D.
void
add(Point2D pt)
Adds the Point2D object pt to this Rectangle2D.
void
add(Rectangle2D r)
Adds a Rectangle2D object to this Rectangle2D.
boolean
contains(double x, double y)
Tests if a specified coordinate is inside the boundary of this Rectangle2D.
boolean
contains(double x, double y, double w, double h)
Tests if the interior of this Rectangle2D entirely contains the specified set of rectangular coordinates.
abstract Rectangle2D
createIntersection(Rectangle2D r)
Returns a new Rectangle2D object representing the intersection of this Rectangle2D with the specified Rectangle2D.
abstract Rectangle2D
createUnion(Rectangle2D r)
Returns a new Rectangle2D object representing the union of this Rectangle2D with the specified Rectangle2D.
boolean
equals(Object obj)
Determines whether or not the specified Object is equal to this Rectangle2D.
Rectangle2D
getBounds2D()
Returns the high precision bounding box of this Rectangle2D.
PathIterator
getPathIterator(AffineTransform at)
Returns an iteration object that defines the boundary of this Rectangle2D.
PathIterator
getPathIterator(AffineTransform at, double flatness)
Returns an iteration object that defines the boundary of the flattened Rectangle2D.
int
hashCode()
Returns the hashcode for this Rectangle2D.
static void
intersect(Rectangle2D src1, Rectangle2D src2, Rectangle2D dest)
Intersects the pair of specified source Rectangle2D objects and puts the result into the specified destination Rectangle2D object.
boolean
intersects(double x, double y, double w, double h)
Tests if the interior of this Rectangle2D intersects the interior of a specified set of rectangular coordinates.
boolean
intersectsLine(double x1, double y1, double x2, double y2)
Tests if the specified line segment intersects the interior of this Rectangle2D.
boolean
intersectsLine(Line2D l)
Tests if the specified line segment intersects the interior of this Rectangle2D.
abstract int
outcode(double x, double y)
Determines where the specified coordinates lie with respect to this Rectangle2D.
int
outcode(Point2D p)
Determines where the specified Point2D lies with respect to this Rectangle2D.
void
setFrame(double x, double y, double w, double h)
Sets the location and size of the outer bounds of this Rectangle2D to the specified rectangular values.
abstract void
setRect(double x, double y, double w, double h)
Sets the location and size of this Rectangle2D to the specified double values.
void
setRect(Rectangle2D r)
Sets this Rectangle2D to be the same as the specified Rectangle2D.
static void
union(Rectangle2D src1, Rectangle2D src2, Rectangle2D dest)
Unions the pair of source Rectangle2D objects and puts the result into the specified destination Rectangle2D object.

Methods inherited from class java.awt.geom.RectangularShape

clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getHeight, getMaxX, getMaxY, getMinX, getMinY, getPathIterator, getWidth, getX, getY, intersects, isEmpty, setFrame, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

OUT_BOTTOM

public static final int OUT_BOTTOM
The bitmask that indicates that a point lies below this Rectangle2D.
Field Value:
8
Since:
1.2
Usages and Demos :

View More Examples of Rectangle2D.OUT_BOTTOM
   1:             if (y < Point.this.getY()) {
   2:                 result |= Rectangle2D.OUT_BOTTOM;
   3:             } else if (y > Point.this.getY()) {
   4:                 result |= Rectangle2D.OUT_TOP;
   5:             }

View Full Code Here
   1:                  return 3;
   2:              case Rectangle2D.OUT_RIGHT|Rectangle2D.OUT_BOTTOM:
   3:                  return 4;
   4:         ...
   5:              case Rectangle2D.OUT_BOTTOM:
   6:                  return 5;
   7:         ...
   8:              case Rectangle2D.OUT_BOTTOM|Rectangle2D.OUT_LEFT:
   9:                  return 6;

View Full Code Here

OUT_LEFT

public static final int OUT_LEFT
The bitmask that indicates that a point lies to the left of this Rectangle2D.
Field Value:
1
Since:
1.2
Usages and Demos :

View More Examples of Rectangle2D.OUT_LEFT
   1:             if (x < Point.this.getX()) {
   2:                 result |= Rectangle2D.OUT_LEFT;
   3:             } else if (x > Point.this.getX()) {
   4:                 result |= Rectangle2D.OUT_RIGHT;
   5:             }

View Full Code Here
   1:                  return 5;
   2:              case Rectangle2D.OUT_BOTTOM|Rectangle2D.OUT_LEFT:
   3:                  return 6;
   4:         ...
   5:              case Rectangle2D.OUT_LEFT:
   6:                  return 7;
   7:         ...
   8:              case Rectangle2D.OUT_LEFT|Rectangle2D.OUT_TOP:
   9:                  return 8;

View Full Code Here

OUT_RIGHT

public static final int OUT_RIGHT
The bitmask that indicates that a point lies to the right of this Rectangle2D.
Field Value:
4
Since:
1.2
Usages and Demos :

View More Examples of Rectangle2D.OUT_RIGHT
   1:             } else if (x > Point.this.getX()) {
   2:                 result |= Rectangle2D.OUT_RIGHT;
   3:             }
   4: 
   5:             if (y < Point.this.getY()) {

View Full Code Here
   1:                  return 1;
   2:              case Rectangle2D.OUT_TOP|Rectangle2D.OUT_RIGHT:
   3:                  return 2;
   4:         ...
   5:              case Rectangle2D.OUT_RIGHT:
   6:                  return 3;
   7:         ...
   8:              case Rectangle2D.OUT_RIGHT|Rectangle2D.OUT_BOTTOM:
   9:                  return 4;

View Full Code Here

OUT_TOP

public static final int OUT_TOP
The bitmask that indicates that a point lies above this Rectangle2D.
Field Value:
2
Since:
1.2
Usages and Demos :

View More Examples of Rectangle2D.OUT_TOP
   1:             } else if (y > Point.this.getY()) {
   2:                 result |= Rectangle2D.OUT_TOP;
   3:             }
   4: 
   5:             return result;

View Full Code Here
   1:             switch(oc){
   2:              case Rectangle2D.OUT_TOP:
   3:                  return 1;
   4:         ...
   5:              case Rectangle2D.OUT_TOP|Rectangle2D.OUT_RIGHT:
   6:                  return 2;
   7:         ...
   8:                  return 7;
   9:              case Rectangle2D.OUT_LEFT|Rectangle2D.OUT_TOP:
  10:                  return 8;

View Full Code Here

Constructor Details

Rectangle2D

protected Rectangle2D()
This is an abstract class that cannot be instantiated directly. Type-specific implementation subclasses are available for instantiation and provide a number of formats for storing the information necessary to satisfy the various accessor methods below.

Method Details

add

public void add(double newx,
                double newy)
Adds a point, specified by the double precision arguments newx and newy, to this Rectangle2D. The resulting Rectangle2D is the smallest Rectangle2D that contains both the original Rectangle2D and the specified point.

After adding a point, a call to contains with the added point as an argument does not necessarily return true. The contains method does not return true for points on the right or bottom edges of a rectangle. Therefore, if the added point falls on the left or bottom edge of the enlarged rectangle, contains returns false for that point.

Parameters:
Since:
JDK1.0
Usages and Demos :

View More Examples of add(double newx,double newy)
   1: import java.awt.*;
   2: import java.awt.geom.Rectangle2D;
   3: import java.awt.image.*;
   4:         ...
   5:                     Capabilities capabilities = server.getCapabilities();
   6:                     Rectangle2D rect = null;
   7: 
   8:         ...
   9:                         if (rect == null) {
  10:                             rect = new Rectangle2D.Double(box[0], box[1],
  11:                                     box[2] - box[0], box[3] - box[1]);
  12:         ...
  13:                         } else {
  14:                             rect.add(box[0], box[1]);

View Full Code Here

add

public void add(Point2D pt)
Adds the Point2D object pt to this Rectangle2D. The resulting Rectangle2D is the smallest Rectangle2D that contains both the original Rectangle2D and the specified Point2D.

After adding a point, a call to contains with the added point as an argument does not necessarily return true. The contains method does not return true for points on the right or bottom edges of a rectangle. Therefore, if the added point falls on the left or bottom edge of the enlarged rectangle, contains returns false for that point.

Parameters:
pt - the new Point2D to add to this Rectangle2D.
Since:
JDK1.0
Usages and Demos :

View More Examples of add(Point2D pt)
   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

add

public void add(Rectangle2D r)
Adds a Rectangle2D object to this Rectangle2D. The resulting Rectangle2D is the union of the two Rectangle2D objects.
Parameters:
r - the Rectangle2D to add to this Rectangle2D.
Since:
JDK1.0
Usages and Demos :

View More Examples of 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

contains

public boolean contains(double x,
                        double y)
Tests if a specified coordinate is inside the boundary of this Rectangle2D.
Specified by:
contains in interface Shape
Parameters:
Returns:
true if the specified coordinates are inside the boundary of this Rectangle2D; false otherwise.
Since:
1.2
Usages and Demos :

View More Examples of contains(double x,double y)
   1: import java.awt.Graphics2D;
   2: import java.awt.geom.Rectangle2D;
   3: import java.awt.event.*;
   4:         ...
   5: 
   6:   protected Rectangle2D BoundingBox;
   7: 
   8:         ...
   9:       }
  10:     return BoundingBox.contains(point.width, point.height);
  11:     }

View Full Code Here
   1: 
   2:         Rectangle2D bounds;
   3:         AffineTransform screenCTM = ((SVGMatrixImpl)getScreenCTM()).getAffineTransform();
   4:         ...
   5:         if (font != null) {
   6:           Rectangle2D textBox = font.getBounds(getText(), xPos, yPos, fontSize);
   7:           Shape transformedTextBox = screenCTM.createTransformedShape(textBox);
   8:         ...
   9:             SVGRect bbox = getBBox();
  10:             offGraphics.draw(new Rectangle2D.Float(bbox.getX(), bbox.getY(), bbox.getWidth(), bbox.getHeight()));
  11:           }
  12:         ...
  13:     Rectangle2D bounds = getBounds();
  14:     return bounds.contains(x,y);

View Full Code Here

contains

public boolean contains(double x,
                        double y,
                        double w,
                        double h)
Tests if the interior of this Rectangle2D entirely contains the specified set of rectangular coordinates.
Specified by:
contains in interface Shape
Parameters:
w - the width of the specified set of rectangular coordinates
h - the height of the specified set of rectangular coordinates
Returns:
true if this Rectangle2D entirely contains specified set of rectangular coordinates; false otherwise.
Since:
1.2

createIntersection

public abstract Rectangle2D createIntersection(Rectangle2D r)
Returns a new Rectangle2D object representing the intersection of this Rectangle2D with the specified Rectangle2D.
Parameters:
r - the Rectangle2D to be intersected with this Rectangle2D
Returns:
the largest Rectangle2D contained in both the specified Rectangle2D and in this Rectangle2D.
Since:
1.2
Usages and Demos :

View More Examples of createIntersection(Rectangle2D r)
   1: import java.awt.Stroke;
   2: import java.awt.geom.Rectangle2D;
   3: import java.util.Iterator;
   4:         ...
   5:       {
   6:         printBand(b, pageBounds.createIntersection(bounds));
   7:       }
   8:         ...
   9:         {
  10:           printBand((MetaBand) e, bounds.createIntersection(elementBounds));
  11:         }
  12:         ...
  13:         {
  14:           printElement(e, bounds.createIntersection(elementBounds));

View Full Code Here
   1:             if (!action.equals("clip")) {
   2:                 Rectangle2D shapeBounds = s.getBounds2D();
   3:         ...
   4:                 Rectangle2D visibleBounds = shapeBounds;
   5:                 if (_usesClip && _clip != null) {
   6:         ...
   7:                     Rectangle2D clipBounds = _clip.getBounds2D();
   8:         ...
   9:                     visibleBounds = shapeBounds.createIntersection(clipBounds);

View Full Code Here

createUnion

public abstract Rectangle2D createUnion(Rectangle2D r)
Returns a new Rectangle2D object representing the union of this Rectangle2D with the specified Rectangle2D.
Parameters:
r - the Rectangle2D to be combined with this Rectangle2D
Returns:
the smallest Rectangle2D containing both the specified Rectangle2D and this Rectangle2D.
Since:
1.2
Usages and Demos :

View More Examples of createUnion(Rectangle2D r)
   1: import java.awt.geom.Point2D;
   2: import java.awt.geom.Rectangle2D;
   3: import java.text.AttributedCharacterIterator;
   4:         ...
   5: 
   6:     public Rectangle2D getBounds2D() {
   7:         syncLayout();
   8:         ...
   9: 
  10:     public Rectangle2D getGeometricBounds() {
  11:         syncLayout();
  12:         ...
  13:         decB = getDecorationOutline(DECORATION_ALL).getBounds2D();
  14:         return gvB.createUnion(decB);

View Full Code Here

equals

public boolean equals(Object obj)
Determines whether or not the specified Object is equal to this Rectangle2D. The specified Object is equal to this Rectangle2D if it is an instance of Rectangle2D and if its location and size are the same as this Rectangle2D.
Overrides:
equals in interface Object
Parameters:
obj - an Object to be compared with this Rectangle2D.
Returns:
true if obj is an instance of Rectangle2D and has the same values; false otherwise.
Since:
1.2
Usages and Demos :

View More Examples of equals(Object obj)
   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:     }

View Full Code Here

getBounds2D

public Rectangle2D getBounds2D()
Returns the high precision bounding box of this Rectangle2D.
Specified by:
getBounds2D in interface Shape
Returns:
the bounding box of this Rectangle2D.
Since:
1.2
Usages and Demos :

View More Examples of getBounds2D()
   1: import java.awt.geom.Point2D;
   2: import java.awt.geom.Rectangle2D;
   3: import java.awt.geom.RectangularShape;
   4:         ...
   5: 
   6:     public static Rectangle2D computeStrokedBounds (Shape shape, Stroke stroke) {
   7:         if(stroke instanceof BasicStroke) {
   8:         ...
   9:             Rectangle2D rect = shape.getBounds2D();
  10:             int width = (int)((BasicStroke) stroke).getLineWidth() + 2;
  11:         ...
  12:         } else {
  13:         Rectangle2D rect = stroke.createStrokedShape(shape).getBounds2D();

View Full Code Here

getPathIterator

public PathIterator getPathIterator(AffineTransform at)
Returns an iteration object that defines the boundary of this Rectangle2D. The iterator for this class is multi-threaded safe, which means that this Rectangle2D class guarantees that modifications to the geometry of this Rectangle2D object do not affect any iterations of that geometry that are already in process.
Specified by:
getPathIterator in interface Shape
Parameters:
at - an optional AffineTransform to be applied to the coordinates as they are returned in the iteration, or null if untransformed coordinates are desired
Returns:
the PathIterator object that returns the geometry of the outline of this Rectangle2D, one segment at a time.
Since:
1.2

getPathIterator

public PathIterator getPathIterator(AffineTransform at,
                                    double flatness)
Returns an iteration object that defines the boundary of the flattened Rectangle2D. Since rectangles are already flat, the flatness parameter is ignored. The iterator for this class is multi-threaded safe, which means that this Rectangle2D class guarantees that modifications to the geometry of this Rectangle2D object do not affect any iterations of that geometry that are already in process.
Specified by:
getPathIterator in interface Shape
Overrides:
getPathIterator in interface RectangularShape
Parameters:
at - an optional AffineTransform to be applied to the coordinates as they are returned in the iteration, or null if untransformed coordinates are desired
flatness - the maximum distance that the line segments used to approximate the curved segments are allowed to deviate from any point on the original curve. Since rectangles are already flat, the flatness parameter is ignored.
Returns:
the PathIterator object that returns the geometry of the outline of this Rectangle2D, one segment at a time.
Since:
1.2

hashCode

public int hashCode()
Returns the hashcode for this Rectangle2D.
Overrides:
hashCode in interface Object
Returns:
the hashcode for this Rectangle2D.
Usages and Demos :

View More Examples of hashCode()
   1: import java.awt.Graphics2D;
   2: import java.awt.geom.Rectangle2D;
   3: import java.io.IOException;
   4:         ...
   5:     
   6:     private transient Rectangle2D bounds;
   7:     
   8:         ...
   9:         this.height = 0.0;
  10:         this.bounds = new Rectangle2D.Float();
  11:         this.margin = RectangleInsets.ZERO_INSETS;
  12:         ...
  13:         int v = 0;
  14:         v = v * 19 ^ border.hashCode();

View Full Code Here

intersect

public static void intersect(Rectangle2D src1,
                             Rectangle2D src2,
                             Rectangle2D dest)
Intersects the pair of specified source Rectangle2D objects and puts the result into the specified destination Rectangle2D object. One of the source rectangles can also be the destination to avoid creating a third Rectangle2D object, but in this case the original points of this source rectangle will be overwritten by this method.
Parameters:
src1 - the first of a pair of Rectangle2D objects to be intersected with each other
src2 - the second of a pair of Rectangle2D objects to be intersected with each other
dest - the Rectangle2D that holds the results of the intersection of src1 and src2
Since:
1.2
Usages and Demos :

View More Examples of intersect(Rectangle2D src1,Rectangle2D src2,Rectangle2D dest)
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.Rectangle2D;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:     Rectangle2D floodRegion;
   7: 
   8:         ...
   9:     public FloodRable8Bit(Rectangle2D floodRegion, 
  10:                               Paint floodPaint) {
  11:         ...
  12: 
  13:             Rectangle2D.intersect(imageRect, userAOI, userAOI);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.Rectangle2D;
   3: import java.awt.image.BufferedImage;
   4:         ...
   5: 
   6:     public Rectangle2D getBounds2D(){
   7:         return getSource().getBounds2D();
   8:         ...
   9: 
  10:         Rectangle2D rect     = getBounds2D();
  11:         Rectangle2D clipRect = clipPath.getBounds2D();
  12:         ...
  13:             return null;
  14:         Rectangle2D.intersect(rect, clipRect, rect);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.Rectangle2D;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5:         Shape aoi = rc.getAreaOfInterest();
   6:         Rectangle2D aoiR;
   7:         if (aoi == null)
   8:         ...
   9:             aoiR = aoi.getBounds2D();
  10:             Rectangle2D bounds2d = getBounds2D();
  11:             if (bounds2d.intersects(aoiR) == false)
  12:         ...
  13: 
  14:             Rectangle2D.intersect(aoiR, bounds2d, aoiR);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.Rectangle2D;
   3: import java.awt.image.BufferedImage;
   4:         ...
   5:     PadMode           padMode;
   6:     Rectangle2D       padRect;
   7: 
   8:         ...
   9:     public PadRable8Bit(Filter src,
  10:                         Rectangle2D padRect,
  11:                         PadMode     padMode) {
  12:         ...
  13:             return null;
  14:         Rectangle2D.intersect(arect, rect, arect);

View Full Code Here
   1: import java.awt.geom.NoninvertibleTransformException;
   2: import java.awt.geom.Rectangle2D;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:     Rectangle2D region;
   7: 
   8:         ...
   9:     public TurbulenceRable8Bit(Rectangle2D region) {
  10:         super();
  11:         ...
  12:                 return null;
  13:             Rectangle2D.intersect(aoiRect, rect, aoiRect);

View Full Code Here

intersects

public boolean intersects(double x,
                          double y,
                          double w,
                          double h)
Tests if the interior of this Rectangle2D intersects the interior of a specified set of rectangular coordinates.
Specified by:
intersects in interface Shape
Parameters:
w - the width of the specified set of rectangular coordinates
h - the height of the specified set of rectangular coordinates
Returns:
true if this Rectangle2D intersects the interior of a specified set of rectangular coordinates; false otherwise.
Since:
1.2

intersectsLine

public boolean intersectsLine(double x1,
                              double y1,
                              double x2,
                              double y2)
Tests if the specified line segment intersects the interior of this Rectangle2D.
Parameters:
Returns:
true if the specified line segment intersects the interior of this Rectangle2D; false otherwise.
Since:
1.2

intersectsLine

public boolean intersectsLine(Line2D l)
Tests if the specified line segment intersects the interior of this Rectangle2D.
Parameters:
l - the specified Line2D to test for intersection with the interior of this Rectangle2D
Returns:
true if the specified Line2D intersects the interior of this Rectangle2D; false otherwise.
Since:
1.2

outcode

public abstract int outcode(double x,
                            double y)
Determines where the specified coordinates lie with respect to this Rectangle2D. This method computes a binary OR of the appropriate mask values indicating, for each side of this Rectangle2D, whether or not the specified coordinates are on the same side of the edge as the rest of this Rectangle2D.
Parameters:
Returns:
the logical OR of all appropriate out codes.
Since:
1.2
Usages and Demos :

View More Examples of outcode(double x,double y)
   1: import java.awt.Shape;
   2: import java.awt.geom.Rectangle2D;
   3: import java.util.Enumeration;
   4:         ...
   5:         if(firstOne != null){
   6:             Rectangle2D b=((Shape)firstOne).getBounds2D();
   7:             b.setFrame(b.getX()+5.,b.getY()+5.,b.getWidth()-10.,b.getHeight()-10.);
   8:         ...
   9:             int oc=b.outcode(x,y);
  10:             switch(oc){
  11:         ...
  12:              case Rectangle2D.OUT_TOP:

View Full Code Here

outcode

public int outcode(Point2D p)
Determines where the specified Point2D lies with respect to this Rectangle2D. This method computes a binary OR of the appropriate mask values indicating, for each side of this Rectangle2D, whether or not the specified Point2D is on the same side of the edge as the rest of this Rectangle2D.
Parameters:
p - the specified Point2D
Returns:
the logical OR of all appropriate out codes.
Since:
1.2

setFrame

public void setFrame(double x,
                     double y,
                     double w,
                     double h)
Sets the location and size of the outer bounds of this Rectangle2D to the specified rectangular values.
Overrides:
setFrame in interface RectangularShape
Parameters:
w - the value to use to set the width of the outer bounds of this Rectangle2D
h - the value to use to set the height of the outer bounds of this Rectangle2D
Since:
1.2
Usages and Demos :

View More Examples of setFrame(double x,double y,double w,double h)
   1: import java.awt.geom.Point2D;
   2: import java.awt.geom.Rectangle2D;
   3: import java.util.Iterator;
   4:         ...
   5:     
   6:     public static Rectangle2D getNodeBounds(
   7:         ...
   8:         ItemRegistry registry, double margin, Rectangle2D b)
   9:     {
  10:         ...
  11:         b.setFrame(Double.NaN,Double.NaN,Double.NaN,Double.NaN);

View Full Code Here
   1: import java.awt.Rectangle;
   2: import java.awt.geom.Rectangle2D;
   3: 
   4:         ...
   5: 
   6:     final Rectangle2D rect = new Rectangle2D.Double();
   7:         ...
   8:     rect.setFrame(rec.x, rec.y, rec.width, rec.height);

View Full Code Here
   1: import java.awt.geom.Point2D;
   2: import java.awt.geom.Rectangle2D;
   3: import java.util.Iterator;
   4:         ...
   5:     
   6:     public static Rectangle2D getBounds(
   7:         ...
   8:         Iterator iter, double margin, Rectangle2D b)
   9:     {
  10:         ...
  11:         b.setFrame(Double.NaN,Double.NaN,Double.NaN,Double.NaN);

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:         }
  10:         m_box.setFrame(tx,ty,w,h);
  11:         return m_box;

View Full Code Here
   1: import java.awt.Rectangle;
   2: import java.awt.geom.Rectangle2D;
   3: 
   4:         ...
   5:       final Dimension dim = getScaledDimension();
   6:       final Rectangle2D rect = new Rectangle2D.Double();
   7:         ...
   8:       rect.setFrame(rec.x, rec.y, rec.width, dim.height);
   9:       state.preparePaint();
  10:         ...
  11: 
  12:       rect.setFrame(rec.x, rec.y - dim.height, rec.width, dim.height);

View Full Code Here

setRect

public abstract void setRect(double x,
                             double y,
                             double w,
                             double h)
Sets the location and size of this Rectangle2D to the specified double values.
Parameters:
w - the value to use to set the width of this Rectangle2D
h - the value to use to set the height of this Rectangle2D
Since:
1.2
Usages and Demos :

View More Examples of setRect(double x,double y,double w,double h)
   1:     private static final Point2D RADIUS = new Point2D.Double(0, rad);
   2:     private Rectangle2D rect = new Rectangle2D.Double();
   3:     private void drawActiveBeacons(Graphics gc, int curWinWidth,
   4:         ...
   5: 
   6:         rect.setRect(0, 0, curWinWidth, curWinHeight);
   7:         if(rect.intersects(ixx, iyy, ir, ir)) {
   8:             gc.fillRect(ix, iy, BEACONSIZE, BEACONSIZE);
   9:             gc.drawString(p.name, ix, iy);

View Full Code Here
   1: import java.awt.geom.Line2D;
   2: import java.awt.geom.Rectangle2D;
   3: 
   4:         ...
   5:         
   6:         s1 = new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0);
   7:         assertFalse(ShapeUtilities.equal(s1, s2));
   8:         ...
   9:         s2 = new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0);
  10:         assertTrue(ShapeUtilities.equal(s1, s2));
  11:         ...
  12: 
  13:     r1.setRect(100, 0, 100, 0);

View Full Code Here
   1: import java.awt.geom.Point2D;
   2: import java.awt.geom.Rectangle2D;
   3: 
   4:         ...
   5:     private MutablePoints points;
   6:     private Rectangle2D bounds = new Rectangle2D.Double(); 
   7: 
   8:         ...
   9:     public void updateBounds() {
  10:         bounds.setRect(0.0d, 0.0d, 0.0d, 0.0d);
  11:         points.getBounds(bounds);

View Full Code Here
   1:         
   2:         Rectangle2D         labelArea       = new Rectangle2D.Double();
   3:         Font                font            = sRC.getFont();
   4:         ...
   5:             g.translate( -width, 0 );
   6:             mouseClickArea.setRect( 0.0 , -width , depth, width );
   7:         } 
   8:         ...
   9:         else {
  10:             mouseClickArea.setRect( -width, 0.0, width, depth );
  11:         }
  12:         ...
  13:         
  14:         labelArea.setRect( -width , 0.0, width, depth );

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:         }
  10:         r.setRect(xmin,ymin,xmax-xmin,ymax-ymin);
  11:     }
  12:         ...
  13:         double w = (r.getWidth() > r.getHeight()) ? r.getWidth() : r.getHeight();
  14:         r.setRect(cx-w,cy-w,cx+w,cy+w);

View Full Code Here

setRect

public void setRect(Rectangle2D r)
Sets this Rectangle2D to be the same as the specified Rectangle2D.
Parameters:
r - the specified Rectangle2D
Since:
1.2
Usages and Demos :

View More Examples of setRect(Rectangle2D r)
   1: import java.awt.geom.Point2D;
   2: import java.awt.geom.Rectangle2D;
   3: 
   4:         ...
   5: 
   6:     Rectangle2D r = new Rectangle2D.Double(-1,-1,0,0);
   7:     public void render(Graphics2D g, VisualItem item) {
   8:         ...
   9:     public Rectangle2D getBoundsRef(VisualItem item) {
  10:         r.setRect(item.getX(), item.getY(),0,0);
  11:         return r;

View Full Code Here
   1: 
   2: import java.awt.geom.Rectangle2D;
   3: import java.util.Hashtable;
   4:         ...
   5: 
   6:     private Rectangle2D  _absoluteBoundingRectangle2D = new Rectangle2D.Double();
   7:     private int          _nMaxTreeDepth;
   8:         ...
   9:     private void _init(int nMaxTreeDepth, Rectangle2D absoluteBoundingRectangle2D) {
  10:         _absoluteBoundingRectangle2D.setRect(absoluteBoundingRectangle2D);
  11:         _nMaxTreeDepth = nMaxTreeDepth;

View Full Code Here
   1: import java.awt.geom.Point2D;
   2: import java.awt.geom.Rectangle2D;
   3: import java.util.ArrayList;
   4:         ...
   5:     private ArrayList m_row  = new ArrayList();
   6:     private Rectangle2D m_r  = new Rectangle2D.Double();
   7:     
   8:         ...
   9:         NodeItem    root   = getLayoutRoot(registry);
  10:         m_r.setRect(getLayoutBounds(registry));
  11:         root.setLocation(0,0);
  12:         ...
  13:         if ( m_frame == 0.0 ) {
  14:             r.setRect(n.getX(), n.getY(),d.getX(), d.getY());

View Full Code Here
   1: 
   2: import java.awt.geom.Rectangle2D;
   3: import java.util.ArrayList;
   4:         ...
   5:     private ArrayList m_row  = new ArrayList();
   6:     private Rectangle2D m_r  = new Rectangle2D.Double();
   7:     
   8:         ...
   9:         Rectangle2D b = getLayoutBounds();
  10:         m_r.setRect(b.getX(), b.getY(), b.getWidth()-1, b.getHeight()-1);
  11:         
  12:         ...
  13:         if ( m_frame == 0.0 ) {
  14:             r.setRect(b);

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:         if (p==null || p.length==0) return;
  10:         r.setRect(p[0].getX(), p[0].getY(), 0.0 ,0.0);
  11:         for (int i=1; i<p.length; ++i) r.add(p[i]);
  12:         ...
  13:         double h = r.getHeight()* factor;
  14:         r.setRect(r.getCenterX()-w*0.5,r.getCenterY()-h*0.5,w,h);

View Full Code Here

union

public static void union(Rectangle2D src1,
                         Rectangle2D src2,
                         Rectangle2D dest)
Unions the pair of source Rectangle2D objects and puts the result into the specified destination Rectangle2D object. One of the source rectangles can also be the destination to avoid creating a third Rectangle2D object, but in this case the original points of this source rectangle will be overwritten by this method.
Parameters:
src1 - the first of a pair of Rectangle2D objects to be combined with each other
src2 - the second of a pair of Rectangle2D objects to be combined with each other
dest - the Rectangle2D that holds the results of the union of src1 and src2
Since:
1.2
Usages and Demos :

View More Examples of union(Rectangle2D src1,Rectangle2D src2,Rectangle2D dest)
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.Rectangle2D;
   3: 
   4:         ...
   5:             TransformContext c,
   6:             Rectangle2D r) {
   7:         return new RectangleDamageRegion(c,r);
   8:         ...
   9: 
  10:     public abstract void extend (Rectangle2D r);
  11: 
  12:         ...
  13:         public void extend (Rectangle2D r) {
  14:             Rectangle2D.union(_rectangle, r, _rectangle);

View Full Code Here
   1: import java.awt.geom.Point2D;
   2: import java.awt.geom.Rectangle2D;
   3: import java.util.List;
   4:         ...
   5: 
   6:     public Rectangle2D getBounds2D() {
   7:         Iterator iter = iterator();
   8:         ...
   9: 
  10:         Rectangle2D ret;
  11:         ret = (Rectangle2D)((Segment)iter.next()).getBounds2D().clone();
  12:         ...
  13:             Rectangle2D segB = seg.getBounds2D();
  14:             Rectangle2D.union(segB, ret, ret);

View Full Code Here
   1: import java.awt.geom.GeneralPath;
   2: import java.awt.geom.Rectangle2D;
   3:         ...
   4: import java.awt.geom.Rectangle2D.Double;
   5: 
   6:         ...
   7:     
   8:     public Rectangle2D getBounds () {
   9:         if(_background == null) {
  10:         ...
  11:             Rectangle2D rout = new Rectangle2D.Double();
  12:             Rectangle2D.union(r1, r2, rout);

View Full Code Here
   1: import java.awt.geom.RectangularShape;
   2: import java.awt.geom.Rectangle2D;
   3: 
   4:         ...
   5: 
   6:     private Rectangle2D _bounds;
   7: 
   8:         ...
   9:     private Rectangle2D _cachedBounds;
  10: 
  11:         ...
  12:             } else {
  13:             Rectangle2D.union(bounds, b, bounds);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.Rectangle2D;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:     public Rectangle2D getBounds2D() {
   7:         ...
   8:         Rectangle2D bounds = null;
   9:         if (this.srcs.size() != 0) {
  10:         ...
  11:                 r = src.getBounds2D();
  12:                 Rectangle2D.union(bounds, r, bounds);

View Full Code Here