Package com.mxgraph.util.svg
Class AWTPathProducer
java.lang.Object
com.mxgraph.util.svg.AWTPathProducer
- All Implemented Interfaces:
PathHandler,ShapeProducer
This class provides an implementation of the PathHandler that initializes
a Shape from the value of a path's 'd' attribute.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected floatThe current x position.protected floatThe current y position.protected ExtendedGeneralPathThe temporary value of extendedGeneralPath.protected intThe winding rule to use to construct the path.protected floatThe reference x point for smooth arcs.protected floatThe reference y point for smooth arcs. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidarcAbs(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) voidarcRel(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) voidImplementsPathHandler.closePath().static ShapecreateShape(String text, int wr) Utility method for creating an ExtendedGeneralPath.voidcurvetoCubicAbs(float x1, float y1, float x2, float y2, float x, float y) voidcurvetoCubicRel(float x1, float y1, float x2, float y2, float x, float y) voidcurvetoCubicSmoothAbs(float x2, float y2, float x, float y) voidcurvetoCubicSmoothRel(float x2, float y2, float x, float y) voidcurvetoQuadraticAbs(float x1, float y1, float x, float y) voidcurvetoQuadraticRel(float x1, float y1, float x, float y) voidcurvetoQuadraticSmoothAbs(float x, float y) voidcurvetoQuadraticSmoothRel(float x, float y) voidendPath()ImplementsPathHandler.endPath().getShape()Returns the Shape object initialized during the last parsing.intReturns the current winding rule.voidlinetoAbs(float x, float y) ImplementsPathHandler.linetoAbs(float,float).voidlinetoHorizontalAbs(float x) ImplementsPathHandler.linetoHorizontalAbs(float).voidlinetoHorizontalRel(float x) ImplementsPathHandler.linetoHorizontalRel(float).voidlinetoRel(float x, float y) ImplementsPathHandler.linetoRel(float,float).voidlinetoVerticalAbs(float y) ImplementsPathHandler.linetoVerticalAbs(float).voidlinetoVerticalRel(float y) ImplementsPathHandler.linetoVerticalRel(float).voidmovetoAbs(float x, float y) ImplementsPathHandler.movetoAbs(float,float).voidmovetoRel(float x, float y) ImplementsPathHandler.movetoRel(float,float).voidsetWindingRule(int i) Sets the winding rule used to construct the path.voidImplementsPathHandler.startPath().
-
Field Details
-
path
The temporary value of extendedGeneralPath. -
currentX
protected float currentXThe current x position. -
currentY
protected float currentYThe current y position. -
xCenter
protected float xCenterThe reference x point for smooth arcs. -
yCenter
protected float yCenterThe reference y point for smooth arcs. -
windingRule
protected int windingRuleThe winding rule to use to construct the path.
-
-
Constructor Details
-
AWTPathProducer
public AWTPathProducer()
-
-
Method Details
-
createShape
Utility method for creating an ExtendedGeneralPath.- Parameters:
text- The text representation of the path specification.wr- The winding rule to use for creating the path.- Throws:
ParseException
-
setWindingRule
public void setWindingRule(int i) Sets the winding rule used to construct the path.- Specified by:
setWindingRulein interfaceShapeProducer
-
getWindingRule
public int getWindingRule()Returns the current winding rule.- Specified by:
getWindingRulein interfaceShapeProducer
-
getShape
Returns the Shape object initialized during the last parsing.- Specified by:
getShapein interfaceShapeProducer- Returns:
- the shape or null if this handler has not been used by a parser.
-
startPath
ImplementsPathHandler.startPath().- Specified by:
startPathin interfacePathHandler- Throws:
ParseException- if an error occured while processing the path
-
endPath
ImplementsPathHandler.endPath().- Specified by:
endPathin interfacePathHandler- Throws:
ParseException- if an error occured while processing the path
-
movetoRel
ImplementsPathHandler.movetoRel(float,float).- Specified by:
movetoRelin interfacePathHandler- Parameters:
x- the relative x coordinate for the end pointy- the relative y coordinate for the end point- Throws:
ParseException- if an error occured while processing the path
-
movetoAbs
ImplementsPathHandler.movetoAbs(float,float).- Specified by:
movetoAbsin interfacePathHandler- Parameters:
x- the absolute x coordinate for the end pointy- the absolute y coordinate for the end point- Throws:
ParseException- if an error occured while processing the path
-
closePath
ImplementsPathHandler.closePath().- Specified by:
closePathin interfacePathHandler- Throws:
ParseException- if an error occured while processing the path
-
linetoRel
ImplementsPathHandler.linetoRel(float,float).- Specified by:
linetoRelin interfacePathHandler- Parameters:
x- the relative x coordinates for the end pointy- the relative y coordinates for the end point- Throws:
ParseException- if an error occured while processing the path
-
linetoAbs
ImplementsPathHandler.linetoAbs(float,float).- Specified by:
linetoAbsin interfacePathHandler- Parameters:
x- the absolute x coordinate for the end pointy- the absolute y coordinate for the end point- Throws:
ParseException- if an error occured while processing the path
-
linetoHorizontalRel
ImplementsPathHandler.linetoHorizontalRel(float).- Specified by:
linetoHorizontalRelin interfacePathHandler- Parameters:
x- the relative X coordinate of the end point- Throws:
ParseException- if an error occured while processing the path
-
linetoHorizontalAbs
ImplementsPathHandler.linetoHorizontalAbs(float).- Specified by:
linetoHorizontalAbsin interfacePathHandler- Parameters:
x- the absolute X coordinate of the end point- Throws:
ParseException- if an error occured while processing the path
-
linetoVerticalRel
ImplementsPathHandler.linetoVerticalRel(float).- Specified by:
linetoVerticalRelin interfacePathHandler- Parameters:
y- the relative Y coordinate of the end point- Throws:
ParseException- if an error occured while processing the path
-
linetoVerticalAbs
ImplementsPathHandler.linetoVerticalAbs(float).- Specified by:
linetoVerticalAbsin interfacePathHandler- Parameters:
y- the absolute Y coordinate of the end point- Throws:
ParseException- if an error occured while processing the path
-
curvetoCubicRel
public void curvetoCubicRel(float x1, float y1, float x2, float y2, float x, float y) throws ParseException - Specified by:
curvetoCubicRelin interfacePathHandler- Parameters:
x1- the relative x coordinate for the first control pointy1- the relative y coordinate for the first control pointx2- the relative x coordinate for the second control pointy2- the relative y coordinate for the second control pointx- the relative x coordinate for the end pointy- the relative y coordinate for the end point- Throws:
ParseException- if an error occured while processing the path
-
curvetoCubicAbs
public void curvetoCubicAbs(float x1, float y1, float x2, float y2, float x, float y) throws ParseException - Specified by:
curvetoCubicAbsin interfacePathHandler- Parameters:
x1- the absolute x coordinate for the first control pointy1- the absolute y coordinate for the first control pointx2- the absolute x coordinate for the second control pointy2- the absolute y coordinate for the second control pointx- the absolute x coordinate for the end pointy- the absolute y coordinate for the end point- Throws:
ParseException- if an error occured while processing the path
-
curvetoCubicSmoothRel
- Specified by:
curvetoCubicSmoothRelin interfacePathHandler- Parameters:
x2- the relative x coordinate for the second control pointy2- the relative y coordinate for the second control pointx- the relative x coordinate for the end pointy- the relative y coordinate for the end point- Throws:
ParseException- if an error occured while processing the path
-
curvetoCubicSmoothAbs
- Specified by:
curvetoCubicSmoothAbsin interfacePathHandler- Parameters:
x2- the absolute x coordinate for the second control pointy2- the absolute y coordinate for the second control pointx- the absolute x coordinate for the end pointy- the absolute y coordinate for the end point- Throws:
ParseException- if an error occured while processing the path
-
curvetoQuadraticRel
- Specified by:
curvetoQuadraticRelin interfacePathHandler- Parameters:
x1- the relative x coordinate for the control pointy1- the relative y coordinate for the control pointx- the relative x coordinate for the end pointy- the relative x coordinate for the end point- Throws:
ParseException- if an error occured while processing the path
-
curvetoQuadraticAbs
- Specified by:
curvetoQuadraticAbsin interfacePathHandler- Parameters:
x1- the absolute x coordinate for the control pointy1- the absolute y coordinate for the control pointx- the absolute x coordinate for the end pointy- the absolute x coordinate for the end point- Throws:
ParseException- if an error occured while processing the path
-
curvetoQuadraticSmoothRel
- Specified by:
curvetoQuadraticSmoothRelin interfacePathHandler- Parameters:
x- the relative x coordinate for the end pointy- the relative y coordinate for the end point- Throws:
ParseException- if an error occured while processing the path
-
curvetoQuadraticSmoothAbs
- Specified by:
curvetoQuadraticSmoothAbsin interfacePathHandler- Parameters:
x- the absolute x coordinate for the end pointy- the absolute y coordinate for the end point- Throws:
ParseException- if an error occured while processing the path
-
arcRel
public void arcRel(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException - Specified by:
arcRelin interfacePathHandler- Parameters:
rx- the X axis radius for the ellipsery- the Y axis radius for the ellipsexAxisRotation- the rotation angle in degrees for the ellipse's X-axis relative to the X-axislargeArcFlag- the value of the large-arc-flagsweepFlag- the value of the sweep-flagx- the relative x coordinate for the end pointy- the relative y coordinate for the end point- Throws:
ParseException- if an error occured while processing the path
-
arcAbs
public void arcAbs(float rx, float ry, float xAxisRotation, boolean largeArcFlag, boolean sweepFlag, float x, float y) throws ParseException - Specified by:
arcAbsin interfacePathHandler- Parameters:
rx- the X axis radius for the ellipsery- the Y axis radius for the ellipsexAxisRotation- the rotation angle in degrees for the ellipse's X-axis relative to the X-axislargeArcFlag- the value of the large-arc-flagsweepFlag- the value of the sweep-flagx- the absolute x coordinate for the end pointy- the absolute y coordinate for the end point- Throws:
ParseException- if an error occured while processing the path
-