Class RMPath
java.lang.Object
com.inductiveautomation.rm.graphics.RMPath
- All Implemented Interfaces:
- Archivable,- Shape,- Cloneable
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<iMax; i++) { int element = path.getElement(i, points);
   switch(element) {
     case RMPath.MOVE_TO:
     case RMPath.LINE_TO:
     case RMPath.QUAD_TO:
     case RMPath.CURVE_TO:
     case RMPath.CLOSE:
   }
 }
 - 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final bytestatic final bytestatic final bytestatic final bytestatic final bytestatic final RMPathstatic final bytestatic final byte
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddSegment(RMLine aSegment) Adds the list of segments to the path, starting with a moveto.voidaddSegments(List<? extends RMLine> theSegments) Adds the list of segments to the path, starting with a moveto.doubleReturns the total arc length of path segments.clone()Standard clone implementation.voidAdds 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.booleanReturns whether the given point is inside the path.booleancontains(Rectangle2D aRect) Returns whether the interior of the shape entirely contains the specified rectangular area.createTransformedPath(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.voidAdds a CurveTo element to the path for the given point and control points.booleanStandard equals implementation.fromXML(RXArchiver anArchiver, RXElement anElement) XML unarchival.Returns the bounds for the path as an integer rect.Returns the bounds for the path.Returns the rectangle that encloses all the control points.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).intReturns the number of elements in this path.intgetElementIndexForPointIndex(int index) Returns the element index for the given point index.byteReturns the last element.intgetElementPointIndex(int anIndex) Returns the point index for a given element.doubleReturns the height of the path.getHitInfo(RMBezier aBezier, boolean findFirstHit) Returns the hit info for the given bezier curve against this path.getHitInfo(RMLine aLine, boolean findFirstHit) Returns the hit info for the given line against this path.getPathInRect(Rectangle2D aRect) Returns a copy of the path scaled to exactly fit in the given rect.getPathIterator(AffineTransform aTransform) Returns a path iterator for this path and the given transform.getPathIterator(AffineTransform aTransform, double flatness) Returns a path iterator for this path and the given transform and flatness.getPoint(int anIndex) Returns the point at the given index.intReturns the number of points in the path.Returns the last point in the path.Returns a new path with the same points as this path, but in reverse order.Converts a path into a list of RMLine/RMQuadratic/RMBezier.Converts a path into a list subpath lists of RMLine/RMQuadratic/RMBezier.doublegetWidth()Returns the width of the path.byteReturns 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, int selectedPoint, RMSize handleSize) Returns the handle index for a given point against this path scaled to the given rect.booleanHit test the point (in path coords) against a given path point.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(Rectangle2D aRect) Returns whether the interior of the path intersects the interior of a specified Rectangle2D.booleanisClosed()Returns whether path has any open subpaths.voidlineTo(double px, double py) Adds a LineTo element to the path for the given point.voidAdds 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.voidAdds a MoveTo element to the path for the given point.intpointCountForElementType(int element) Returns the total number of points associated with a given type of path element.pointInPathCoordsFromPoint(RMPoint aPoint, RMRect aRect) Returns the given point converted to path coords for given path bounds.booleanpointOnPath(int pointIndex) Returns true of the point at pointIndex is on the path, and false if it is on the convex hull.voidquadTo(double cpx, double cpy, double px, double py) Adds a QuadTo element to the path for the given point and control point.voidAdds 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.voidremoveElement(int elementIndex) Removes an element, reconnecting the elements on either side of the deleted element.voidRemoves the last element from the path.voidreset()Resets the current path with no elements or points.voidSets the bounds that the path is relative to.voidSets 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.toXML(RXArchiver anArchiver) XML archival.voidtransformBy(RMTransform aTransform) Transforms the points in the path by the given transform.
- 
Field Details- 
WIND_NON_ZEROpublic static final byte WIND_NON_ZERO- See Also:
 
- 
WIND_EVEN_ODDpublic static final byte WIND_EVEN_ODD- See Also:
 
- 
MOVE_TOpublic static final byte MOVE_TO- See Also:
 
- 
LINE_TOpublic static final byte LINE_TO- See Also:
 
- 
QUAD_TOpublic static final byte QUAD_TO- See Also:
 
- 
CURVE_TOpublic static final byte CURVE_TO- See Also:
 
- 
CLOSEpublic static final byte CLOSE- See Also:
 
- 
unitRectPath
 
- 
- 
Constructor Details- 
RMPathpublic RMPath()Creates an empty path.
- 
RMPathCreates a path for the given shape.
 
- 
- 
Method Details- 
moveToAdds 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.
- 
lineToAdds 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.
- 
quadToAdds 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.
- 
curveToAdds 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.
- 
relativeMoveToAdds a MoveTo element to the path for the given point offset from the path's current point.
- 
relativeLineToAdds a LineTo element to the path for the given point offset from the path's current point.
- 
relativeCurveToAdds a CurveTo element to the path for the given point offset from the path's current point.
- 
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.
- 
getBoundsReturns the bounds for the path as an integer rect.
- 
getBounds2DReturns the bounds for the path.- Specified by:
- getBounds2Din interface- Shape
 
- 
setBoundsSets the bounds that the path is relative to.
- 
getControlPointBoundsReturns the rectangle that encloses all the control points.
- 
getElementCountpublic int getElementCount()Returns the number of elements in this path.
- 
getElementpublic byte getElement(int anIndex) Returns the element type at the given index.
- 
getElementReturns 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.
- 
getPointReturns the point at the given index.
- 
getPointLastReturns 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.
- 
pointCountForElementTypepublic int pointCountForElementType(int element) Returns the total number of points associated with a given type of path element.
- 
pointOnPathpublic boolean pointOnPath(int pointIndex) Returns true of the point at pointIndex is on the path, and false if it is on the convex hull.
- 
isClosedpublic boolean isClosed()Returns whether path has any open subpaths.
- 
getPathInRectReturns a copy of the path scaled to exactly fit in the given rect.
- 
containsReturns whether the given point is inside the path.
- 
containspublic boolean contains(double x, double y) Returns whether the given xy coordinate is inside the path.
- 
containsReturns whether the interior of the shape entirely contains the specified rectangular area.
- 
containspublic boolean contains(double x, double y, double w, double h) Returns whether the interior of the shape entirely contains the specified rectangular area.
- 
intersectsReturns whether the interior of the path intersects the interior of a specified Rectangle2D.- Specified by:
- intersectsin interface- 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- Shape
 
- 
intersectsReturns whether path is hit by point for a path linewidth.
- 
intersectsReturns 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.
- 
intersectsReturns whether path drawn with given linewidth is hit by given path.
- 
getHitInfoReturns the hit info for the given line against this path.
- 
getSegmentsConverts a path into a list of RMLine/RMQuadratic/RMBezier.
- 
getSubpathsSegmentsConverts a path into a list subpath lists of RMLine/RMQuadratic/RMBezier.
- 
addSegmentsAdds the list of segments to the path, starting with a moveto.
- 
addSegmentAdds the list of segments to the path, starting with a moveto.
- 
arcLengthpublic double arcLength()Returns the total arc length of path segments.
- 
getHitInfoReturns the hit info for the given bezier curve against this path.
- 
handleAtPointForBoundspublic 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. Only returns points that are on the path, except for the control points of selectedPoint (if not -1)
- 
hitHandleHit test the point (in path coords) against a given path point.
- 
pointInPathCoordsFromPointReturns the given point converted to path coords for given path bounds.
- 
removeLastElementpublic void removeLastElement()Removes the last element from the path.
- 
removeElementpublic void removeElement(int elementIndex) Removes an element, reconnecting the elements on either side of the deleted element.
- 
setPointSets the path point at the given index to the given point.
- 
setPointStructuredResets the point at the given index to the given point, while preserving something.
- 
getPathIteratorReturns a path iterator for this path and the given transform.- Specified by:
- getPathIteratorin interface- Shape
 
- 
getPathIteratorReturns a path iterator for this path and the given transform and flatness.- Specified by:
- getPathIteratorin interface- Shape
 
- 
transformByTransforms the points in the path by the given transform.
- 
createTransformedPathReturns a transformed version of this path.
- 
getReversedPathReturns a new path with the same points as this path, but in reverse order.
- 
equalsStandard equals implementation.
- 
cloneStandard clone implementation.
- 
toXMLXML archival.- Specified by:
- toXMLin interface- Archivable
 
- 
fromXMLXML unarchival.- Specified by:
- fromXMLin interface- Archivable
 
 
-