public class CurveConverter extends Object
To use it, you must:
endArc()
to force the end of the current ArcaddCubicCurve(CubicCurve2D)
for each new CubicCurveaddQuadCurve(QuadCurve2D)
for each new QuadCurveAfter each order, retrieve the state of the converter and then the corresponding Arc if the state is equal to END_ARC.
Remark: if a curve is flat, the algorithm will create a Line and then end the current curve.
Modifier and Type | Class and Description |
---|---|
class |
CurveConverter.AngleSegment
Represents an Angle Segment.
|
Modifier and Type | Field and Description |
---|---|
static int |
CURRENT_ARC |
static int |
END_ARC |
static int |
NO_ARC |
protected int |
state |
Constructor and Description |
---|
CurveConverter()
Constructor of the converter.
|
CurveConverter(boolean allowCircles)
Constructor of the converter.
|
Modifier and Type | Method and Description |
---|---|
int |
addCubicCurve(CubicCurve2D cubic)
Add a CubicCurve to the curve Vector.
|
int |
addQuadCurve(QuadCurve2D quad)
Add a QuadCurve to the Curve Vector.
|
void |
allowCircles(boolean allowCircles)
Set the conversion policy.
|
void |
clear()
Clear this converter to allow the creation of new Curves.
|
int |
endArc()
Force end of Arc.
|
int |
getCurrentState()
Return the current state.
|
Shape |
getLastShape()
Return the last Shape issued from the conversion process.
|
List<Shape> |
getShapes()
Return the Shapes issued from the conversion process.
|
boolean |
hasShapes()
Return true if this converter contain some converted Shapes.
|
boolean |
isAllowingCircles()
Return the conversion policy.
|
protected List<Shape> |
toArc2D()
Convert the current curve Vector to a Vector of Arc2D.
|
public static final int NO_ARC
public static final int CURRENT_ARC
public static final int END_ARC
protected int state
public CurveConverter()
public CurveConverter(boolean allowCircles)
allowCircles
- tyue if circles are allowed as results of the conversionpublic void clear()
public int getCurrentState()
public boolean isAllowingCircles()
public void allowCircles(boolean allowCircles)
allowCircles
- true if circles are allowaed in the conversionpublic Shape getLastShape()
public List<Shape> getShapes()
public boolean hasShapes()
public int endArc()
public int addCubicCurve(CubicCurve2D cubic)
cubic
- the CubicCurvepublic int addQuadCurve(QuadCurve2D quad)
quad
- the QuadCurve