Package | com.yworks.bridge.geom |
Class | public class Rectangle |
Inheritance | Rectangle Rectangle2D YObject Object |
The constructors that create a Rectangle, and the methods that can modify one, do not prevent setting a negative value for width or height.
A Rectangle whose width or height is negative is considered empty. If the Rectangle is empty, then the isEmpty method returns true. No point can be contained by or inside an empty Rectangle. The values of width and height, however, are still valid. An empty Rectangle still has a location in the coordinate space, and methods that change its size or location remain valid. The behavior of methods that operate on more than one Rectangle is undefined if any of the participating Rectangle objects has a negative width or height. These methods include intersects, intersection, and union.
Property | Defined By | ||
---|---|---|---|
bounds : Rectangle [override] [read-only]
Gets the bounding Rectangle of this Rectangle. | Rectangle | ||
bounds2D : Rectangle2D [override] [read-only]
Return the high precision bounding box of this rectangle. | Rectangle | ||
centerX : Number [read-only]
Returns the X coordinate of the center of this rectangle in double precision. | Rectangle2D | ||
centerY : Number [read-only]
Returns the Y coordinate of the center of this rectangle in double precision. | Rectangle2D | ||
empty : Boolean [override] [read-only]
Determines whether or not this Rectangle is empty. | Rectangle | ||
frame : Rectangle2D
Getter:
Returns the framing Rectangle2D that defines the overall shape of this object. | Rectangle2D | ||
_height : int | Rectangle | ||
height : Number [override] [read-only]
Returns the height of the bounding Rectangle in double precision. | Rectangle | ||
maxX : Number [read-only]
Returns the largest X coordinate of the upper left corner of this rectangle in double precision. | Rectangle2D | ||
maxY : Number [read-only]
Returns the largest Y coordinate of the upper left corner of this rectangle in double precision. | Rectangle2D | ||
minX : Number [read-only]
Returns the smallest X coordinate of the upper left corner of this rectangle in double precision. | Rectangle2D | ||
minY : Number [read-only]
Returns the smallest Y coordinate of the upper left corner of this rectangle in double precision. | Rectangle2D | ||
rect : Rectangle2D [write-only]
Sets this Rectangle2D to be the same as the specified Rectangle2D. | Rectangle2D | ||
size : Dimension | Rectangle | ||
_width : int | Rectangle | ||
width : Number [override] [read-only]
Returns the width of the bounding Rectangle in double precision. | Rectangle | ||
_x : int | Rectangle | ||
x : Number [override] [read-only]
Returns the X coordinate of the bounding Rectangle in double precision. | Rectangle | ||
_y : int | Rectangle | ||
y : Number [override] [read-only]
Returns the Y coordinate of the bounding Rectangle in double precision. | Rectangle |
Method | Defined By | ||
---|---|---|---|
Rectangle(x:int, y:int, width:int, height:int, init:Boolean = true)
Constructs a new Rectangle whose top-left corner is specified as (x, y) and whose width and height are specified by the arguments of the same name. | Rectangle | ||
Adds the Point2D object p to this Rectangle2D. | Rectangle2D | ||
addPoint2(x:Number, y:Number):void
Adds a point, specified by the double precision arguments px and py, to this Rectangle2D. | Rectangle2D | ||
addRectangle(r:Rectangle2D):void
Adds a Rectangle2D object to this Rectangle2D. | Rectangle2D | ||
addRectangle2(r:Rectangle):void
Adds a Rectangle to this Rectangle. | Rectangle | ||
clone():Object [override] | Rectangle | ||
containsPoint2(x:Number, y:Number):Boolean
Tests if a specified coordinate is inside the boundary of this Rectangle2D. | Rectangle2D | ||
containsRectangle(rect:Rectangle2D):Boolean
Tests if the interior of this Rectangle2D entirely contains the specified Rectangle2D. | Rectangle2D | ||
containsRectangle2(x:Number, y:Number, width:Number, height:Number):Boolean
Tests if the interior of this Rectangle2D entirely contains the specified set of rectangular coordinates. | Rectangle2D | ||
[override]
Returns a new Rectangle2D object representing the intersection of this Rectangle with the specified Rectangle2D. | Rectangle | ||
[override]
Returns a new Rectangle2D object representing the union of this Rectangle with the specified Rectangle2D. | Rectangle | ||
equals(obj:Object):Boolean [override]
Checks whether two rectangles are equal. | Rectangle | ||
getClass():Class [override] | Rectangle | ||
grow(dx:int, dy:int):void
Resizes the Rectangle both horizontally and vertically. | Rectangle | ||
hashCode():int [override] | Rectangle2D | ||
[static]
Intersects the pair of specified source Rectangle2D objects and puts the result into the specified destination Rectangle2D object. | Rectangle2D | ||
Computes the intersection of this Rectangle with the specified Rectangle. | Rectangle | ||
intersectsLine(x1:Number, y1:Number, x2:Number, y2:Number):Boolean
Tests if the specified line segment intersects the interior of this Rectangle2D. | Rectangle2D | ||
intersectsRectangle(rect:Rectangle2D):Boolean
Tests if the interior of this Rectangle2D intersects the specified Rectangle2D. | Rectangle2D | ||
intersectsRectangle2(x:Number, y:Number, width:Number, height:Number):Boolean
Tests if the interior of this Rectangle2D intersects the interior of a specified set of rectangular coordinates. | Rectangle2D | ||
intersectsRectangle3(r:Rectangle):Boolean
Determines whether or not this Rectangle and the specified Rectangle intersect. | Rectangle | ||
move(x:int, y:int):void | Rectangle | ||
[static]
Constructs a new Rectangle whose top-left corner is at (0, 0) in the coordinate space, and whose width and height are both zero. | Rectangle | ||
[static]
| Rectangle | ||
[static]
Constructs a new Rectangle, initialized to match the values of the specified Rectangle. | Rectangle | ||
newRectangle4(width:int, height:int):Rectangle [static]
Constructs a new Rectangle whose top-left corner is at (0, 0) in the coordinate space, and whose width and height are specified by the arguments of the same name. | Rectangle | ||
newRectangle5(x:int, y:int, width:int, height:int):Rectangle [static]
Constructs a new Rectangle whose top-left corner is specified as (x, y) and whose width and height are specified by the arguments of the same name. | Rectangle | ||
Determines where the specified Point2D lies with respect to this Rectangle2D. | Rectangle2D | ||
outcode2(px:Number, py:Number):int [override]
Determines where the specified coordinates lie with respect to this Rectangle. | Rectangle | ||
reshape(x:int, y:int, width:int, height:int):void | Rectangle | ||
resize(width:int, height:int):void | Rectangle | ||
Rectangle | |||
setBounds2(x:int, y:int, width:int, height:int):void
Sets the bounding Rectangle of this Rectangle to the specified x, y, width, and height. | Rectangle | ||
setFrame(x:Number, y:Number, width:Number, height:Number):void
Sets the location and size of the outer bounds of this Rectangle2D to the specified rectangular values. | Rectangle2D | ||
Rectangle2D | |||
Sets the framing rectangle of this Shape based on a specified center Point2D and corner Point2D. | Rectangle2D | ||
setFrameFromCenter2(centerX:Number, centerY:Number, cornerX:Number, cornerY:Number):void
Sets the framing rectangle of this Shape based on the specified center point coordinates and corner point coordinates. | Rectangle2D | ||
Sets the diagonal of the framing rectangle of this Shape based on the two specified coordinates. | Rectangle2D | ||
setFrameFromDiagonal2(x1:Number, y1:Number, x2:Number, y2:Number):void
Sets the diagonal of the framing rectangle of this Shape based on the two specified coordinates. | Rectangle2D | ||
setLocation(x:int, y:int):void
Moves this Rectangle to the specified location. | Rectangle | ||
setRect(x:Number, y:Number, width:Number, height:Number):void [override]
Sets the bounds of this Rectangle to the specified x, y, width, and height. | Rectangle | ||
setSize(width:int, height:int):void
Sets the size of this Rectangle to the specified width and height. | Rectangle | ||
toString():String | Rectangle | ||
translate(mx:int, my:int):void
Translates this Rectangle the indicated distance, to the right along the x coordinate axis, and downward along the y coordinate axis. | Rectangle | ||
[static]
Unions the pair of specified source Rectangle2D objects and puts the result into the specified destination Rectangle2D object. | Rectangle2D | ||
Computes the union of this Rectangle with the specified Rectangle. | Rectangle |
Method | Defined By | ||
---|---|---|---|
cloneImpl(o:Object):void [override] | Rectangle | ||
initRectangle1():void
Initializes this object. | Rectangle | ||
initRectangle2(d:Dimension):void
Initializes this object. | Rectangle | ||
initRectangle2D():void | Rectangle2D | ||
initRectangle3(r:Rectangle):void
Initializes this object. | Rectangle | ||
initRectangle4(width:int, height:int):void
Initializes this object. | Rectangle | ||
initRectangle5(x:int, y:int, width:int, height:int):void
Initializes this object. | Rectangle |
_height | property |
public var _height:int
_width | property |
public var _width:int
_x | property |
public var _x:int
_y | property |
public var _y:int
bounds | property |
bounds:Rectangle
[read-only] [override] Gets the bounding Rectangle of this Rectangle.
public function get bounds():Rectangle
bounds2D | property |
bounds2D:Rectangle2D
[read-only] [override] Return the high precision bounding box of this rectangle.
public function get bounds2D():Rectangle2D
empty | property |
empty:Boolean
[read-only] [override] Determines whether or not this Rectangle is empty. A Rectangle is empty if its width or its height is less than or equal to zero.
public function get empty():Boolean
height | property |
height:Number
[read-only] [override] Returns the height of the bounding Rectangle in double precision.
public function get height():Number
size | property |
size:Dimension
public function get size():Dimension
public function set size(value:Dimension):void
width | property |
width:Number
[read-only] [override] Returns the width of the bounding Rectangle in double precision.
public function get width():Number
x | property |
x:Number
[read-only] [override] Returns the X coordinate of the bounding Rectangle in double precision.
public function get x():Number
y | property |
y:Number
[read-only] [override] Returns the Y coordinate of the bounding Rectangle in double precision.
public function get y():Number
Rectangle | () | Constructor |
public function Rectangle(x:int, y:int, width:int, height:int, init:Boolean = true)
Constructs a new Rectangle whose top-left corner is specified as (x, y) and whose width and height are specified by the arguments of the same name.
Parametersx:int — the specified x coordinate.
| |
y:int — the specified y coordinate.
| |
width:int — the width of the Rectangle.
| |
height:int — the height of the Rectangle.
| |
init:Boolean (default = true ) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods.
This parameter can safely be ignored/omitted when calling the constructor.
|
addRectangle2 | () | method |
public function addRectangle2(r:Rectangle):void
Adds a Rectangle to this Rectangle. The resulting Rectangle is the union of the two rectangles.
Parameters
r:Rectangle — the specified Rectangle.
|
clone | () | method |
override public function clone():Object
ReturnsObject |
cloneImpl | () | method |
override protected function cloneImpl(o:Object):void
Parameters
o:Object |
createIntersection | () | method |
override public function createIntersection(r:Rectangle2D):Rectangle2D
Returns a new Rectangle2D object representing the intersection of this Rectangle with the specified Rectangle2D.
Parameters
r:Rectangle2D — the Rectangle2D to be intersected with this Rectangle.
|
Rectangle2D — the largest Rectangle2D contained in both the specified Rectangle2D and in this Rectangle.
|
createUnion | () | method |
override public function createUnion(r:Rectangle2D):Rectangle2D
Returns a new Rectangle2D object representing the union of this Rectangle with the specified Rectangle2D.
Parameters
r:Rectangle2D — the Rectangle2D to be combined with this Rectangle.
|
Rectangle2D — the smallest Rectangle2D containing both the specified Rectangle2D and this Rectangle.
|
equals | () | method |
override public function equals(obj:Object):Boolean
Checks whether two rectangles are equal. The result is true if and only if the argument is not null and is a Rectangle object that has the same top-left corner, width, and height as this Rectangle.
Parameters
obj:Object — the Object to compare with this Rectangle
|
Boolean — true if the objects are equal; false otherwise.
|
getClass | () | method |
override public function getClass():Class
ReturnsClass |
grow | () | method |
public function grow(dx:int, dy:int):void
Resizes the Rectangle both horizontally and vertically.
This method modifies the Rectangle so that it is dx units larger on both the left and right side, and dy units larger at both the top and bottom.
The new Rectangle has (x - dx, y - dy) as its top-left corner, a width of width + 2dx, and a height of height + 2dy.
If negative values are supplied for dx and dy, the size of the Rectangle decreases accordingly. The grow method does not check whether the resulting values of width and height are non-negative.
Parameters
dx:int — the horizontal expansion
| |
dy:int — the vertical expansion
|
initRectangle1 | () | method |
protected final function initRectangle1():void
Initializes this object. See the documentation of the corresponding factory method newRectangle1()
for details.
See also
initRectangle2 | () | method |
protected final function initRectangle2(d:Dimension):void
Initializes this object. See the documentation of the corresponding factory method newRectangle2()
for details.
Parameters
d:Dimension |
See also
initRectangle3 | () | method |
protected final function initRectangle3(r:Rectangle):void
Initializes this object. See the documentation of the corresponding factory method newRectangle3()
for details.
Parameters
r:Rectangle |
See also
initRectangle4 | () | method |
protected final function initRectangle4(width:int, height:int):void
Initializes this object. See the documentation of the corresponding factory method newRectangle4()
for details.
Parameters
width:int | |
height:int |
See also
initRectangle5 | () | method |
protected final function initRectangle5(x:int, y:int, width:int, height:int):void
Initializes this object. See the documentation of the corresponding factory method newRectangle5()
for details.
Parameters
x:int | |
y:int | |
width:int | |
height:int |
See also
intersection | () | method |
public function intersection(r:Rectangle):Rectangle
Computes the intersection of this Rectangle with the specified Rectangle. Returns a new Rectangle that represents the intersection of the two rectangles. If the two rectangles do not intersect, the result will be an empty rectangle.
Parameters
r:Rectangle — the specified Rectangle
|
Rectangle — the largest Rectangle contained in both the specified Rectangle and in this Rectangle; or if the rectangles do not intersect, an empty rectangle.
|
intersectsRectangle3 | () | method |
public function intersectsRectangle3(r:Rectangle):Boolean
Determines whether or not this Rectangle and the specified Rectangle intersect. Two rectangles intersect if their intersection is nonempty.
Parameters
r:Rectangle — the specified Rectangle
|
Boolean — true if the specified Rectangle and this Rectangle intersect; false otherwise.
|
move | () | method |
public function move(x:int, y:int):void
Parameters
x:int | |
y:int |
newRectangle1 | () | method |
public static function newRectangle1():Rectangle
Constructs a new Rectangle whose top-left corner is at (0, 0) in the coordinate space, and whose width and height are both zero.
ReturnsRectangle |
newRectangle2 | () | method |
newRectangle3 | () | method |
public static function newRectangle3(r:Rectangle):Rectangle
Constructs a new Rectangle, initialized to match the values of the specified Rectangle.
Parameters
r:Rectangle — the Rectangle from which to copy initial values to a newly constructed Rectangle.
|
Rectangle |
newRectangle4 | () | method |
public static function newRectangle4(width:int, height:int):Rectangle
Constructs a new Rectangle whose top-left corner is at (0, 0) in the coordinate space, and whose width and height are specified by the arguments of the same name.
Parameters
width:int — the width of the Rectangle.
| |
height:int — the height of the Rectangle.
|
Rectangle |
newRectangle5 | () | method |
public static function newRectangle5(x:int, y:int, width:int, height:int):Rectangle
Constructs a new Rectangle whose top-left corner is specified as (x, y) and whose width and height are specified by the arguments of the same name.
Parameters
x:int — the specified x coordinate.
| |
y:int — the specified y coordinate.
| |
width:int — the width of the Rectangle.
| |
height:int — the height of the Rectangle.
|
Rectangle |
outcode2 | () | method |
override public function outcode2(px:Number, py:Number):int
Determines where the specified coordinates lie with respect to this Rectangle. This method computes a binary OR of the appropriate mask values indicating, for each side of this Rectangle, whether or not the specified coordinates are on the same side of the edge as the rest of this Rectangle.
Parameters
px:Number — the specified x coordinate.
| |
py:Number — the specified y coordinate.
|
int — the logical OR of all appropriate out codes.
|
reshape | () | method |
public function reshape(x:int, y:int, width:int, height:int):void
Parameters
x:int | |
y:int | |
width:int | |
height:int |
resize | () | method |
public function resize(width:int, height:int):void
Parameters
width:int | |
height:int |
setBounds | () | method |
setBounds2 | () | method |
public function setBounds2(x:int, y:int, width:int, height:int):void
Sets the bounding Rectangle of this Rectangle to the specified x, y, width, and height.
Parameters
x:int — the new x coordinate for the top-left corner of this Rectangle
| |
y:int — the new y coordinate for the top-left corner of this Rectangle
| |
width:int — the new width for this Rectangle
| |
height:int — the new height for this Rectangle
|
setLocation | () | method |
public function setLocation(x:int, y:int):void
Moves this Rectangle to the specified location.
Parameters
x:int — the x coordinate of the new location.
| |
y:int — the y coordinate of the new location.
|
setRect | () | method |
override public function setRect(x:Number, y:Number, width:Number, height:Number):void
Sets the bounds of this Rectangle to the specified x, y, width, and height.
Parameters
x:Number — the new x coordinate for the top-left corner of this Rectangle
| |
y:Number — the new y coordinate for the top-left corner of this Rectangle
| |
width:Number — the new width for this Rectangle
| |
height:Number — the new height for this Rectangle
|
setSize | () | method |
public function setSize(width:int, height:int):void
Sets the size of this Rectangle to the specified width and height.
Parameters
width:int — the new width for this Rectangle.
| |
height:int — the new height for this Rectangle.
|
toString | () | method |
public function toString():String
ReturnsString |
translate | () | method |
public function translate(mx:int, my:int):void
Translates this Rectangle the indicated distance, to the right along the x coordinate axis, and downward along the y coordinate axis.
Parameters
mx:int — - the distance to move this Rectangle along the x axis
| |
my:int — - the distance to move this Rectangle along the y axis
|
unionWith | () | method |
public function unionWith(r:Rectangle):Rectangle
Computes the union of this Rectangle with the specified Rectangle. Returns a new Rectangle that represents the union of the two rectangles .
Parameters
r:Rectangle — the specified Rectangle
|
Rectangle — the smallest Rectangle containing both the specified Rectangle and this Rectangle.
|