|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.geom.RectangularShape
java.awt.geom.Rectangle2D
java.awt.geom.Rectangle2D.Float
org.icepdf.core.pobjects.PRectangle
public class PRectangle
A rectangle in a PDF document is slightly different than the Rectangle class
in Java. A PDF rectangle is written as an array of four numbers giving the
coordinates of a pair of diagonally opposite corners. Typically, the
array takes the form:
This specifies the lower-left x, lower-left y, upper-right x, and upper-right y coordinates of the rectangle, in that order. However, this format is not guaranteed and this class normalizes such rectangles.
Another very important difference between PRectangles Rectangles is that PRectangles use the Cartesian Coordinate system, where Rectangles use the Java2D coordinates system. As a result, the user of this class must know the context in which the PRectangle is being used. For example there is a significant difference between the inherited method createIntersection and PRectangles createCartesianIntersection.
| 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 | |
|---|---|
PRectangle(java.util.List coordinates)
Creates a new PRectangle object. |
|
PRectangle(java.awt.geom.Point2D.Float p1,
java.awt.geom.Point2D.Float p2)
Creates a new PRectangle object. |
|
| Method Summary | |
|---|---|
PRectangle |
createCartesianIntersection(PRectangle src2)
Returns a new PRectangle object representing the intersection of this PRectangle with the specified PRectangle using the Cartesian coordinate system. |
java.awt.geom.Rectangle2D.Float |
getOriginalPoints()
Gets the orgional two points that created the PRectangle object. |
static java.util.List |
getPRectangleVector(java.awt.geom.Rectangle2D rect)
Converts a rectangle defined in user page in Java2D coordinates back to PDF space and in the vector for of the rectangle. |
java.awt.geom.Rectangle2D.Float |
toJava2dCoordinates()
Converts the Cartesian representation of the Rectangle into Rectangle in the Java2D coordinate space. |
| Methods inherited from class java.awt.geom.Rectangle2D.Float |
|---|
createIntersection, createUnion, getBounds2D, getHeight, getWidth, getX, getY, isEmpty, outcode, setRect, setRect, setRect, toString |
| 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 |
|---|
public PRectangle(java.awt.geom.Point2D.Float p1,
java.awt.geom.Point2D.Float p2)
Creates a new PRectangle object. The points are automatically normalized by the constructor. These two coordinates represent the diagonal corners of the rectangle.
p1 - first point of diagonal, in the Cartesian coordinate spacep2 - second point of diagonal, in the Cartesian coordinate space
public PRectangle(java.util.List coordinates)
throws java.lang.IllegalArgumentException
coordinates - a vector containing four elements where the first and
second elements represent the x and y coordinates of one point and the
third and fourth elements represent the x and y cooordinates of the second
point. These two coordinates represent the diagonal corners of the
rectangle.
java.lang.IllegalArgumentException - thrown if coordinates is null or does not
have four elements| Method Detail |
|---|
public PRectangle createCartesianIntersection(PRectangle src2)
toJava2dCoordinates().
src2 - the Rectangle2D to be intersected with this Rectangle2D.
public java.awt.geom.Rectangle2D.Float getOriginalPoints()
Gets the orgional two points that created the PRectangle object. The first point is represented by the the rectangle positions x, y and the second poitn is represented by the width and height of the rectangle.
public java.awt.geom.Rectangle2D.Float toJava2dCoordinates()
Converts the Cartesian representation of the Rectangle into Rectangle in the Java2D coordinate space.
public static java.util.List getPRectangleVector(java.awt.geom.Rectangle2D rect)
rect - user space rectangle in Java2D coordinates space.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||