|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectview.ShapeFactory
public class ShapeFactory
A class that allows creation of Shapes from a single string. The string must
be a double-tokenizable list, specified in
StringTool.doubleTokenize(java.lang.String). If creating a new shape, the first
entry in the string must be a float pair, which is then used for a
move-to command, otherwise a move to 0,0 is prepended. Note that all float
pairs are interpreted as line-to commands.
The instance
returned by the createShape(java.lang.String) method is a general path.
| Nested Class Summary | |
|---|---|
static class |
ShapeFactory.Display
Display the command line shape in a single window. |
static class |
ShapeFactory.Drawings
The possible drawing types understood. |
static class |
ShapeFactory.Ellipse
We test the ellipse shape in various ways. |
static class |
ShapeFactory.Paths
For generating general path from strings. |
| Constructor Summary | |
|---|---|
ShapeFactory()
|
|
| Method Summary | |
|---|---|
private static Shape |
addStringPath(GeneralPath into,
String points)
Adds the points stored in the string to this general path, using line to's for each point pair encountered, quad to's for quadruple entries, and curve to for hexagesimal entries. |
static PointDraw |
createPointDraw(String pd,
boolean filled)
Creates a new PointDraw object using a string. |
static Shape |
createShape(String poly)
Creates a new shape instance using the default general-path constructor |
static Shape |
createShape(String poly,
int rule)
Creates a new shape instance using the general-path constructor with the specified winding rule. |
static Shape |
createShape(String poly,
Shape add)
Creates a new shape instance using the exisitng shape and adding the string to it. |
static ShapeDraw |
createShapeDraw(String poly,
boolean filled)
Creates a new shape instance using the default general-path constructor |
static TextDraw |
createTextDraw(String td,
boolean fill)
Creates a new TextDraw object using a string definition. |
static String |
toPointDrawString(PointDraw s)
Converts a PointDraw into a string that can be used in
constructing the
shape. |
static String |
toShapeString(Shape s)
Converts a shape into a string that can be used in constructing the shape. |
static String |
toString(ShapeFactory.Drawings type,
Object what)
Converts the object passed over as the specialised type. |
static String |
toTextDrawString(TextDraw s)
Converts a TextDraw into a string that can be used in
constructing the
shape. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ShapeFactory()
| Method Detail |
|---|
public static Shape createShape(String poly)
public static Shape createShape(String poly,
int rule)
public static Shape createShape(String poly,
Shape add)
public static ShapeDraw createShapeDraw(String poly,
boolean filled)
public static PointDraw createPointDraw(String pd,
boolean filled)
PointDraw object using a string. The string
starts with a pair of doubles separated by a StringTool.COMMA.
Then a StringTool.OUTERLIST separates this from a
shape definition.
public static TextDraw createTextDraw(String td,
boolean fill)
TextDraw object using a string definition.
The string must be formatted that each defining substring is
separated with a StringTool.OUTERLIST. Empty substrings
are interpreted as default values (null for Font, zero for rotation
and justification, 0,0 for points).
MyPoint2D.parsePoint(java.lang.String).MyPoint2D.parsePoint(java.lang.String).MyFontStringTool.DOLLAR if used in a normalized canvas.
private static Shape addStringPath(GeneralPath into,
String points)
into - The general path into which the points should be added.points - A double-tokenizable list of coordinate-pairspublic static String toShapeString(Shape s)
Ellipse2D, we return a string
like #ELLIPSE plus the two radii. In any other case, a path
iterator is used to link the individual segments together.
public static String toPointDrawString(PointDraw s)
PointDraw into a string that can be used in
constructing the
shape.
public static String toTextDrawString(TextDraw s)
TextDraw into a string that can be used in
constructing the
shape.
public static String toString(ShapeFactory.Drawings type,
Object what)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||