ilog.views
Class IlvRect

java.lang.Object
  extended by java.awt.geom.RectangularShape
      extended by java.awt.geom.Rectangle2D
          extended by java.awt.geom.Rectangle2D.Float
              extended by ilog.views.IlvRect
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable, java.lang.Cloneable

public class IlvRect
extends java.awt.geom.Rectangle2D.Float
implements java.io.Serializable

The IlvRect class describes a rectangle defined by a location (x, y) and dimension (width x height).

This class is a serializable subclass of the Java class Rectangle2D.Float.

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
 
Fields inherited from class java.awt.geom.Rectangle2D.Float
height, width, x, y
 
Fields inherited from class java.awt.geom.Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
 
Constructor Summary
IlvRect()
          Constructs a new IlvRect, initialized to location (0.0, 0.0) and size (0.0, 0.0).
IlvRect(float x, float y, float width, float height)
          Constructs and initializes an IlvRect from the specified coordinates.
IlvRect(IlvRect rect)
          Creates a new IlvRect by copying the specified one.
 
Method Summary
 void add(float px, float py)
          Adds a point, specified by the arguments px and py, to this IlvRect.
 void add(IlvRect rect)
          Adds a IlvRect object to this IlvRect.
 boolean contains(IlvRect rect)
          Tests if the rectangle contains the specified one.
 void expand(float delta)
          Expands current rectangle by delta in x and y.
 void expand(float dx, float dy)
          Expands current rectangle by dx in x and dy in y.
 void floor()
          Modifies the rectangle so that the values becomes mathematical integers.
 int heightFloor()
          Returns the height of the rectangle as a mathematical integer.
 boolean inside(float x, float y)
          Tests if a particular point lies inside the rectangle.
 void intersection(IlvRect rect)
          Computes the intersection of the rectangle with the specified rectangle.
 boolean intersects(IlvRect rect)
          Tests if the rectangle intersects another one.
 void move(float x, float y)
          Changes the position of the rectangle.
 void reshape(float x, float y, float width, float height)
          Reshapes the rectangle.
 void resize(float width, float height)
          Changes the width and height of the rectangle.
 java.lang.String toString()
          Returns a String that represents the value of this IlvRect.
 void translate(float dx, float dy)
          Translates the rectangle.
 int widthFloor()
          Returns the width of the rectangle as a mathematical integer.
 int xFloor()
          Returns the x coordinate of the rectangle as a mathematical integer.
 int yFloor()
          Returns the y coordinate of the rectangle as a mathematical integer.
 
Methods inherited from class java.awt.geom.Rectangle2D.Float
createIntersection, createUnion, getBounds2D, getHeight, getWidth, getX, getY, isEmpty, outcode, setRect, setRect, setRect
 
Methods inherited from class java.awt.geom.Rectangle2D
add, add, add, contains, contains, equals, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, union
 
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlvRect

public IlvRect()
Constructs a new IlvRect, initialized to location (0.0, 0.0) and size (0.0, 0.0).


IlvRect

public IlvRect(float x,
               float y,
               float width,
               float height)
Constructs and initializes an IlvRect from the specified coordinates.

Parameters:
x - the x coordinate of the upper left corner of the newly constructed IlvRect
y - the y coordinate of the upper left corner of the newly constructed IlvRect
width - the width of the newly constructed IlvRect
height - the height of the newly constructed IlvRect

IlvRect

public IlvRect(IlvRect rect)
Creates a new IlvRect by copying the specified one.

Parameters:
rect - The copied rectangle.
Method Detail

add

public final void add(float px,
                      float py)
Adds a point, specified by the arguments px and py, to this IlvRect. The resulting IlvRect is the smallest IlvRect that contains both the original IlvRect and the specified point.


add

public final void add(IlvRect rect)
Adds a IlvRect object to this IlvRect. The resulting IlvRect is the union of the two IlvRect objects.

Parameters:
rect - the IlvRect to add to this IlvRect.

inside

public final boolean inside(float x,
                            float y)
Tests if a particular point lies inside the rectangle.


move

public final void move(float x,
                       float y)
Changes the position of the rectangle.


translate

public final void translate(float dx,
                            float dy)
Translates the rectangle.


resize

public final void resize(float width,
                         float height)
Changes the width and height of the rectangle.


reshape

public final void reshape(float x,
                          float y,
                          float width,
                          float height)
Reshapes the rectangle.


expand

public final void expand(float delta)
Expands current rectangle by delta in x and y. If delta is negative, and 2*delta is bigger than the current width, the new width is set to 0. If delta is negative, and 2*delta is bigger than the current height, the new height is set to 0.


expand

public final void expand(float dx,
                         float dy)
Expands current rectangle by dx in x and dy in y. If dx is negative, and 2*dx is bigger than the current width, the new width is set to 0. If dy is negative, and 2*dy is bigger than the current height, the new height is set to 0.


contains

public final boolean contains(IlvRect rect)
Tests if the rectangle contains the specified one.


intersects

public final boolean intersects(IlvRect rect)
Tests if the rectangle intersects another one.


intersection

public final void intersection(IlvRect rect)
Computes the intersection of the rectangle with the specified rectangle. The result of the intersection is stored in this, the rectangle passed as a parameter is not modified.


floor

public final void floor()
Modifies the rectangle so that the values becomes mathematical integers. This is useful when you need to use a rectangle to draw on a view.

See Also:
xFloor(), yFloor(), widthFloor(), heightFloor(), IlvTransformer.applyFloor(ilog.views.IlvRect)

xFloor

public final int xFloor()
Returns the x coordinate of the rectangle as a mathematical integer. This is useful when you need to use a rectangle to draw on a view.

See Also:
floor(), yFloor(), widthFloor(), heightFloor(), IlvTransformer.applyFloor(ilog.views.IlvRect)

yFloor

public final int yFloor()
Returns the y coordinate of the rectangle as a mathematical integer. This is useful when you need to use a rectangle to draw on a view.

See Also:
floor(), xFloor(), widthFloor(), heightFloor(), IlvTransformer.applyFloor(ilog.views.IlvRect)

widthFloor

public final int widthFloor()
Returns the width of the rectangle as a mathematical integer. This is useful when you need to use a rectangle to draw on a view.

See Also:
floor(), xFloor(), yFloor(), heightFloor(), IlvTransformer.applyFloor(ilog.views.IlvRect)

heightFloor

public final int heightFloor()
Returns the height of the rectangle as a mathematical integer. This is useful when you need to use a rectangle to draw on a view.

See Also:
floor(), xFloor(), widthFloor(), yFloor(), IlvTransformer.applyFloor(ilog.views.IlvRect)

toString

public java.lang.String toString()
Returns a String that represents the value of this IlvRect.

Overrides:
toString in class java.awt.geom.Rectangle2D.Float
Returns:
a string representation of this IlvRect.


Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.