public class RMPath
extends com.reportmill.base.RMObject
implements java.awt.Shape
Modifier and Type | Field and Description |
---|---|
static byte |
CLOSE |
static byte |
CURVE_TO |
static byte |
LINE_TO |
static byte |
LineCapButt |
static byte |
LineCapProjectingSquare |
static byte |
LineCapRound |
static byte |
LineJoinBevel |
static byte |
LineJoinMiter |
static byte |
LineJoinRound |
static byte |
MOVE_TO |
static byte |
QUAD_TO |
static RMPath |
unitRectPath |
static byte |
WIND_EVEN_ODD |
static byte |
WIND_NON_ZERO |
Constructor and Description |
---|
RMPath()
Creates an empty path.
|
RMPath(java.awt.Shape aShape)
Creates a path for the given shape.
|
Modifier and Type | Method and Description |
---|---|
void |
addSegments(java.util.List segs)
Adds the list of segments to the path.
|
double |
arcLength()
Returns the total arc length of the path.
|
java.lang.Object |
clone()
Standard clone implementation.
|
void |
closePath()
Adds a Close element to the given path.
|
boolean |
contains(double x,
double y)
Returns whether the given xy coordinate is inside the path.
|
boolean |
contains(double x,
double y,
double w,
double h)
Returns whether the interior of the shape entirely contains the specified rectangular area.
|
boolean |
contains(java.awt.geom.Point2D aPoint)
Returns whether the given point is inside the path.
|
boolean |
contains(java.awt.geom.Rectangle2D aRect)
Returns whether the interior of the shape entirely contains the specified rectangular area.
|
RMPath |
createTransformedPath(java.awt.geom.AffineTransform aTransform)
Returns a transformed version of this path.
|
void |
curveTo(double cp1x,
double cp1y,
double cp2x,
double cp2y,
double px,
double py)
Adds a CurveTo element to the path for the given point and control points.
|
void |
curveTo(RMPoint cp1,
RMPoint cp2,
RMPoint p)
Adds a CurveTo element to the path for the given point and control points.
|
boolean |
equals(java.lang.Object anObj)
Standard equals implementation.
|
java.lang.Object |
fromXML(com.reportmill.archiver.RXArchiver anArchiver,
com.reportmill.archiver.RXElement anElement,
java.lang.Object anOwner)
XML unarchival.
|
java.awt.Rectangle |
getBounds()
Returns the bounds for the path as an integer rect.
|
java.awt.geom.Rectangle2D |
getBounds2D()
Returns the bounds for the path.
|
RMRect |
getBoundsRM()
Returns the bounds for the path.
|
RMRect |
getControlPointBounds()
Returns the rectangle that encloses all the control points.
|
byte |
getElement(int anIndex)
Returns the element type at the given index.
|
byte |
getElement(int anIndex,
RMPoint[] points)
Returns the element type at the given index and its associated points (returned in the given point array).
|
int |
getElementCount()
Returns the number of elements in this path.
|
int |
getElementIndexForPointIndex(int index)
Returns the element index for the given point index.
|
byte |
getElementLast()
Returns the last element.
|
int |
getElementPointIndex(int anIndex)
Returns the point index for a given element.
|
double |
getHeight()
Returns the height of the path.
|
com.reportmill.graphics.RMHitInfo |
getHitInfo(com.reportmill.graphics.RMBezier aBezier,
boolean findFirstHit)
Returns the hit info for the given bezier curve against this path.
|
com.reportmill.graphics.RMHitInfo |
getHitInfo(com.reportmill.graphics.RMLine aLine,
boolean findFirstHit)
Returns the hit info for the given line against this path.
|
RMPath |
getPathInRect(java.awt.geom.Rectangle2D aRect)
Returns a copy of the path scaled to exactly fit in the given rect.
|
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform aTransform)
Returns a path iterator for this path and the given transform.
|
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform aTransform,
double flatness)
Returns a path iterator for this path and the given transform and flatness.
|
RMPoint |
getPoint(int anIndex)
Returns the point at the given index.
|
int |
getPointCount()
Returns the number of points in the path.
|
RMPoint |
getPointLast()
Returns the last point in the path.
|
RMPath |
getReversedPath()
Returns a new path with the same points as this path, but in reverse order.
|
java.util.List |
getSegments()
Converts a path into an array of RMBezier/Quadratic/Lines.
|
double |
getWidth()
Returns the width of the path.
|
byte |
getWindingRule()
Returns the winding rule which describes how inner path perimeters are filled and clipped.
|
double |
getX()
Returns the X of the path.
|
double |
getY()
Returns the Y of the path.
|
int |
handleAtPointForBounds(RMPoint aPoint,
RMRect aRect,
int selectedPoint,
RMSize handleSize)
Returns the handle index for a given point against this path scaled to the given rect.
|
boolean |
hitHandle(RMPoint aPoint,
int ptIndex,
RMSize handleSize)
Hit test the point (in path coords) against a given path point.
|
boolean |
intersects(double x,
double y,
double w,
double h)
Returns whether the interior of the path intersects the interior of a specified rectangular area.
|
boolean |
intersects(double x,
double y,
double w,
double h,
float lineWidth)
Returns whether path drawn with given linewidth is hit by given rect.
|
boolean |
intersects(java.awt.geom.Rectangle2D aRect)
Returns whether the interior of the path intersects the interior of a specified Rectangle2D.
|
boolean |
intersects(com.reportmill.graphics.RMLine aLine)
Returns whether path is hit by a line.
|
boolean |
intersects(RMPath aPath,
float lineWidth)
Returns whether path drawn with given linewidth is hit by given path.
|
boolean |
intersects(RMPoint aPoint,
float lineWidth)
Returns whether path is hit by point for a path linewidth.
|
boolean |
isClosed()
Returns whether path has any open subpaths.
|
void |
lineTo(double px,
double py)
Adds a LineTo element to the path for the given point.
|
void |
lineTo(RMPoint p)
Adds a LineTo element to the path for the given point.
|
void |
moveTo(double px,
double py)
Adds a MoveTo element to the path for the given point.
|
void |
moveTo(RMPoint p)
Adds a MoveTo element to the path for the given point.
|
int |
pointCountForElementType(int element)
Returns the total number of points associated with a given type of path element.
|
RMPoint |
pointInPathCoordsFromPoint(RMPoint aPoint,
RMRect aRect)
Returns the given point converted to path coords for given path bounds.
|
boolean |
pointOnPath(int pointIndex)
Returns true of the point at pointIndex is on the path,
and false if it is on the convex hull.
|
void |
quadTo(double cpx,
double cpy,
double px,
double py)
Adds a QuadTo element to the path for the given point and control point.
|
void |
quadTo(RMPoint cp,
RMPoint p)
Adds a QuadTo element to the path for the given point and control point.
|
void |
relativeCurveTo(RMPoint cp1,
RMPoint cp2,
RMPoint aPoint)
Adds a CurveTo element to the path for the given point offset from the path's current point.
|
void |
relativeLineTo(RMPoint aPoint)
Adds a LineTo element to the path for the given point offset from the path's current point.
|
void |
relativeMoveTo(RMPoint aPoint)
Adds a MoveTo element to the path for the given point offset from the path's current point.
|
void |
removeElement(int elementIndex)
Removes an element, reconnecting the elements on either side of the deleted element.
|
void |
removeLastElement()
Removes the last element from the path.
|
void |
reset()
Resets the current path with no elements or points.
|
void |
setBounds(RMRect bounds)
Sets the bounds that the path is relative to.
|
void |
setPoint(int index,
RMPoint point)
Sets the path point at the given index to the given point.
|
void |
setPointStructured(int index,
RMPoint point)
Resets the point at the given index to the given point, while preserving something.
|
void |
setWindingRule(byte windingRule)
Sets the winding rule which describes how inner path perimeters are filled and clipped.
|
com.reportmill.archiver.RXElement |
toXML(com.reportmill.archiver.RXArchiver anArchiver,
java.lang.Object anOwner)
XML archival.
|
void |
transformBy(com.reportmill.graphics.RMTransform aTransform)
Transforms the points in the path by the given transform.
|
addListener, addPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, getListener, getListenerCount, getListeners, isFirePropertyChangeEnabled, isUndoing, removeListener, removePropertyChangeListener, setFirePropertyChangeEnabled, setUndoing, toString
public static final byte LineCapButt
public static final byte LineCapRound
public static final byte LineCapProjectingSquare
public static final byte LineJoinMiter
public static final byte LineJoinRound
public static final byte LineJoinBevel
public static final byte WIND_NON_ZERO
public static final byte WIND_EVEN_ODD
public static final byte MOVE_TO
public static final byte LINE_TO
public static final byte QUAD_TO
public static final byte CURVE_TO
public static final byte CLOSE
public static final RMPath unitRectPath
public RMPath()
public RMPath(java.awt.Shape aShape)
public void moveTo(RMPoint p)
public void moveTo(double px, double py)
public void lineTo(RMPoint p)
public void lineTo(double px, double py)
public void quadTo(RMPoint cp, RMPoint p)
public void quadTo(double cpx, double cpy, double px, double py)
public void curveTo(RMPoint cp1, RMPoint cp2, RMPoint p)
public void curveTo(double cp1x, double cp1y, double cp2x, double cp2y, double px, double py)
public void closePath()
public void reset()
public void relativeMoveTo(RMPoint aPoint)
public void relativeLineTo(RMPoint aPoint)
public void relativeCurveTo(RMPoint cp1, RMPoint cp2, RMPoint aPoint)
public byte getWindingRule()
public void setWindingRule(byte windingRule)
public double getX()
public double getY()
public double getWidth()
public double getHeight()
public java.awt.Rectangle getBounds()
getBounds
in interface java.awt.Shape
public java.awt.geom.Rectangle2D getBounds2D()
getBounds2D
in interface java.awt.Shape
public RMRect getBoundsRM()
public void setBounds(RMRect bounds)
public RMRect getControlPointBounds()
public int getElementCount()
public byte getElement(int anIndex)
public byte getElement(int anIndex, RMPoint[] points)
public byte getElementLast()
public int getPointCount()
public RMPoint getPoint(int anIndex)
public RMPoint getPointLast()
public int getElementPointIndex(int anIndex)
public int getElementIndexForPointIndex(int index)
public int pointCountForElementType(int element)
public boolean pointOnPath(int pointIndex)
public boolean isClosed()
public RMPath getPathInRect(java.awt.geom.Rectangle2D aRect)
public boolean contains(java.awt.geom.Point2D aPoint)
contains
in interface java.awt.Shape
public boolean contains(double x, double y)
contains
in interface java.awt.Shape
public boolean contains(java.awt.geom.Rectangle2D aRect)
contains
in interface java.awt.Shape
public boolean contains(double x, double y, double w, double h)
contains
in interface java.awt.Shape
public boolean intersects(java.awt.geom.Rectangle2D aRect)
intersects
in interface java.awt.Shape
public boolean intersects(double x, double y, double w, double h)
intersects
in interface java.awt.Shape
public boolean intersects(RMPoint aPoint, float lineWidth)
public boolean intersects(com.reportmill.graphics.RMLine aLine)
public boolean intersects(double x, double y, double w, double h, float lineWidth)
public boolean intersects(RMPath aPath, float lineWidth)
public com.reportmill.graphics.RMHitInfo getHitInfo(com.reportmill.graphics.RMLine aLine, boolean findFirstHit)
public java.util.List getSegments()
public void addSegments(java.util.List segs)
public double arcLength()
public com.reportmill.graphics.RMHitInfo getHitInfo(com.reportmill.graphics.RMBezier aBezier, boolean findFirstHit)
public int handleAtPointForBounds(RMPoint aPoint, RMRect aRect, int selectedPoint, RMSize handleSize)
public boolean hitHandle(RMPoint aPoint, int ptIndex, RMSize handleSize)
public RMPoint pointInPathCoordsFromPoint(RMPoint aPoint, RMRect aRect)
public void removeLastElement()
public void removeElement(int elementIndex)
public void setPoint(int index, RMPoint point)
public void setPointStructured(int index, RMPoint point)
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform aTransform)
getPathIterator
in interface java.awt.Shape
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform aTransform, double flatness)
getPathIterator
in interface java.awt.Shape
public void transformBy(com.reportmill.graphics.RMTransform aTransform)
public RMPath createTransformedPath(java.awt.geom.AffineTransform aTransform)
public RMPath getReversedPath()
public boolean equals(java.lang.Object anObj)
equals
in class java.lang.Object
public java.lang.Object clone()
clone
in class com.reportmill.base.RMObject
public com.reportmill.archiver.RXElement toXML(com.reportmill.archiver.RXArchiver anArchiver, java.lang.Object anOwner)
public java.lang.Object fromXML(com.reportmill.archiver.RXArchiver anArchiver, com.reportmill.archiver.RXElement anElement, java.lang.Object anOwner)