|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.gui.BaseShape
edu.neu.ccs.gui.BaseVertexShape
edu.neu.ccs.gui.AutomaticShape
edu.neu.ccs.gui.AutomaticCurve
Class AutomaticCurve extends AutomaticShape and
fixes the Path.Strategy to be Path.BEZIER_CUBIC.
The class provides a wealth of constructors so that the user can supply precisely the data that is needed and avoid having to specify default data. Let us explain in detail how this will work.
The five possible constructor parameters in order are:
float[][] vertex
float[][] endTangent
Tangent.Strategy tangentstrategy
ClosureMode closuremode
WindingRule windingrule
The following preconditions must hold for the vertex and end tangent arrays when supplied:
Preconditions:
null or
float[N][2] for some N.null
or float[2][2].If the given vertex array is null then the
internal vertex array is set to float[0][2].
If the given end tangent array is null then
an open curve is rendered with the same end tangents as are
computed automatically for the corresponding closed curve.
The default constructor has no parameters. In all other constructors, the
vertex must be supplied to define the vertex points that the
curve must pass through in sequential order.
The caller may supply any subset of the remaining parameters but whatever parameters are supplied must be in the order listed above. Since the types of the last four parameters are distinct, Java will be able to determine the particular constructor being called.
Let us now discuss the last four parameters but for explanatory reasons not in the order in which they must be supplied.
The closure mode determines whether the path will be closed or open and is
either ClosureMode.CLOSED or ClosureMode.OPEN.
The tangent strategy excapsulates a pair of algorithms that compute the
tangents which are used in turn to compute the Bezier control points for the
cubic arches. One algorithm of the pair should compute the tangents for a
CLOSED curve using just the vertex information and the other algorithm should
compute the tangents for an OPEN curve using both the vertex and end tangent
information. The Tangent.Strategy interface discusses the
contract for both algorithms in detail. In particular, one requirement is
that if the end tangent array is null then the tangents for an
OPEN curve should be computed by the algorithm for a CLOSED curve. This has
effect that the shape of a curve does not change if it is changed from OPEN
to CLOSED or vice versa. On the other hand, if this is not a concern, then
providing an end tangent array allows the user more control of the shape of
an OPEN curve.
The class Tangent defines two families of tangent strategies
that are parametrized to permit variation. The default strategy used in this
class is: Tangent.bezierStrategy(). Since a tangent strategy is
defined by an an interface, the user may also define and implement additional
strategies.
The following conventions apply to the relationship between the end tangent array, the closure mode, and the default settings:
null.
This will mean that the curve tangents are the same for an OPEN and
CLOSED curve.The winding rule determines which of two mathematical algorithms built
into Java are used to fill regions: WindingRule.WIND_NON_ZERO
or WindingRule.WIND_EVEN_ODD. There are valid arguments to
choose either algorithm as the default but we have chosen WIND_NON_ZERO as
the default.
Since the constructor parameters have been extensively discussed in this introduction, the comments in the actual constructors will be very brief.
| Field Summary |
| Fields inherited from class edu.neu.ccs.gui.AutomaticShape |
SET_END_TANGENT, SET_TANGENT_STRATEGY |
| Fields inherited from class edu.neu.ccs.gui.BaseVertexShape |
ADD_VERTEX, REMOVE_VERTEX, SET_VERTEX |
| 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 | |
AutomaticCurve()
The default constructor. |
|
AutomaticCurve(float[][] vertex)
The constructor with the given vertex data. |
|
AutomaticCurve(float[][] vertex,
ClosureMode closuremode)
The constructor with the given vertex data and the given closure mode. |
|
AutomaticCurve(float[][] vertex,
ClosureMode closuremode,
WindingRule windingrule)
The constructor with the given vertex data, the given closure mode, and the given winding rule. |
|
AutomaticCurve(float[][] vertex,
float[][] endTangent)
The constructor with the given vertex data and the given end tangent data. |
|
AutomaticCurve(float[][] vertex,
float[][] endTangent,
ClosureMode closuremode)
The constructor with the given vertex data, the given end tangent data, and the given closure mode. |
|
AutomaticCurve(float[][] vertex,
float[][] endTangent,
ClosureMode closuremode,
WindingRule windingrule)
The constructor with the given vertex data, the given end tangent data, the given closure mode, and the given winding rule. |
|
AutomaticCurve(float[][] vertex,
float[][] endTangent,
Tangent.Strategy tangentstrategy)
The constructor with the given vertex data, the given end tangent data, and the given tangent strategy. |
|
AutomaticCurve(float[][] vertex,
float[][] endTangent,
Tangent.Strategy tangentstrategy,
ClosureMode closuremode)
The constructor with the given vertex data, the given end tangent data, the given tangent strategy, and the given closure mode. |
|
AutomaticCurve(float[][] vertex,
float[][] endTangent,
Tangent.Strategy tangentstrategy,
ClosureMode closuremode,
WindingRule windingrule)
The constructor with the given vertex data, the given end tangent data, the given tangent strategy, the given closure mode, the given winding rule. |
|
AutomaticCurve(float[][] vertex,
float[][] endTangent,
Tangent.Strategy tangentstrategy,
WindingRule windingrule)
The constructor with the given vertex data, the given end tangent data, the given tangent strategy, and the given winding rule. |
|
AutomaticCurve(float[][] vertex,
float[][] endTangent,
WindingRule windingrule)
The constructor with the given vertex data, the given end tangent data, and the given winding rule. |
|
AutomaticCurve(float[][] vertex,
Tangent.Strategy tangentstrategy)
The constructor with the given vertex data and the given tangent strategy. |
|
AutomaticCurve(float[][] vertex,
Tangent.Strategy tangentstrategy,
ClosureMode closuremode)
The constructor with the given vertex data, the given tangent strategy, and the given closure mode. |
|
AutomaticCurve(float[][] vertex,
Tangent.Strategy tangentstrategy,
ClosureMode closuremode,
WindingRule windingrule)
The constructor with the given vertex data, the given tangent strategy, the given closure mode, and the given winding rule. |
|
AutomaticCurve(float[][] vertex,
Tangent.Strategy tangentstrategy,
WindingRule windingrule)
The constructor with the given vertex data, the given tangent strategy, and the given winding rule. |
|
AutomaticCurve(float[][] vertex,
WindingRule windingrule)
The constructor with the given vertex data and the given winding rule. |
|
| Method Summary | |
void |
setPathStrategy(Path.Strategy pathstrategy)
Since the Path.Strategy of this class is fixed to be
Path.BEZIER_CUBIC, this method overrides the inherited
method to do nothing. |
| Methods inherited from class edu.neu.ccs.gui.AutomaticShape |
findEndTangentControl, findEndTangentControl, getEndTangent, getEndTangentControl, getEndTangentControlData, getEndTangentData, getEndTX, getEndTY, getTangentStrategy, isEndTangentNull, makeEndTangentControlDots, makePath, setEndTangent, setEndTangent, setEndTangentData, setEndTangentViaControl, setEndTangentViaControl, setTangentStrategy |
| Methods inherited from class edu.neu.ccs.gui.BaseVertexShape |
addVertex, addVertex, addVertices, appendVertex, appendVertex, appendVertices, removeAllVertices, removeVertex, removeVertices, setVertex, setVertex, setVertexData |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public AutomaticCurve()
The default constructor.
public AutomaticCurve(float[][] vertex)
The constructor with the given vertex data.
vertex - the vertex data
public AutomaticCurve(float[][] vertex,
WindingRule windingrule)
The constructor with the given vertex data and the given winding rule.
vertex - the vertex datawindingrule - the winding rule
public AutomaticCurve(float[][] vertex,
ClosureMode closuremode)
The constructor with the given vertex data and the given closure mode.
vertex - the vertex dataclosuremode - the closure mode
public AutomaticCurve(float[][] vertex,
ClosureMode closuremode,
WindingRule windingrule)
The constructor with the given vertex data, the given closure mode, and the given winding rule.
vertex - the vertex dataclosuremode - the closure modewindingrule - the winding rule
public AutomaticCurve(float[][] vertex,
Tangent.Strategy tangentstrategy)
The constructor with the given vertex data and the given tangent strategy.
vertex - the vertex datatangentstrategy - the tangent strategy
public AutomaticCurve(float[][] vertex,
Tangent.Strategy tangentstrategy,
WindingRule windingrule)
The constructor with the given vertex data, the given tangent strategy, and the given winding rule.
vertex - the vertex datatangentstrategy - the tangent strategywindingrule - the winding rule
public AutomaticCurve(float[][] vertex,
Tangent.Strategy tangentstrategy,
ClosureMode closuremode)
The constructor with the given vertex data, the given tangent strategy, and the given closure mode.
vertex - the vertex datatangentstrategy - the tangent strategyclosuremode - the closure mode
public AutomaticCurve(float[][] vertex,
Tangent.Strategy tangentstrategy,
ClosureMode closuremode,
WindingRule windingrule)
The constructor with the given vertex data, the given tangent strategy, the given closure mode, and the given winding rule.
vertex - the vertex datatangentstrategy - the tangent strategyclosuremode - the closure modewindingrule - the winding rule
public AutomaticCurve(float[][] vertex,
float[][] endTangent)
The constructor with the given vertex data and the given end tangent data.
vertex - the vertex dataendTangent - the end tangent data
public AutomaticCurve(float[][] vertex,
float[][] endTangent,
WindingRule windingrule)
The constructor with the given vertex data, the given end tangent data, and the given winding rule.
vertex - the vertex dataendTangent - the end tangent datawindingrule - the winding rule
public AutomaticCurve(float[][] vertex,
float[][] endTangent,
ClosureMode closuremode)
The constructor with the given vertex data, the given end tangent data, and the given closure mode.
vertex - the vertex dataendTangent - the end tangent dataclosuremode - the closure mode
public AutomaticCurve(float[][] vertex,
float[][] endTangent,
ClosureMode closuremode,
WindingRule windingrule)
The constructor with the given vertex data, the given end tangent data, the given closure mode, and the given winding rule.
vertex - the vertex dataendTangent - the end tangent dataclosuremode - the closure modewindingrule - the winding rule
public AutomaticCurve(float[][] vertex,
float[][] endTangent,
Tangent.Strategy tangentstrategy)
The constructor with the given vertex data, the given end tangent data, and the given tangent strategy.
vertex - the vertex dataendTangent - the end tangent datatangentstrategy - the tangent strategy
public AutomaticCurve(float[][] vertex,
float[][] endTangent,
Tangent.Strategy tangentstrategy,
WindingRule windingrule)
The constructor with the given vertex data, the given end tangent data, the given tangent strategy, and the given winding rule.
vertex - the vertex dataendTangent - the end tangent datatangentstrategy - the tangent strategywindingrule - the winding rule
public AutomaticCurve(float[][] vertex,
float[][] endTangent,
Tangent.Strategy tangentstrategy,
ClosureMode closuremode)
The constructor with the given vertex data, the given end tangent data, the given tangent strategy, and the given closure mode.
vertex - the vertex dataendTangent - the end tangent datatangentstrategy - the tangent strategyclosuremode - the closure mode
public AutomaticCurve(float[][] vertex,
float[][] endTangent,
Tangent.Strategy tangentstrategy,
ClosureMode closuremode,
WindingRule windingrule)
The constructor with the given vertex data, the given end tangent data, the given tangent strategy, the given closure mode, the given winding rule.
vertex - the vertex dataendTangent - the end tangent datatangentstrategy - the tangent strategyclosuremode - the closure modewindingrule - the winding rule| Method Detail |
public final void setPathStrategy(Path.Strategy pathstrategy)
Since the Path.Strategy of this class is fixed to be
Path.BEZIER_CUBIC, this method overrides the inherited
method to do nothing.
setPathStrategy in class BaseShapepathstrategy - the path strategy to set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||