edu.neu.ccs.gui
Class TweakableCurve

java.lang.Object
  extended byedu.neu.ccs.gui.BaseShape
      extended byedu.neu.ccs.gui.TweakableShape
          extended byedu.neu.ccs.gui.TweakableCurve
All Implemented Interfaces:
Shape, SupportsPropertyChange

public class TweakableCurve
extends TweakableShape

Class TweakableCurve extends TweakableShape 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 four possible constructor parameters in order are:

Preconditions:

If the given vertex array is null then the given tangent array is ignored and the internal vertex and tangent arrays are set to float[0][2].

Otherwise if the given tangent array is null then the vertex array will be cloned and an array of zero tangents will be constructed.

Otherwise both the vertex and tangent array should be float[N][2] for the same N. These arrays will be cloned to set the internal vertex and tangent data.

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 three parameters are distinct, Java will be able to determine the particular constructor being called.

The tangent array is used to compute the Bezier control points for the cubic arches.

The closure mode determines whether the path will be closed or open and is either ClosureMode.CLOSED or ClosureMode.OPEN. The default is ClosureMode.CLOSED.

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.

Since:
2.4.0
Version:
2.4.0

Field Summary
 
Fields inherited from class edu.neu.ccs.gui.TweakableShape
ADD_VERTEX_TANGENT, REMOVE_VERTEX_TANGENT, SET_TANGENT, SET_VERTEX, SET_VERTEX_TANGENT
 
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
TweakableCurve()
          The default constructor.
TweakableCurve(float[][] vertex)
          The constructor with the given vertex data.
TweakableCurve(float[][] vertex, ClosureMode closuremode)
          The constructor with the given vertex data and the given closure mode.
TweakableCurve(float[][] vertex, ClosureMode closuremode, WindingRule windingrule)
          The constructor with the given vertex data, the given closure mode, and the given winding rule.
TweakableCurve(float[][] vertex, float[][] tangent)
          The constructor with the given vertex data and the given tangent data.
TweakableCurve(float[][] vertex, float[][] tangent, ClosureMode closuremode)
          The constructor with the given vertex data, the given tangent data, and the given closure mode.
TweakableCurve(float[][] vertex, float[][] tangent, ClosureMode closuremode, WindingRule windingrule)
          The constructor with the given vertex data, the given tangent data, the given closure mode, and the given winding rule.
TweakableCurve(float[][] vertex, float[][] tangent, WindingRule windingrule)
          The constructor with the given vertex data, the given tangent data, and the given winding rule.
TweakableCurve(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.TweakableShape
addVertexTangent, addVertexTangent, addVertexTangent, addVerticesTangents, addVerticesTangents, appendVertexTangent, appendVertexTangent, appendVertexTangent, appendVerticesTangents, appendVerticesTangents, removeAllVerticesTangents, removeVertexTangent, removeVerticesTangents, setTangent, setTangent, setTangentData, setTangentViaControlA, setTangentViaControlA, setTangentViaControlB, setTangentViaControlB, setVertex, setVertex, setVertexData, setVertexTangent, setVertexTangent, setVertexTangent, setVertexTangentData, setVertexTangentData
 
Methods inherited from class edu.neu.ccs.gui.BaseShape
addForwardingListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListeners, addPropertyChangeListeners, bezierTangentSegmentPoints, closedBezierControlPoints, closedBezierFramePoints, contains, contains, contains, contains, findControlA, findControlA, findControlB, findControlB, findVertex, findVertex, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAX, getAY, getBezierTangentSegmentData, getBounds, getBounds2D, getBX, getBY, getClosedBezierControlData, getClosedBezierFrameData, getClosureMode, getControlA, getControlB, getCubicCurvePoint, getForwardingListener, getOpenBezierControlData, getOpenBezierFrameData, getPath, getPathIterator, getPathIterator, getPathStrategy, getPolygonPoint, getPropertyChangeListeners, getPropertyChangeListeners, getTangent, getTangentData, getTransformedShape, getTransformedShape, getTX, getTY, getVertex, getVertexData, getVertexTangent, getVertexTangentData, getVX, getVY, getWindingRule, hasListeners, intersects, intersects, isTangentNull, length, makeBezierTangentSegments, makeClosedBezierFrame, makeClosedControlDots, makeClosedPolygon, makeOpenBezierFrame, makeOpenControlDots, makeOpenPolygon, makePath, makePolygonDots, openBezierControlPoints, openBezierFramePoints, removeAndAddForwardingListener, removeForwardingListener, removePropertyChangeListener, removePropertyChangeListener, removeShapeData, setClosureMode, setWindingRule, setWindingRule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TweakableCurve

public TweakableCurve()

The default constructor.


TweakableCurve

public TweakableCurve(float[][] vertex)

The constructor with the given vertex data.

Parameters:
vertex - the vertex data

TweakableCurve

public TweakableCurve(float[][] vertex,
                      WindingRule windingrule)

The constructor with the given vertex data and the given winding rule.

Parameters:
vertex - the vertex data
windingrule - the winding rule

TweakableCurve

public TweakableCurve(float[][] vertex,
                      ClosureMode closuremode)

The constructor with the given vertex data and the given closure mode.

Parameters:
vertex - the vertex data
closuremode - the closure mode

TweakableCurve

public TweakableCurve(float[][] vertex,
                      ClosureMode closuremode,
                      WindingRule windingrule)

The constructor with the given vertex data, the given closure mode, and the given winding rule.

Parameters:
vertex - the vertex data
closuremode - the closure mode
windingrule - the winding rule

TweakableCurve

public TweakableCurve(float[][] vertex,
                      float[][] tangent)

The constructor with the given vertex data and the given tangent data.

Parameters:
vertex - the vertex data
tangent - the tangent data

TweakableCurve

public TweakableCurve(float[][] vertex,
                      float[][] tangent,
                      WindingRule windingrule)

The constructor with the given vertex data, the given tangent data, and the given winding rule.

Parameters:
vertex - the vertex data
tangent - the tangent data
windingrule - the winding rule

TweakableCurve

public TweakableCurve(float[][] vertex,
                      float[][] tangent,
                      ClosureMode closuremode)

The constructor with the given vertex data, the given tangent data, and the given closure mode.

Parameters:
vertex - the vertex data
tangent - the tangent data
closuremode - the closure mode

TweakableCurve

public TweakableCurve(float[][] vertex,
                      float[][] tangent,
                      ClosureMode closuremode,
                      WindingRule windingrule)

The constructor with the given vertex data, the given tangent data, the given closure mode, and the given winding rule.

Parameters:
vertex - the vertex data
tangent - the tangent data
closuremode - the closure mode
windingrule - the winding rule
Method Detail

setPathStrategy

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.

Overrides:
setPathStrategy in class BaseShape
Parameters:
pathstrategy - the path strategy to set