Package com.reportmill.graphics
Class RMPath
- java.lang.Object
- 
- com.reportmill.base.RMObject
- 
- com.reportmill.graphics.RMPath
 
 
- 
- All Implemented Interfaces:
- RMArchiver.Archiving,- java.awt.Shape,- java.lang.Cloneable
 
 public class RMPath extends RMObject implements java.awt.Shape RMPath - A graphics path (moveTo, lineTo, etc.). It provides the following functionality: - Allows for easy initialization with the path constructions methods (moveToPoint:, lineToPoint:, etc.). - Provides simple methods for path operations (stroke, fill, clip, etc.). Iterate over path like this: RMPoint points[] = new RMPoint[3]; for(int i=0, iMax=path.getElementCount(); i- 
- 
Field SummaryFields Modifier and Type Field Description static byteCLOSEstatic byteCURVE_TOstatic byteLINE_TOstatic byteLineCapButtstatic byteLineCapProjectingSquarestatic byteLineCapRoundstatic byteLineJoinBevelstatic byteLineJoinMiterstatic byteLineJoinRoundstatic byteMOVE_TOstatic byteQUAD_TOstatic RMPathunitRectPathstatic byteWIND_EVEN_ODDstatic byteWIND_NON_ZERO
 - 
Constructor SummaryConstructors Constructor Description RMPath()Creates an empty path.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Standard clone implementation.voidclosePath()Adds a Close element to the given path.booleancontains(double x, double y)Returns whether the given xy coordinate is inside the path.booleancontains(double x, double y, double w, double h)Returns whether the interior of the shape entirely contains the specified rectangular area.booleancontains(java.awt.geom.Point2D aPoint)Returns whether the given point is inside the path.booleancontains(java.awt.geom.Rectangle2D aRect)Returns whether the interior of the shape entirely contains the specified rectangular area.RMPathcreateTransformedPath(java.awt.geom.AffineTransform aTransform)Returns a transformed version of this path.voidcurveTo(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.voidcurveTo(RMPoint cp1, RMPoint cp2, RMPoint p)Adds a CurveTo element to the path for the given point and control points.booleanequals(java.lang.Object anObj)Standard equals implementation.java.lang.ObjectfromXML(RXArchiver anArchiver, RXElement anElement)XML unarchival.java.awt.RectanglegetBounds()Returns the bounds for the path as an integer rect.java.awt.geom.Rectangle2DgetBounds2D()Returns the bounds for the path.RMRectgetBoundsRM()Returns the bounds for the path.bytegetElement(int anIndex)Returns the element type at the given index.bytegetElement(int anIndex, RMPoint[] points)Returns the element type at the given index and its associated points (returned in the given point array).intgetElementCount()Returns the number of elements in this path.intgetElementIndexForPointIndex(int index)Returns the element index for the given point index.bytegetElementLast()Returns the last element.intgetElementPointIndex(int anIndex)Returns the point index for a given element.doublegetHeight()Returns the height of the path.RMHitInfogetHitInfo(RMBezier aBezier, boolean findFirstHit)Returns the hit info for the given bezier curve against this path.RMHitInfogetHitInfo(RMLine aLine, boolean findFirstHit)Returns the hit info for the given line against this path.RMPathgetPathInRect(java.awt.geom.Rectangle2D aRect)Returns a copy of the path scaled to exactly fit in the given rect.java.awt.geom.PathIteratorgetPathIterator(java.awt.geom.AffineTransform aTransform)Returns a path iterator for this path and the given transform.java.awt.geom.PathIteratorgetPathIterator(java.awt.geom.AffineTransform aTransform, double flatness)Returns a path iterator for this path and the given transform and flatness.java.awt.geom.PathIteratorgetPathIteratorInRect(java.awt.geom.Rectangle2D aRect)Returns a path iterator for the path transformted to be in the given rect.RMPointgetPoint(int anIndex)Returns the point at the given index.intgetPointCount()Returns the number of points in the path.RMPointgetPointLast()Returns the last point in the path.doublegetWidth()Returns the width of the path.bytegetWindingRule()Returns the winding rule which describes how inner path perimeters are filled and clipped.doublegetX()Returns the X of the path.doublegetY()Returns the Y of the path.inthandleAtPointForBounds(RMPoint aPoint, RMRect aRect)Returns the handle index for a given point against this path scaled to the given rect.java.lang.ObjectinitWithArchiver(RMArchiver anArchiver)Legacy archival.booleanintersects(double x, double y, double w, double h)Returns whether the interior of the path intersects the interior of a specified rectangular area.booleanintersects(double x, double y, double w, double h, float lineWidth)Returns whether path drawn with given linewidth is hit by given rect.booleanintersects(RMPoint aPoint, float lineWidth)Returns whether path is hit by point for a path linewidth.booleanintersects(RMLine aLine)Returns whether path is hit by a line.booleanintersects(RMPath aPath, float lineWidth)Returns whether path drawn with given linewidth is hit by given path.booleanintersects(java.awt.geom.Rectangle2D aRect)Returns whether the interior of the path intersects the interior of a specified Rectangle2D.voidlineTo(double px, double py)Adds a LineTo element to the path for the given point.voidlineTo(RMPoint p)Adds a LineTo element to the path for the given point.voidmoveTo(double px, double py)Adds a MoveTo element to the path for the given point.voidmoveTo(RMPoint p)Adds a MoveTo element to the path for the given point.RMPointpointInPathCoordsFromPoint(RMPoint aPoint, RMRect aRect)Returns the given point converted to path coords for given path bounds.voidquadTo(double cpx, double cpy, double px, double py)Adds a QuadTo element to the path for the given point and control point.voidquadTo(RMPoint cp, RMPoint p)Adds a QuadTo element to the path for the given point and control point.voidrelativeCurveTo(RMPoint cp1, RMPoint cp2, RMPoint aPoint)Adds a CurveTo element to the path for the given point offset from the path's current point.voidrelativeLineTo(RMPoint aPoint)Adds a LineTo element to the path for the given point offset from the path's current point.voidrelativeMoveTo(RMPoint aPoint)Adds a MoveTo element to the path for the given point offset from the path's current point.voidremoveLastElement()Removes the last element from the path.voidreset()Resets the current path with no elements or points.voidsetBounds(RMRect bounds)Sets the bounds that the path is relative to.voidsetPoint(int index, RMPoint point)Sets the path point at the given index to the given point.voidsetPointStructured(int index, RMPoint point)Resets the point at the given index to the given point, while preserving something.voidsetWindingRule(byte windingRule)Sets the winding rule which describes how inner path perimeters are filled and clipped.RXElementtoXML(RXArchiver anArchiver)XML archival.voidtransformBy(RMTransform aTransform)Transforms the points in the path by the given transform.- 
Methods inherited from class com.reportmill.base.RMObjectcopy, didChange, didUndo, getAnimAttribute, getClassNameShort, undoClone, undoCopy, undoEquals
 
- 
 
- 
 - 
- 
Field Detail- 
LineCapButtpublic static final byte LineCapButt - See Also:
- Constant Field Values
 
 - 
LineCapRoundpublic static final byte LineCapRound - See Also:
- Constant Field Values
 
 - 
LineCapProjectingSquarepublic static final byte LineCapProjectingSquare - See Also:
- Constant Field Values
 
 - 
LineJoinMiterpublic static final byte LineJoinMiter - See Also:
- Constant Field Values
 
 - 
LineJoinRoundpublic static final byte LineJoinRound - See Also:
- Constant Field Values
 
 - 
LineJoinBevelpublic static final byte LineJoinBevel - See Also:
- Constant Field Values
 
 - 
WIND_NON_ZEROpublic static final byte WIND_NON_ZERO - See Also:
- Constant Field Values
 
 - 
WIND_EVEN_ODDpublic static final byte WIND_EVEN_ODD - See Also:
- Constant Field Values
 
 - 
MOVE_TOpublic static final byte MOVE_TO - See Also:
- Constant Field Values
 
 - 
LINE_TOpublic static final byte LINE_TO - See Also:
- Constant Field Values
 
 - 
QUAD_TOpublic static final byte QUAD_TO - See Also:
- Constant Field Values
 
 - 
CURVE_TOpublic static final byte CURVE_TO - See Also:
- Constant Field Values
 
 - 
CLOSEpublic static final byte CLOSE - See Also:
- Constant Field Values
 
 - 
unitRectPathpublic static final RMPath unitRectPath 
 
- 
 - 
Method Detail- 
moveTopublic void moveTo(RMPoint p) Adds a MoveTo element to the path for the given point.
 - 
moveTopublic void moveTo(double px, double py)Adds a MoveTo element to the path for the given point.
 - 
lineTopublic void lineTo(RMPoint p) Adds a LineTo element to the path for the given point.
 - 
lineTopublic void lineTo(double px, double py)Adds a LineTo element to the path for the given point.
 - 
quadTopublic void quadTo(RMPoint cp, RMPoint p) Adds a QuadTo element to the path for the given point and control point.
 - 
quadTopublic void quadTo(double cpx, double cpy, double px, double py)Adds a QuadTo element to the path for the given point and control point.
 - 
curveTopublic void curveTo(RMPoint cp1, RMPoint cp2, RMPoint p) Adds a CurveTo element to the path for the given point and control points.
 - 
curveTopublic 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.
 - 
closePathpublic void closePath() Adds a Close element to the given path.
 - 
resetpublic void reset() Resets the current path with no elements or points.
 - 
relativeMoveTopublic void relativeMoveTo(RMPoint aPoint) Adds a MoveTo element to the path for the given point offset from the path's current point.
 - 
relativeLineTopublic void relativeLineTo(RMPoint aPoint) Adds a LineTo element to the path for the given point offset from the path's current point.
 - 
relativeCurveTopublic 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.
 - 
transformBypublic void transformBy(RMTransform aTransform) Transforms the points in the path by the given transform.
 - 
createTransformedPathpublic RMPath createTransformedPath(java.awt.geom.AffineTransform aTransform) Returns a transformed version of this path.
 - 
getWindingRulepublic byte getWindingRule() Returns the winding rule which describes how inner path perimeters are filled and clipped.
 - 
setWindingRulepublic void setWindingRule(byte windingRule) Sets the winding rule which describes how inner path perimeters are filled and clipped.
 - 
getXpublic double getX() Returns the X of the path.
 - 
getYpublic double getY() Returns the Y of the path.
 - 
getWidthpublic double getWidth() Returns the width of the path.
 - 
getHeightpublic double getHeight() Returns the height of the path.
 - 
getBoundspublic java.awt.Rectangle getBounds() Returns the bounds for the path as an integer rect.- Specified by:
- getBoundsin interface- java.awt.Shape
 
 - 
getBounds2Dpublic java.awt.geom.Rectangle2D getBounds2D() Returns the bounds for the path.- Specified by:
- getBounds2Din interface- java.awt.Shape
 
 - 
getBoundsRMpublic RMRect getBoundsRM() Returns the bounds for the path.
 - 
setBoundspublic void setBounds(RMRect bounds) Sets the bounds that the path is relative to.
 - 
getElementCountpublic int getElementCount() Returns the number of elements in this path.
 - 
getElementpublic byte getElement(int anIndex) Returns the element type at the given index.
 - 
getElementpublic byte getElement(int anIndex, RMPoint[] points)Returns the element type at the given index and its associated points (returned in the given point array).
 - 
getElementLastpublic byte getElementLast() Returns the last element.
 - 
getPointCountpublic int getPointCount() Returns the number of points in the path.
 - 
getPointpublic RMPoint getPoint(int anIndex) Returns the point at the given index.
 - 
getPointLastpublic RMPoint getPointLast() Returns the last point in the path.
 - 
getElementPointIndexpublic int getElementPointIndex(int anIndex) Returns the point index for a given element.
 - 
getElementIndexForPointIndexpublic int getElementIndexForPointIndex(int index) Returns the element index for the given point index.
 - 
getPathInRectpublic RMPath getPathInRect(java.awt.geom.Rectangle2D aRect) Returns a copy of the path scaled to exactly fit in the given rect.
 - 
containspublic boolean contains(java.awt.geom.Point2D aPoint) Returns whether the given point is inside the path.- Specified by:
- containsin interface- java.awt.Shape
 
 - 
containspublic boolean contains(double x, double y)Returns whether the given xy coordinate is inside the path.- Specified by:
- containsin interface- java.awt.Shape
 
 - 
containspublic boolean contains(java.awt.geom.Rectangle2D aRect) Returns whether the interior of the shape entirely contains the specified rectangular area.- Specified by:
- containsin interface- java.awt.Shape
 
 - 
containspublic boolean contains(double x, double y, double w, double h)Returns whether the interior of the shape entirely contains the specified rectangular area.- Specified by:
- containsin interface- java.awt.Shape
 
 - 
intersectspublic boolean intersects(java.awt.geom.Rectangle2D aRect) Returns whether the interior of the path intersects the interior of a specified Rectangle2D.- Specified by:
- intersectsin interface- java.awt.Shape
 
 - 
intersectspublic 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.- Specified by:
- intersectsin interface- java.awt.Shape
 
 - 
intersectspublic boolean intersects(RMPoint aPoint, float lineWidth) Returns whether path is hit by point for a path linewidth.
 - 
intersectspublic boolean intersects(RMLine aLine) Returns whether path is hit by a line.
 - 
intersectspublic boolean intersects(double x, double y, double w, double h, float lineWidth)Returns whether path drawn with given linewidth is hit by given rect.
 - 
intersectspublic boolean intersects(RMPath aPath, float lineWidth) Returns whether path drawn with given linewidth is hit by given path.
 - 
getHitInfopublic RMHitInfo getHitInfo(RMLine aLine, boolean findFirstHit) Returns the hit info for the given line against this path.
 - 
getHitInfopublic RMHitInfo getHitInfo(RMBezier aBezier, boolean findFirstHit) Returns the hit info for the given bezier curve against this path.
 - 
handleAtPointForBoundspublic int handleAtPointForBounds(RMPoint aPoint, RMRect aRect) Returns the handle index for a given point against this path scaled to the given rect.
 - 
pointInPathCoordsFromPointpublic RMPoint pointInPathCoordsFromPoint(RMPoint aPoint, RMRect aRect) Returns the given point converted to path coords for given path bounds.
 - 
removeLastElementpublic void removeLastElement() Removes the last element from the path.
 - 
setPointpublic void setPoint(int index, RMPoint point)Sets the path point at the given index to the given point.
 - 
setPointStructuredpublic void setPointStructured(int index, RMPoint point)Resets the point at the given index to the given point, while preserving something.
 - 
getPathIteratorpublic java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform aTransform) Returns a path iterator for this path and the given transform.- Specified by:
- getPathIteratorin interface- java.awt.Shape
 
 - 
getPathIteratorpublic 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.- Specified by:
- getPathIteratorin interface- java.awt.Shape
 
 - 
getPathIteratorInRectpublic java.awt.geom.PathIterator getPathIteratorInRect(java.awt.geom.Rectangle2D aRect) Returns a path iterator for the path transformted to be in the given rect.
 - 
equalspublic boolean equals(java.lang.Object anObj) Standard equals implementation.- Overrides:
- equalsin class- java.lang.Object
 
 - 
clonepublic java.lang.Object clone() Standard clone implementation.
 - 
toXMLpublic RXElement toXML(RXArchiver anArchiver) XML archival.
 - 
fromXMLpublic java.lang.Object fromXML(RXArchiver anArchiver, RXElement anElement) XML unarchival.
 - 
initWithArchiverpublic java.lang.Object initWithArchiver(RMArchiver anArchiver) Legacy archival.- Specified by:
- initWithArchiverin interface- RMArchiver.Archiving
- Overrides:
- initWithArchiverin class- RMObject
 
 
- 
 
-