com.sun.electric.database.geometry
Class ERectangle

java.lang.Object
  extended by java.awt.geom.RectangularShape
      extended by java.awt.geom.Rectangle2D
          extended by com.sun.electric.database.geometry.ERectangle
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable, java.lang.Cloneable

public class ERectangle
extends java.awt.geom.Rectangle2D
implements java.io.Serializable

The ERectangle immutable class defines a point representing defined by a location (x, y) and dimension (w x h).

This class is used in Electric database.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D
java.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float
 
Field Summary
static ImmutableArrayList<ERectangle> EMPTY_LIST
           
static ERectangle[] NULL_ARRAY
           
static ERectangle ORIGIN
           
 
Fields inherited from class java.awt.geom.Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
 
Method Summary
 java.awt.geom.Rectangle2D createIntersection(java.awt.geom.Rectangle2D r)
           
 java.awt.geom.Rectangle2D createUnion(java.awt.geom.Rectangle2D r)
           
static ERectangle fromGrid(long x, long y, long w, long h)
          Constructs and initializes a ERectangle from the specified long coordinates in grid units.
static ERectangle fromGrid(java.awt.geom.Rectangle2D r)
          Returns ERectangle from specified Rectangle2D in grid units snapped to the grid.
static ERectangle fromLambda(double x, double y, double w, double h)
          Constructs and initializes a ERectangle from the specified long coordinates in lambda units.
static ERectangle fromLambda(java.awt.geom.Rectangle2D r)
          Returns ERectangle from specified Rectangle2D in lambda units snapped to the grid.
 java.awt.Rectangle getBounds()
          Returns the bounding box of the ERectangle.
 java.awt.geom.Rectangle2D getBounds2D()
           
 double getGridCenterX()
          Returns the X coordinate of the center of this ERectangle in grid units in long precision.
 double getGridCenterY()
          Returns the Y coordinate of the center of this ERectangle in grid units in long precision.
 long getGridHeight()
          Returns the heigth of this ERectangle in grid units in long precision.
 long getGridMaxX()
          Returns the largest X coordinate of this ERectangle in grid units in long precision.
 long getGridMaxY()
          Returns the largest Y coordinate of this ERectangle in grid units in long precision.
 long getGridMinX()
          Returns the smallest X coordinate of this ERectangle in grid units in long precision.
 long getGridMinY()
          Returns the smallest Y coordinate of this ERectangle in grid units in long precision.
 long getGridWidth()
          Returns the width of this ERectangle in grid units in long precision.
 long getGridX()
          Returns the X coordinate of this ERectangle in grid units in long precision.
 long getGridY()
          Returns the Y coordinate of this ERectangle in grid units in long precision.
 double getHeight()
          Returns the heigth of this ERectangle in lambda units in double precision.
 double getLambdaCenterX()
          Returns the X coordinate of the center of this ERectangle in lambda units in double precision.
 double getLambdaCenterY()
          Returns the Y coordinate of the center of this ERectangle in lambda units in double precision.
 double getLambdaHeight()
          Returns the heigth of this ERectangle in lambda units in double precision.
 double getLambdaMaxX()
          Returns the largest X coordinate of this ERectangle in lambda units in double precision.
 double getLambdaMaxY()
          Returns the largest Y coordinate of this ERectangle in lambda units in double precision.
 double getLambdaMinX()
          Returns the smallest X coordinate of this ERectangle in lambda units in double precision.
 double getLambdaMinY()
          Returns the smallest Y coordinate of this ERectangle in lambda units in double precision.
 double getLambdaWidth()
          Returns the width of this ERectangle in lambda units in double precision.
 double getLambdaX()
          Returns the X coordinate of this ERectangle in lambda units in double precision.
 double getLambdaY()
          Returns the Y coordinate of this ERectangle in lambda units in double precision.
 double getMaxX()
          Returns the largest X coordinate of this ERectangle in lambda units in double precision.
 double getMaxY()
          Returns the largest Y coordinate of this ERectangle in lambda units in double precision.
 double getWidth()
          Returns the width of this ERectangle in lambda units in double precision.
 double getX()
          Returns the X coordinate of this ERectangle in lambda units in double precision.
 double getY()
          Returns the Y coordinate of this ERectangle in lambda units in double precision.
 boolean isEmpty()
           
 boolean isSmall()
          Returns true if all coordinates of this EPoint are "small ints".
 int outcode(double x, double y)
           
 void setRect(double x, double y, double w, double h)
           
 java.lang.String toString()
           
 
Methods inherited from class java.awt.geom.Rectangle2D
add, add, add, contains, contains, equals, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union
 
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getCenterX, getCenterY, getFrame, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ORIGIN

public static final ERectangle ORIGIN

NULL_ARRAY

public static final ERectangle[] NULL_ARRAY

EMPTY_LIST

public static final ImmutableArrayList<ERectangle> EMPTY_LIST
Method Detail

fromLambda

public static ERectangle fromLambda(double x,
                                    double y,
                                    double w,
                                    double h)
Constructs and initializes a ERectangle from the specified long coordinates in lambda units.

Parameters:
x - the X coordinates of the upper left corner of the newly constructed ERectangle
y - the Y coordinates of the upper left corner of the newly constructed ERectangle
w - the width of the newly constructed ERectangle
h - the height of the newly constructed ERectangle

fromGrid

public static ERectangle fromGrid(long x,
                                  long y,
                                  long w,
                                  long h)
Constructs and initializes a ERectangle from the specified long coordinates in grid units.

Parameters:
x - the X coordinates of the upper left corner of the newly constructed ERectangle
y - the Y coordinates of the upper left corner of the newly constructed ERectangle
w - the width of the newly constructed ERectangle
h - the height of the newly constructed ERectangle

fromLambda

public static ERectangle fromLambda(java.awt.geom.Rectangle2D r)
Returns ERectangle from specified Rectangle2D in lambda units snapped to the grid.

Parameters:
r - specified ERectangle
Returns:
Snapped ERectangle

fromGrid

public static ERectangle fromGrid(java.awt.geom.Rectangle2D r)
Returns ERectangle from specified Rectangle2D in grid units snapped to the grid.

Parameters:
r - specified ERectangle
Returns:
Snapped ERectangle

getX

public double getX()
Returns the X coordinate of this ERectangle in lambda units in double precision.

Specified by:
getX in class java.awt.geom.RectangularShape
Returns:
the X coordinate of this ERectangle.

getY

public double getY()
Returns the Y coordinate of this ERectangle in lambda units in double precision.

Specified by:
getY in class java.awt.geom.RectangularShape
Returns:
the X coordinate of this ERectangle.

getWidth

public double getWidth()
Returns the width of this ERectangle in lambda units in double precision.

Specified by:
getWidth in class java.awt.geom.RectangularShape
Returns:
the width of this ERectangle.

getHeight

public double getHeight()
Returns the heigth of this ERectangle in lambda units in double precision.

Specified by:
getHeight in class java.awt.geom.RectangularShape
Returns:
the heigth of this ERectangle.

getMaxX

public double getMaxX()
Returns the largest X coordinate of this ERectangle in lambda units in double precision.

Overrides:
getMaxX in class java.awt.geom.RectangularShape
Returns:
the largest x coordinate of this ERectangle.

getMaxY

public double getMaxY()
Returns the largest Y coordinate of this ERectangle in lambda units in double precision.

Overrides:
getMaxY in class java.awt.geom.RectangularShape
Returns:
the largest y coordinate of this ERectangle.

getLambdaX

public double getLambdaX()
Returns the X coordinate of this ERectangle in lambda units in double precision.

Returns:
the X coordinate of this ERectangle.

getLambdaY

public double getLambdaY()
Returns the Y coordinate of this ERectangle in lambda units in double precision.

Returns:
the X coordinate of this ERectangle.

getLambdaWidth

public double getLambdaWidth()
Returns the width of this ERectangle in lambda units in double precision.

Returns:
the width of this ERectangle.

getLambdaHeight

public double getLambdaHeight()
Returns the heigth of this ERectangle in lambda units in double precision.

Returns:
the heigth of this ERectangle.

getLambdaMinX

public double getLambdaMinX()
Returns the smallest X coordinate of this ERectangle in lambda units in double precision.

Returns:
the smallest x coordinate of this ERectangle.

getLambdaMinY

public double getLambdaMinY()
Returns the smallest Y coordinate of this ERectangle in lambda units in double precision.

Returns:
the smallest y coordinate of this ERectangle.

getLambdaMaxX

public double getLambdaMaxX()
Returns the largest X coordinate of this ERectangle in lambda units in double precision.

Returns:
the largest x coordinate of this ERectangle.

getLambdaMaxY

public double getLambdaMaxY()
Returns the largest Y coordinate of this ERectangle in lambda units in double precision.

Returns:
the largest y coordinate of this ERectangle.

getLambdaCenterX

public double getLambdaCenterX()
Returns the X coordinate of the center of this ERectangle in lambda units in double precision.

Returns:
the x coordinate of this ERectangle object's center.

getLambdaCenterY

public double getLambdaCenterY()
Returns the Y coordinate of the center of this ERectangle in lambda units in double precision.

Returns:
the y coordinate of this ERectangle object's center.

getGridX

public long getGridX()
Returns the X coordinate of this ERectangle in grid units in long precision.

Returns:
the X coordinate of this ERectangle.

getGridY

public long getGridY()
Returns the Y coordinate of this ERectangle in grid units in long precision.

Returns:
the X coordinate of this ERectangle.

getGridWidth

public long getGridWidth()
Returns the width of this ERectangle in grid units in long precision.

Returns:
the width of this ERectangle.

getGridHeight

public long getGridHeight()
Returns the heigth of this ERectangle in grid units in long precision.

Returns:
the heigth of this ERectangle.

getGridMinX

public long getGridMinX()
Returns the smallest X coordinate of this ERectangle in grid units in long precision.

Returns:
the smallest x coordinate of this ERectangle.

getGridMinY

public long getGridMinY()
Returns the smallest Y coordinate of this ERectangle in grid units in long precision.

Returns:
the smallest y coordinate of this ERectangle.

getGridMaxX

public long getGridMaxX()
Returns the largest X coordinate of this ERectangle in grid units in long precision.

Returns:
the largest x coordinate of this ERectangle.

getGridMaxY

public long getGridMaxY()
Returns the largest Y coordinate of this ERectangle in grid units in long precision.

Returns:
the largest y coordinate of this ERectangle.

getGridCenterX

public double getGridCenterX()
Returns the X coordinate of the center of this ERectangle in grid units in long precision.

Returns:
the x coordinate of this ERectangle object's center.

getGridCenterY

public double getGridCenterY()
Returns the Y coordinate of the center of this ERectangle in grid units in long precision.

Returns:
the y coordinate of this ERectangle object's center.

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in class java.awt.geom.RectangularShape

isSmall

public boolean isSmall()
Returns true if all coordinates of this EPoint are "small ints".

Returns:
true if all coordinates of this EPoint are "small ints".
See Also:
GenMath.MIN_SMALL_COORD, GenMath.MAX_SMALL_COORD

setRect

public void setRect(double x,
                    double y,
                    double w,
                    double h)
Specified by:
setRect in class java.awt.geom.Rectangle2D

outcode

public int outcode(double x,
                   double y)
Specified by:
outcode in class java.awt.geom.Rectangle2D

getBounds2D

public java.awt.geom.Rectangle2D getBounds2D()
Specified by:
getBounds2D in interface java.awt.Shape
Overrides:
getBounds2D in class java.awt.geom.Rectangle2D

getBounds

public java.awt.Rectangle getBounds()
Returns the bounding box of the ERectangle.

Specified by:
getBounds in interface java.awt.Shape
Overrides:
getBounds in class java.awt.geom.RectangularShape
Returns:
a Rectangle object that bounds the ERectangle.

createIntersection

public java.awt.geom.Rectangle2D createIntersection(java.awt.geom.Rectangle2D r)
Specified by:
createIntersection in class java.awt.geom.Rectangle2D

createUnion

public java.awt.geom.Rectangle2D createUnion(java.awt.geom.Rectangle2D r)
Specified by:
createUnion in class java.awt.geom.Rectangle2D

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object