public class FigureProps extends Object implements XMLEncodeDecode
DrawFigureFactory
. Also provides facilities for
creating a serialized version of the properties (so that the Figure can be
re-created) in XML.Draw
,
DrawFigureFactory
,
DrawActions
Modifier and Type | Field and Description |
---|---|
protected InterpolatorFactory |
interpolatorFactory
The InterpolatorFactory reference.
|
Constructor and Description |
---|
FigureProps()
Default constructor.
|
FigureProps(double x1,
double y1,
double width,
double height)
Constructor that provides enough information to describe a
rectangle.
|
FigureProps(double x1,
double y1,
double width,
double height,
double x2,
double y2,
Paint outline,
Paint fill)
Constructor that provides enough information to describe a
rectangle, with other colour.
|
FigureProps(double x1,
double y1,
double width,
double height,
Paint outline)
Constructor that provides enough information to describe a
rectangle.
|
FigureProps(double x1,
double y1,
String text,
Font font,
Paint outline)
Constructor that provides enough information to describe a
text String.
|
FigureProps(FigureProps props)
Copy constructor.
|
FigureProps(Interpolator interpolator,
double x1,
double y1,
Paint outline,
double thickness)
Constructor that provides enough information to describe an
interpolated curve.
|
Modifier and Type | Method and Description |
---|---|
void |
copy(FigureProps props)
Copy all items from another instance.
|
void |
decode(Element rootElement)
Decode (ie, restore) the internal state of this object from an
Element.
|
protected double[] |
decodeBase64DoubleArray(int size,
String base64)
Decode an array of double stored in a base64 string.
|
void |
encode(Element rootElement)
Encode the internal state of this object so that it is rooted
in the given Element.
|
protected String |
encodeBase64DoubleArray(double[] array)
Encode an array of doubles as a base64 string.
|
AlphaComposite |
getComposite()
Get the AlphaComposite.
|
Paint |
getFill()
Get the value of fill
|
Font |
getFont()
Get the Font.
|
double |
getHeight()
Get the value of height
|
Interpolator |
getInterpolator()
Get the value of interpolator.
|
Paint |
getOutline()
Get the value of outline
|
String |
getTagName()
Return a name for the Element that will be the parent of any
contents that can be encoded and decoded (ie, name of
rootElement);
|
String |
getText()
Get the Text.
|
double |
getThickness()
Get the value of thickness.
|
int |
getType()
Get the type of figure.
|
double |
getWidth()
Get the value of width
|
double |
getX1()
Get the value of x1
|
double |
getX2()
Get the value of x2.
|
double[] |
getXArray()
Get the array of X coordinates.
|
double |
getY1()
Get the value of y1
|
double |
getY2()
Get the value of y2.
|
double[] |
getYArray()
Get the array of Y coordinates.
|
protected void |
readInterpolator(Element element)
Read a stored interpolator from the given Element.
|
void |
reset()
Reset all items to their defaults.
|
void |
setComposite(AlphaComposite composite)
Set the AlphaComposite to use when drawing the figure.
|
void |
setFill(Paint fill)
Set the value of fill
|
void |
setFont(Font font)
Set the Font use together with the text String.
|
void |
setFromString(String name,
String value,
Element element)
Set the value of a member variable by matching its name to a
known local property string.
|
void |
setHeight(double height)
Set the value of height
|
void |
setInterpolator(Interpolator interpolator)
Set the value of interpolator.
|
void |
setOutline(Paint outline)
Set the value of outline
|
void |
setText(String text)
Set the text Text.
|
void |
setThickness(double thickness)
Set the value of thickness.
|
void |
setType(int type)
Set the type of figure.
|
void |
setType(String type)
Set the type of figure using a symbolic name.
|
void |
setWidth(double width)
Set the value of width
|
void |
setX1(double x1)
Set the value of x1.
|
void |
setX2(double x2)
Set the value of x2.
|
void |
setXArray(double[] xa)
Set the array of X coordinates.
|
void |
setY1(double y1)
Set the value of y1.
|
void |
setY2(double y2)
Set the value of y2.
|
void |
setYArray(double[] ya)
Set the array of Y coordinates.
|
String |
toString() |
protected void |
writeInterpolator(Element element)
Write description of the interpolator to the given Element.
|
protected InterpolatorFactory interpolatorFactory
public FigureProps()
public FigureProps(FigureProps props)
public FigureProps(double x1, double y1, double width, double height)
public FigureProps(double x1, double y1, double width, double height, Paint outline)
public FigureProps(double x1, double y1, double width, double height, double x2, double y2, Paint outline, Paint fill)
public FigureProps(Interpolator interpolator, double x1, double y1, Paint outline, double thickness)
public void reset()
public void copy(FigureProps props)
public int getType()
DrawFigureFactory
.public void setType(int type)
type
- the type of figure, one of the constants from
DrawFigureFactory
.public void setType(String type)
type
- the type of figure, one of the values from
shortName of DrawFigureFactory
.public double getX1()
public void setX1(double x1)
x1
- Value to assign to x1.public double getY1()
public void setY1(double y1)
y1
- Value to assign to y1.public double getX2()
public void setX2(double x2)
x2
- Value to assign to x2.public double getY2()
public void setY2(double y2)
y2
- Value to assign to y2.public double[] getXArray()
public void setXArray(double[] xa)
public double[] getYArray()
public void setYArray(double[] ya)
public double getWidth()
public void setWidth(double width)
width
- Value to assign to xLength.public double getHeight()
public void setHeight(double height)
height
- Value to assign to heightpublic Paint getOutline()
public void setOutline(Paint outline)
outline
- Value to assign to outlinepublic Paint getFill()
public void setFill(Paint fill)
fill
- Value to assign to fillpublic Interpolator getInterpolator()
public void setInterpolator(Interpolator interpolator)
interpolator
- Value to assign to interpolator.public double getThickness()
public void setThickness(double thickness)
thickness
- Value to assign to thickness.public String getText()
public void setText(String text)
text
- Value to assign to text.public Font getFont()
public void setFont(Font font)
font
- Value to assign to font.public AlphaComposite getComposite()
public void setComposite(AlphaComposite composite)
composite
- Value to assign to composite.public void encode(Element rootElement)
XMLEncodeDecode
encode
in interface XMLEncodeDecode
rootElement
- the Element within which the object should
store its configuration.public void decode(Element rootElement)
XMLEncodeDecode
decode
in interface XMLEncodeDecode
rootElement
- the element to which a previous object this
this type has attached its configuration.public String getTagName()
XMLEncodeDecode
getTagName
in interface XMLEncodeDecode
public void setFromString(String name, String value, Element element)
protected void readInterpolator(Element element)
protected void writeInterpolator(Element element)
protected double[] decodeBase64DoubleArray(int size, String base64)
protected String encodeBase64DoubleArray(double[] array)
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.