public final class Rectangle extends Object implements Comparable<Object>, Cloneable
Class represents rectangle.
Constructor and Description |
---|
Rectangle(double llx,
double lly,
double urx,
double ury)
Constructor of Rectangle.
|
Modifier and Type | Method and Description |
---|---|
void |
_Intersect(Rectangle otherRect)
Deprecated.
|
Point |
center()
Returncs coordinates of center of the rectangle.
|
Object |
clone()
Clones the Rectangle object.
|
int |
compareTo(Object arg0)
CompareTo
|
boolean |
contains(Point point)
Determinces whether given point is inside of the rectangle.
|
Object |
deepClone()
Clones the Rectangle object.
|
boolean |
equals(Object other)
Check if rectangles are equal i.e. have same position and sizes.
|
static Rectangle |
fromRect(Rectangle src)
Initializes new rectangle from given instance of System.Drawing.Rectangle.
|
static Rectangle |
getEmpty()
Gets empty rectangle
|
double |
getHeight()
Get height of rectangle.
|
double |
getLLX()
Gets X-coordinate of lower - left corner.
|
double |
getLLY()
Gets Y - coordinate of lower-left corner.
|
static Rectangle |
getTrivial()
Initializes trivial rectangle i.e. rectangle with zero position and size.
|
double |
getURX()
Gets X - coordinate of upper-right corner.
|
double |
getURY()
Gets Y - coordinate of upper-right corner.
|
double |
getWidth()
Gets width of rectangle.
|
int |
hashCode()
Returns a hash code value for the object.
|
Rectangle |
intersect(Rectangle otherRect)
Intersects to rectangles.
|
boolean |
isEmpty()
Checks if rectangle is empty.
|
boolean |
isInclude(Rectangle otherRect,
double rotationAngle)
Checks that this rectangle includes whole another rectangle.
|
boolean |
isIntersect(Rectangle otherRect)
Determines whether this rectangle intersects with other rectangle.
|
boolean |
isPoint()
Checks if rectangle is point i.e.
|
boolean |
isTrivial()
Checks if rectangle is trivial i.e. has zero size and position.
|
Rectangle |
join(Rectangle otherRect)
Joins rectangles.
|
boolean |
nearEquals(Rectangle other,
double delta)
Check if rectangles are near equal i.e. have near same (up to delta) position and sizes.
|
static Rectangle |
parse(String value)
Try to parse string and extract from it rectangle components llx, lly, urx, ury.
|
void |
rotate(int angle)
Rotate rectangle by the specified angle.
|
void |
rotateAngle(int angle)
Rotate rectangle by the specified angle.
|
void |
setLLX(double value)
Sets X-coordinate of lower - left corner.
|
void |
setLLY(double value)
Sets Y - coordinate of lower-left corner.
|
void |
setURX(double value)
Sets X - coordinate of upper-right corner.
|
void |
setURY(double value)
Sets Y - coordinate of upper-right corner.
|
com.aspose.pdf.engine.data.PdfArray |
toArray(com.aspose.pdf.engine.data.ITrailerable trailerable) |
Rectangle |
toRect()
Converts rectangle to instance of System.Drawing.Rectangle.
|
String |
toString()
Gets rectangle string representation.
|
public Rectangle(double llx, double lly, double urx, double ury)
Constructor of Rectangle.
llx
- X of lower left corner.lly
- Y of lower left corner.urx
- X of upper right corner.ury
- Y of upper right corner.public double getWidth()
Gets width of rectangle.
public double getHeight()
Get height of rectangle.
public double getLLX()
Gets X-coordinate of lower - left corner.
public void setLLX(double value)
Sets X-coordinate of lower - left corner.
value
- double valuepublic double getLLY()
Gets Y - coordinate of lower-left corner.
public void setLLY(double value)
Sets Y - coordinate of lower-left corner.
value
- double valuepublic double getURX()
Gets X - coordinate of upper-right corner.
public void setURX(double value)
Sets X - coordinate of upper-right corner.
value
- double valuepublic double getURY()
Gets Y - coordinate of upper-right corner.
public void setURY(double value)
Sets Y - coordinate of upper-right corner.
value
- double valuepublic Rectangle toRect()
Converts rectangle to instance of System.Drawing.Rectangle. Floating-point positions and size are truncated.
public static Rectangle fromRect(Rectangle src)
Initializes new rectangle from given instance of System.Drawing.Rectangle.
src
- Source rectangle which position and size will be set to new rectangle.public com.aspose.pdf.engine.data.PdfArray toArray(com.aspose.pdf.engine.data.ITrailerable trailerable)
public String toString()
Gets rectangle string representation.
public static Rectangle parse(String value)
Try to parse string and extract from it rectangle components llx, lly, urx, ury.
value
- String to parse.public static Rectangle getEmpty()
Gets empty rectangle
public static Rectangle getTrivial()
Initializes trivial rectangle i.e. rectangle with zero position and size.
public boolean isTrivial()
Checks if rectangle is trivial i.e. has zero size and position.
public boolean isEmpty()
Checks if rectangle is empty.
public boolean isPoint()
Checks if rectangle is point i.e. LLX is equal URX and LLY is equal URY.
public boolean equals(Object other)
Check if rectangles are equal i.e. have same position and sizes.
public boolean nearEquals(Rectangle other, double delta)
Check if rectangles are near equal i.e. have near same (up to delta) position and sizes.
other
- Rectangle which will be compared.delta
- Value of comparation tollerance.public int hashCode()
HashMap
.
The general contract of hashCode
is:
hashCode
method must consistently return the same integer, provided
no information used in equals
comparisons on the object is modified. This integer
need not remain consistent from one execution of an application to another execution of the
same application.
equals(Object)
method, then calling the
hashCode
method on each of the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode
method on each of the two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results for unequal objects may
improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined by class Object
does
return distinct integers for distinct objects. (This is typically implemented by converting
the internal address of the object into an integer, but this implementation technique is not
required by the JavaTM programming language.)
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public Rectangle intersect(Rectangle otherRect)
Intersects to rectangles.
otherRect
- Rectangle to which this recatangle be intersected.public Rectangle join(Rectangle otherRect)
Joins rectangles.
otherRect
- Rectangle to which this rectangle be joined.@Deprecated public void _Intersect(Rectangle otherRect)
Intersects rectangles. Obsolete method. Please use Intersect instead.
otherRect
- Rectangle objectpublic boolean isIntersect(Rectangle otherRect)
Determines whether this rectangle intersects with other rectangle.
otherRect
- Intersection will be tested with specified rectangle.public boolean contains(Point point)
Determinces whether given point is inside of the rectangle.
point
- Point to check.public Point center()
Returncs coordinates of center of the rectangle.
public boolean isInclude(Rectangle otherRect, double rotationAngle)
Checks that this rectangle includes whole another rectangle. I.e. whole another rectangle is inside this rectangle. Difference with IsIntersect method is that IsIntersect will true for partly intersected rectangles but IsInclude will false.
otherRect
- Rectangle for which including is checked.rotationAngle
- Rotation angle of another rectangle in radians.public void rotate(int angle)
Rotate rectangle by the specified angle.
angle
- Angle of rotation. Member of Rotation enumeration.Rotation
public void rotateAngle(int angle)
Rotate rectangle by the specified angle.
angle
- Angle of rotation in degrees between 0 and 360.public int compareTo(Object arg0)
CompareTo
compareTo
in interface Comparable<Object>
arg0
- Object for comparepublic Object clone()
Clones the Rectangle object.
public Object deepClone()
Clones the Rectangle object.