|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--edu.neu.ccs.gui.BaseShape
|
+--edu.neu.ccs.gui.AutomaticShape
Class AutomaticShape implements a BaseShape
in which the tangent array is always computed from the vertex array
automatically using a Tangent.Strategy object.
The default tangent strategy produces Bezier curves in which the first and second derivatives of the curve are continuous at each vertex. This strategy is described in the article:
Richard Rasala, Explicit Cubic Spline Interpolation Formulas, in Andrew S. Glassner, Graphics Gems, Academic Press, 1990, 579-584.
To define a shape in which the tangent array varies independently
of the vertex array, use the class TweakableShape.
Path,
Tangent,
TweakableShape| Field Summary | |
static String |
ADD_VERTEX
Bound property name to add one vertex. |
static String |
REMOVE_VERTEX
Bound property name to remove one vertex. |
static String |
SET_END_TANGENT
Bound property name to set one end tangent. |
static String |
SET_END_TANGENT_DATA
Bound property name to set both end tangents. |
static String |
SET_TANGENT_STRATEGY
Bound property name to set the tangent strategy. |
static String |
SET_VERTEX
Bound property name to set one vertex. |
static String |
SET_VERTEX_DATA
Bound property name to set the vertex data. |
| Fields inherited from class edu.neu.ccs.gui.BaseShape |
REMOVE_SHAPE_DATA, SET_CLOSURE_MODE, SET_PATH_STRATEGY, SET_WINDING_RULE, tangent, vertex |
| Constructor Summary | |
AutomaticShape()
The default constructor with an empty shape. |
|
AutomaticShape(float[][] vertex)
The constructor with the given vertex data. |
|
AutomaticShape(float[][] vertex,
float[][] endTangent)
The constructor with the given vertex data and the given end tangent data. |
|
AutomaticShape(float[][] vertex,
float[][] endTangent,
Tangent.Strategy tangentstrategy)
The constructor with the given vertex data, the given end tangent data, and the given tangent strategy. |
|
AutomaticShape(float[][] vertex,
float[][] endTangent,
Tangent.Strategy tangentstrategy,
Path.Strategy pathstrategy)
The constructor with the given vertex data, the given end tangent data, the given tangent strategy, and the given path strategy. |
|
AutomaticShape(float[][] vertex,
float[][] endTangent,
Tangent.Strategy tangentstrategy,
Path.Strategy pathstrategy,
ClosureMode closuremode)
The constructor with the given vertex data, the given end tangent data, the given tangent strategy, the given path strategy, and the given closure mode. |
|
AutomaticShape(float[][] vertex,
float[][] endTangent,
Tangent.Strategy tangentstrategy,
Path.Strategy pathstrategy,
ClosureMode closuremode,
WindingRule windingrule)
The constructor with the given vertex data, the given end tangent data, the given tangent strategy, the given path strategy, the given closure mode, and the given winding rule. |
|
| Method Summary | |
void |
addVertex(int index,
float[] point)
Add a new vertex at the given index with the given point. |
void |
addVertex(int index,
float x,
float y)
Add a new vertex at the given index with the given point coordinates. |
float[][] |
getEndTangentData()
Returns a copy of the endTangent data. |
Tangent.Strategy |
getTangentStrategy()
Returns the tangent strategy. |
protected void |
makeAutomaticPath()
Make the path for this AutomaticShape taking into account the vertex and end tangent arrays and the closure mode. |
void |
removeVertex(int index)
Remove the vertex at the given index. |
void |
setEndTangent(int index,
float[] delta)
Sets the end tangent at the given index (0, 1) to the given delta and makes a new path. |
void |
setEndTangent(int index,
float dx,
float dy)
Sets the end tangent at the given index (0, 1) to the given delta coordinates dx, dy and makes a new path. |
void |
setEndTangentData(float[][] endTangent)
Sets the end tangent data of the shape using a 2-by-2 array of single precision numbers and makes a new path. |
void |
setTangentStrategy(Tangent.Strategy tangentstrategy)
Sets the tangent strategy of the shape and makes a new path. |
void |
setVertex(int index,
float[] point)
Sets the vertex at the given index to the given point and makes a new path. |
void |
setVertex(int index,
float x,
float y)
Sets the vertex at the given index to the given point coordinates and makes a new path. |
void |
setVertexData(float[][] vertex)
Sets the vertex data of the shape using a 2-dimensional array of single precision numbers and makes a new path. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String SET_VERTEX_DATA
public static final String SET_VERTEX
public static final String ADD_VERTEX
public static final String REMOVE_VERTEX
public static final String SET_TANGENT_STRATEGY
public static final String SET_END_TANGENT_DATA
public static final String SET_END_TANGENT
| Constructor Detail |
public AutomaticShape()
The default constructor with an empty shape.
The default settings are as follows:
new float[0][2]new float[0][2]nullTangent.bezierStrategy()Path.POLYGONClosureMode.CLOSEDWindingRule.WIND_NON_ZERO.
AutomaticShape(float[][]),
AutomaticShape(float[][], float[][]),
AutomaticShape(float[][], float[][], Tangent.Strategy),
AutomaticShape(float[][], float[][], Tangent.Strategy, Path.Strategy),
AutomaticShape(float[][], float[][], Tangent.Strategy, Path.Strategy, ClosureMode),
AutomaticShape(float[][], float[][], Tangent.Strategy, Path.Strategy, ClosureMode, WindingRule),
setVertexData(float[][]),
setEndTangentData(float[][])public AutomaticShape(float[][] vertex)
The constructor with the given vertex data.
Precondition:
null entries.
vertex - the vertex dataAutomaticShape(),
AutomaticShape(float[][], float[][]),
AutomaticShape(float[][], float[][], Tangent.Strategy),
AutomaticShape(float[][], float[][], Tangent.Strategy, Path.Strategy),
AutomaticShape(float[][], float[][], Tangent.Strategy, Path.Strategy, ClosureMode),
AutomaticShape(float[][], float[][], Tangent.Strategy, Path.Strategy, ClosureMode, WindingRule),
setVertexData(float[][]),
setEndTangentData(float[][])
public AutomaticShape(float[][] vertex,
float[][] endTangent)
The constructor with the given vertex data and the given end tangent data.
Precondition 1:
null entries.Precondition 2:
null or
float[2][2] with non-null entries.
vertex - the vertex dataendTangent - the end tangent dataAutomaticShape(),
AutomaticShape(float[][]),
AutomaticShape(float[][], float[][], Tangent.Strategy),
AutomaticShape(float[][], float[][], Tangent.Strategy, Path.Strategy),
AutomaticShape(float[][], float[][], Tangent.Strategy, Path.Strategy, ClosureMode),
AutomaticShape(float[][], float[][], Tangent.Strategy, Path.Strategy, ClosureMode, WindingRule),
setVertexData(float[][]),
setEndTangentData(float[][])
public AutomaticShape(float[][] vertex,
float[][] endTangent,
Tangent.Strategy tangentstrategy)
The constructor with the given vertex data, the given end tangent data, and the given tangent strategy.
Precondition 1:
null entries.Precondition 2:
null or
float[2][2] with non-null entries.
vertex - the vertex dataendTangent - the end tangent datatangentstrategy - the tangent strategyAutomaticShape(),
AutomaticShape(float[][]),
AutomaticShape(float[][], float[][]),
AutomaticShape(float[][], float[][], Tangent.Strategy, Path.Strategy),
AutomaticShape(float[][], float[][], Tangent.Strategy, Path.Strategy, ClosureMode),
AutomaticShape(float[][], float[][], Tangent.Strategy, Path.Strategy, ClosureMode, WindingRule),
setVertexData(float[][]),
setEndTangentData(float[][])
public AutomaticShape(float[][] vertex,
float[][] endTangent,
Tangent.Strategy tangentstrategy,
Path.Strategy pathstrategy)
The constructor with the given vertex data, the given end tangent data, the given tangent strategy, and the given path strategy.
Precondition 1:
null entries.Precondition 2:
null or
float[2][2] with non-null entries.
vertex - the vertex dataendTangent - the end tangent datatangentstrategy - the tangent strategypathstrategy - the path strategyAutomaticShape(),
AutomaticShape(float[][]),
AutomaticShape(float[][], float[][]),
AutomaticShape(float[][], float[][], Tangent.Strategy),
AutomaticShape(float[][], float[][], Tangent.Strategy, Path.Strategy, ClosureMode),
AutomaticShape(float[][], float[][], Tangent.Strategy, Path.Strategy, ClosureMode, WindingRule),
setVertexData(float[][]),
setEndTangentData(float[][])
public AutomaticShape(float[][] vertex,
float[][] endTangent,
Tangent.Strategy tangentstrategy,
Path.Strategy pathstrategy,
ClosureMode closuremode)
The constructor with the given vertex data, the given end tangent data, the given tangent strategy, the given path strategy, and the given closure mode.
Precondition 1:
null entries.Precondition 2:
null or
float[2][2] with non-null entries.
vertex - the vertex dataendTangent - the end tangent datatangentstrategy - the tangent strategypathstrategy - the path strategyclosuremode - the closure modeAutomaticShape(),
AutomaticShape(),
AutomaticShape(float[][]),
AutomaticShape(float[][], float[][]),
AutomaticShape(float[][], float[][], Tangent.Strategy),
AutomaticShape(float[][], float[][], Tangent.Strategy, Path.Strategy),
AutomaticShape(float[][], float[][], Tangent.Strategy, Path.Strategy, ClosureMode, WindingRule),
setVertexData(float[][]),
setEndTangentData(float[][])
public AutomaticShape(float[][] vertex,
float[][] endTangent,
Tangent.Strategy tangentstrategy,
Path.Strategy pathstrategy,
ClosureMode closuremode,
WindingRule windingrule)
The constructor with the given vertex data, the given end tangent data, the given tangent strategy, the given path strategy, the given closure mode, and the given winding rule.
Precondition 1:
null entries.Precondition 2:
null or
float[2][2] with non-null entries.
vertex - the vertex dataendTangent - the end tangent datatangentstrategy - the tangent strategypathstrategy - the path strategyclosuremode - the closure modewindingrule - the winding ruleAutomaticShape(),
AutomaticShape(float[][]),
AutomaticShape(float[][], float[][]),
AutomaticShape(float[][], float[][], Tangent.Strategy),
AutomaticShape(float[][], float[][], Tangent.Strategy, Path.Strategy),
AutomaticShape(float[][], float[][], Tangent.Strategy, Path.Strategy, ClosureMode),
setVertexData(float[][]),
setEndTangentData(float[][])| Method Detail |
public final void setVertexData(float[][] vertex)
Sets the vertex data of the shape using a 2-dimensional array of single precision numbers and makes a new path.
Sets the tangents to be used when the shape is displayed as a curve.
Precondition:
null entries.Does nothing if the precondition fails.
Fires property change: SET_VERTEX_DATA.
vertex - the vertex data to setsetVertex(int, float, float),
setVertex(int, float[])
public final void setVertex(int index,
float x,
float y)
Sets the vertex at the given index to the given point coordinates and makes a new path.
Does nothing if the index is not in [0, length()).
Sets the tangents to be used when the shape is displayed as a curve.
Fires property change: SET_VERTEX.
index - the vertex indexx - the new x-coordinate for the vertexy - the new y-coordinate for the vertexsetVertexData(float[][]),
setVertex(int, float[])
public final void setVertex(int index,
float[] point)
Sets the vertex at the given index to the given point and makes a new path.
Does nothing if the index is not in [0, length()).
Does nothing if point is not float[2].
Sets the tangents to be used when the shape is displayed as a curve.
Fires property change: SET_VERTEX.
index - the vertex indexpoint - the new point for the vertex at the given indexsetVertexData(float[][]),
setVertex(int, float, float)
public final void addVertex(int index,
float x,
float y)
Add a new vertex at the given index with the given point coordinates.
Does nothing if the index is not in [0, length()].
If index is 0, the insertion is at the front.
If index is length(), the insertion is at the end.
Sets the tangents to be used when the shape is displayed as a curve.
Fires property change: ADD_VERTEX.
index - the vertex indexx - the x-coordinate for the new vertex to addy - the y-coordinate for the new vertex to addaddVertex(int, float[]),
removeVertex(int)
public final void addVertex(int index,
float[] point)
Add a new vertex at the given index with the given point.
Does nothing if the index is not in [0, length()] or point is not float[2].
If index is 0, the insertion is at the front.
If index is length(), the insertion is at the end.
Sets the tangents to be used when the shape is displayed as a curve.
Fires property change: ADD_VERTEX.
index - the vertex indexpoint - the new vertex to addaddVertex(int, float, float),
removeVertex(int)public final void removeVertex(int index)
Remove the vertex at the given index.
Does nothing if the index is not in [0, length()).
Sets the tangents to be used when the shape is displayed as a curve.
Fires property change: REMOVE_VERTEX.
index - the vertex indexaddVertex(int, float[]),
addVertex(int, float, float)public final void setEndTangentData(float[][] endTangent)
Sets the end tangent data of the shape using a 2-by-2 array of single precision numbers and makes a new path.
Sets the tangents to be used when the shape is displayed as a curve.
Precondition:
null or
float[2][2] with non-null entries.Does nothing if the precondition fails.
Fires property change: SET_END_TANGENT_DATA.
endTangent - the endTangent data to setgetEndTangentData(),
setEndTangent(int, float, float),
setEndTangent(int, float[])public final float[][] getEndTangentData()
Returns a copy of the endTangent data.
The returned value will either be null
or have the form float[2][2].
setEndTangentData(float[][]),
setEndTangent(int, float, float),
setEndTangent(int, float[])
public final void setEndTangent(int index,
float dx,
float dy)
Sets the end tangent at the given index (0, 1) to the given delta coordinates dx, dy and makes a new path.
Does nothing if the index is not in [0, 1].
If the current end tangent array is null, then
this array will be set to new float[2][2] before setting the
delta value.
Sets the tangents to be used when the shape is displayed as a curve.
Fires property change: SET_END_TANGENT.
index - the end tangent indexdx - the new x-coordinate for the end tangentdy - the new y-coordinate for the end tangentsetEndTangentData(float[][]),
getEndTangentData(),
setEndTangent(int, float[])
public final void setEndTangent(int index,
float[] delta)
Sets the end tangent at the given index (0, 1) to the given delta and makes a new path.
Does nothing if the index is not in [0, 1].
Does nothing if delta is not float[2].
If the current end tangent array is null, then
this array will be set to new float[2][2] before setting the
delta value.
Sets the tangents to be used when the shape is displayed as a curve.
Fires property change: SET_END_TANGENT.
index - the vertex indexdelta - the new delta for the vertex at the given indexsetEndTangentData(float[][]),
getEndTangentData(),
setEndTangent(int, float, float)public final void setTangentStrategy(Tangent.Strategy tangentstrategy)
Sets the tangent strategy of the shape and makes a new path.
Does nothing if its parameter is null.
Also sets the tangents to be used when the shape is displayed as a curve.
Fires property change: SET_TANGENT_STRATEGY.
getTangentStrategy()public final Tangent.Strategy getTangentStrategy()
setTangentStrategy(Tangent.Strategy)protected final void makeAutomaticPath()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||