public class Rect
extends java.lang.Object
Note: - Although rectangles are conventionally specified by their lower-left and upperright corners, it is acceptable to specify any two diagonally opposite corners.
Constructor and Description |
---|
Rect()
Instantiate Rect with size 0.
|
Rect(double x1,
double y1,
double x2,
double y2)
Create a Rect and initialize it using specified parameters.
|
Rect(Obj rect)
Create a Rect and initialize it using given Cos/SDF rectangle Array
object.
|
Rect(java.awt.geom.Rectangle2D.Double r)
Instantiates a new rect from java Rectangle object
|
Modifier and Type | Method and Description |
---|---|
static Rect |
__Create(long impl) |
long |
__GetHandle() |
void |
attach(Obj rect)
Attach the Cos/SDF object to the Rect.
|
boolean |
contains(double x,
double y)
Determines if the specified point is contained within the rectangular
region defined by this Rectangle.
|
void |
destroy()
Frees the native memory of the object.
|
boolean |
equals(java.lang.Object other) |
double[] |
get()
Get the rectangle coordinates
|
double |
getHeight()
Get the height of rectangle
|
java.awt.geom.Rectangle2D.Double |
getRectangle()
Converts the rectangle to java.awt.geom.Rectangle2D
|
double |
getWidth()
Get the width of rectangle
|
double |
getX1()
Get the x coordinate of the lower-left point
|
double |
getX2()
Get the x coordinate of the upper-right point
|
double |
getY1()
Get the y coordinate of the lower-left point
|
double |
getY2()
Get the y coordinate of the upper-right point
|
int |
hashCode() |
boolean |
intersectRect(Rect rect1,
Rect rect2)
check if two rectangles intersect
|
void |
normalize()
Normalizes the rectagle to the one with lower-left and upper-right
corners.
|
void |
set(double x1,
double y1,
double x2,
double y2)
Set the coordinates of the rectangle.
|
void |
set(java.awt.geom.Rectangle2D.Double r)
Set the coordinates of the rectangle from jave Rectangle2D object
|
void |
setX1(double x1)
Set the x coordinate of the lower-left point
|
void |
setX2(double x2)
Set the x coordinate of the upper-right point
|
void |
setY1(double y1)
Set the y coordinate of the lower-left point
|
void |
setY2(double y2)
Set the y coordinate of the upper-right point`
|
boolean |
update()
Saves changes made to the Rect object in the attached (or specified)
SDF/Cos rectangle.
|
boolean |
update(Obj rect)
Saves changes made to the Rect object in the attached (or specified)
SDF/Cos rectangle.
|
public Rect() throws PDFNetException
PDFNetException
public Rect(Obj rect) throws PDFNetException
rect
- the rectPDFNetException
public Rect(double x1, double y1, double x2, double y2) throws PDFNetException
x1
- x coordinate of the lower-left pointy1
- y coordinate of the lower-left pointx2
- x coordinate of the upper-right pointy2
- y coordinate of the upper-right pointPDFNetException
public Rect(java.awt.geom.Rectangle2D.Double r) throws PDFNetException
r
- java version of the rectangle objectPDFNetException
public static Rect __Create(long impl)
public long __GetHandle()
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public void attach(Obj rect) throws PDFNetException
rect
- - underlying Cos/SDF object. Must be an SDF::Array with four
SDF::Number elements.PDFNetException
public boolean update() throws PDFNetException
PDFNetException
public boolean update(Obj rect) throws PDFNetException
rect
- - an SDF array that should be updated and attached to this
Rect. If parameter rect is NULL or is omitted, update is
performed on previously attached Cos/SDF rectangle.PDFNetException
public double[] get() throws PDFNetException
PDFNetException
public void set(double x1, double y1, double x2, double y2) throws PDFNetException
x1
- x coordinate of the lower-left pointy1
- y coordinate of the lower-left pointx2
- x coordinate of the upper-right pointy2
- y coordinate of the upper-right pointPDFNetException
public void set(java.awt.geom.Rectangle2D.Double r) throws PDFNetException
r
- java version of Rectangle2D objectPDFNetException
public double getWidth() throws PDFNetException
PDFNetException
public double getHeight() throws PDFNetException
PDFNetException
public boolean contains(double x, double y) throws PDFNetException
x
- x coordinate of the pointy
- y coordinate of the pointPDFNetException
public boolean intersectRect(Rect rect1, Rect rect2) throws PDFNetException
Note: The intersection is the largest rectangle contained in both existing rectangles.
rect1
- - A Rect object that contains a source rectangle.rect2
- - A Rect object that contains a source rectangle.PDFNetException
public void normalize() throws PDFNetException
Note: Although rectangles are conventionally specified by their lower-left and upper-right corners, it is acceptable to specify any two diagonally opposite corners.
PDFNetException
public void destroy()
public java.awt.geom.Rectangle2D.Double getRectangle() throws PDFNetException
PDFNetException
public double getX1() throws PDFNetException
PDFNetException
public double getY1() throws PDFNetException
PDFNetException
public double getX2() throws PDFNetException
PDFNetException
public double getY2() throws PDFNetException
PDFNetException
public void setX1(double x1) throws PDFNetException
x1
- x coordinate of the lower-left pointPDFNetException
public void setY1(double y1) throws PDFNetException
y1
- y coordinate of the lower-left pointPDFNetException
public void setX2(double x2) throws PDFNetException
x2
- x coordinate of the upper-right pointPDFNetException
public void setY2(double y2) throws PDFNetException
y2
- y coordinate of the upper-right point`PDFNetException