public class ShapeStringUtils extends Object
java.lang.Strings and vice versa.
| Constructor and Description |
|---|
ShapeStringUtils()
|
| Modifier and Type | Method and Description |
|---|---|
static GeneralPath |
createGeneralPath(String
This creates a
GeneralPath of rule WIND_EVEN_ODD that represents this shape data.
|
static PathIterator |
createPathIterator(String
This creates a
PathIterator that iterates over the text in
s.
|
static PathIterator |
createPathIterator(String
This creates a
PathIterator that iterates over the text in
s.
|
static String |
toString(PathIterator
|
static String |
toString(Shape
This describes a shape in a
String.
|
public static StringtoString(Shape s)
String. The model is used is based on how SVG encodes shape data.
The call: ShapeUtils.createPathIterator(ShapeUtils.toString(shape));
should result in an identical shape.
The shape data is formatted as a single letter (m, l, q, c, z) followed by the appropriate number of points (2, 2, 4, 6, 0 respectively). This uses floats, not doubles, so it will not contain strings with an exponent (i.e. "1.3e-4").
s - the shape to describe
public static StringtoString(PathIterator i)
public static PathIteratorcreatePathIterator(String s)
PathIterator that iterates over the text in
s.
The shape returned uses winding rule WIND_EVEN_ODD.
s - textual representation of a path.
This should be the output of ShapeUtils.toString(), resembling: "m 1 2 l 3 4 q 5 6 7 8 c 9 10 11 12 13 14 z"
PathIterator that will iterate over the data in s.
public static GeneralPathcreateGeneralPath(String s)
GeneralPath of rule WIND_EVEN_ODD that represents this shape data.
This method simply calls: GeneralPath p = new GeneralPath(); p.append(createPathIterator(s),true); return p;
s - textual representation of a path.
This should be the output of ShapeUtils.toString(), resembling: "m 1 2 l 3 4 q 5 6 7 8 c 9 10 11 12 13 14 z"
GeneralPath that represents this shape.
public static PathIteratorcreatePathIterator(String s, int windingRule)
PathIterator that iterates over the text in
s.
s - textual representation of a path.
windingRule - the winding rule to use. (This should be PathIterator.WIND_NON_ZERO or PathIterator.WIND_EVEN_ODD.)
This should be the output of ShapeUtils.toString(), resembling: "m 1 2 l 3 4 q 5 6 7 8 c 9 10 11 12 13 14 z"
PathIterator that will iterate over the data in s.