|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.davisor.graphics.data.ShapeParameters
ShapeParameters define shapes with a generic set of shape parameters. Each parameter defines one aspect of a desired shape. Together, the parameters form a shape specification from which a concrete shape object can be created.
Available shape parameters are:
The parameter values can be set explicitly, or they can be parsed
from a parameter string as defined by the parse(String,ParsePosition) method. Any of the shape parameters
can also be left unset, in which case the parameter default value,
if any, will be used.
ShapeParameters(String,ParsePosition),
parse(String,ParsePosition),
toData(com.davisor.graphics.data.ShapeType),
toShape(),
BetterPath,
PaintParameters,
ShapeType,
ShapeType.createShape(java.lang.String),
Serialized Form| Field Summary | |
static int |
ANGLE
Code for a 'angle' keyword. |
static int |
ANGLEFROM
Code for a 'angleFrom' keyword. |
static int |
ANGLEKEY
Code for a 'angleKey' keyword. |
static int |
ANGLEMAX
Code for a 'angleMax' keyword. |
static int |
ANGLEMIN
Code for a 'angleMin' keyword. |
static int |
ANGLETO
Code for a 'angleTo' keyword. |
static int |
NAME
Code for an 'name' keyword. |
static int |
PATH
Code for a 'path' keyword. |
static int |
SCALE
Code for a 'scale' keyword. |
static int |
SCALEFROM
Code for a 'scaleFrom' keyword. |
static int |
SCALEKEY
Code for a 'scaleKey' keyword. |
static int |
SCALEMAX
Code for a 'scaleMax' keyword. |
static int |
SCALEMIN
Code for a 'scaleMin' keyword. |
static int |
SCALETO
Code for a 'scaleTo' keyword. |
static int |
SVG
Code for a 'svg' keyword. |
| Fields inherited from interface com.davisor.graphics.ParameterConstants |
ANNOTATIONADDRESS, ANNOTATIONCOORDS, ANNOTATIONDESCRIPTION, ANNOTATIONDESCRIPTION_MOZILLA, ANNOTATIONONMOUSEOUT, ANNOTATIONONMOUSEOVER, ANNOTATIONSEPARATOR, ANNOTATIONSHAPE, ANNOTATIONTARGET, CENTER, DOWN, FIELDSEPARATOR, LEFT, RIGHT, TAILSEPARATOR, TERMINAL, UNSET, UP, VALUESEPARATOR |
| Constructor Summary | |
ShapeParameters()
Default constructor. |
|
ShapeParameters(java.awt.Shape shape)
Creates a new shape matching given example shape. |
|
ShapeParameters(java.lang.String name,
java.lang.Float angle,
java.lang.Float scale,
BetterPath path)
Creates a new set of shape parameters. |
|
ShapeParameters(java.lang.String parameters,
java.text.ParsePosition status)
Creates a new set of shape parameters from a shape parameter string. |
|
ShapeParameters(java.lang.String shapePath,
java.lang.String shapeName)
Creates a new shape according to the given SVG path specifications. |
|
| Method Summary | |
java.lang.Float |
getAngle()
Gets the shape rotation angle (may be null). |
java.lang.String |
getName()
Gets the shape name (may be null). |
BetterPath |
getPath()
Gets the shape coordinate path (may be null). |
java.lang.Float |
getScale()
Gets the shapes scale multiplier (may be null). |
void |
parse(java.lang.String parameters,
java.text.ParsePosition status)
Interpretes shape parameters from a shape parameter specification string. |
void |
parsePath(java.lang.String shapePath,
java.lang.String shapeName)
Interpretes a shape path. |
protected java.lang.Object |
readResolve()
Resolves this object back to a shape during deserialization. |
void |
setParameters(java.awt.Shape shape)
Sets shape parameters to match given shape. |
java.awt.Shape |
toData(ShapeType type)
Creates a shape value of the given type and the current shape parameters. |
static java.awt.Shape |
toData(ShapeType type,
java.lang.Object value)
Creates a shape value of the given type from the given data object. |
java.awt.Shape |
toShape()
Creates a new shape based on the current shape parameters. |
java.lang.String |
toString()
Gets the shape parameter string. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int ANGLE
public static final int ANGLEFROM
public static final int ANGLEKEY
public static final int ANGLEMAX
public static final int ANGLEMIN
public static final int ANGLETO
public static final int NAME
public static final int PATH
public static final int SCALE
public static final int SCALEFROM
public static final int SCALEKEY
public static final int SCALEMAX
public static final int SCALEMIN
public static final int SCALETO
public static final int SVG
| Constructor Detail |
public ShapeParameters()
parse(java.lang.String, java.text.ParsePosition),
toData(ShapeType),
toData(ShapeType,Object)public ShapeParameters(java.awt.Shape shape)
setParameters(java.awt.Shape) method.
shape - shape to extract shape parameters fromsetParameters(java.awt.Shape)
public ShapeParameters(java.lang.String shapePath,
java.lang.String shapeName)
throws InvalidDataException
shapePath - SVG shape pathshapeName - name of the shape
InvalidDataException - if shapePath string can't be parsedparsePath(java.lang.String, java.lang.String)
public ShapeParameters(java.lang.String parameters,
java.text.ParsePosition status)
throws InvalidDataException
parse(java.lang.String, java.text.ParsePosition) method documentation.
parameters - shape parameters (may be null)status - parse status (may be null)
InvalidDataException - if parameter string can't be parsedparse(java.lang.String, java.text.ParsePosition),
toData(ShapeType),
toData(ShapeType,Object)
public ShapeParameters(java.lang.String name,
java.lang.Float angle,
java.lang.Float scale,
BetterPath path)
name - shape face name (may be null)angle - shape rotation angle (may be null)scale - shape scale multiplier (may be null)path - shape coordinate path (may be null)parse(java.lang.String, java.text.ParsePosition),
toData(ShapeType),
toData(ShapeType,Object)| Method Detail |
public java.lang.String toString()
public java.lang.Float getAngle()
public java.lang.String getName()
public BetterPath getPath()
public java.lang.Float getScale()
public void parse(java.lang.String parameters,
java.text.ParsePosition status)
throws InvalidDataException
A size factor defines a shape scaling multiplier. Values above
one make the shape bigger, values below one make it smaller. The
scale is selected with a non-negative floating point value. In
case of ambiguity, a scale keyword may be used to
emphaseis that the next field is a scale value.
Orientation defines the amount of how much the shape coordinate
path is to be rotated around its' origo. The angle is selected
with a angle keyword, followed by positive floating
point value field which defines the desired counter-clockwise
rotation angle, expressed in degrees.
Any other field will be interpreted as XML escaped shape name,
which is expected to refer to one of the system stock shapes. If
the shape name matches with one of the stock strokes, the
attributes of that stroke are taken as default values for
otherwise undefined stroke parameters. If the shape name conflict
with a shape specification keywords, a name keyword
may be used to emphasis that the next field is a shape name.
Examples:
circle
circle-2
circle-2
arrow stock shape tilted 90 degrees
parameters - shape specification stringstatus - parse status
InvalidDataException - if the string cannot be parsed as a shapetoShape(),
XMLUnicodeDecoder.decode(String)
public void parsePath(java.lang.String shapePath,
java.lang.String shapeName)
throws InvalidDataException
BetterPath class. The path is defined
with an SVG path specification string.
InvalidDataExceptionpublic void setParameters(java.awt.Shape shape)
BetterPath
ShapeData
shape - shape to extract shape parameters from (may be null)BetterPath,
ShapeData,
ShapeTypepublic java.awt.Shape toData(ShapeType type)
null shape.
If a shape type has been given, the shape, if any, will
be wrapped inside a ShapeData object. Otherwise
the shape is returned as received from toShape().
type - shape type (may be null)
toShape()
public static java.awt.Shape toData(ShapeType type,
java.lang.Object value)
throws InvalidDataException
If a shape type has been given, the shape, if any, will
be wrapped inside a ShapeData object.
InvalidDataExceptiontoData(ShapeType),
ShapeDatapublic java.awt.Shape toShape()
toData(ShapeType),
BetterPath
protected java.lang.Object readResolve()
throws java.io.ObjectStreamException
java.io.ObjectStreamExceptiontoData(ShapeType),
ShapeData.writeReplace()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||