edu.neu.ccs.gui
Class TweakableShape

java.lang.Object
  |
  +--edu.neu.ccs.gui.BaseShape
        |
        +--edu.neu.ccs.gui.TweakableShape
All Implemented Interfaces:
Shape, SupportsPropertyChange

public class TweakableShape
extends BaseShape

Class TweakableShape implements a BaseShape in which the vertex array and the tangent array may be changed independently of one another.

To define a shape in which the tangent array is computed from the vertex array automatically, use the class AutomaticShape.

Since:
2.3
See Also:
Path, AutomaticShape

Field Summary
static String ADD_VERTEX_TANGENT
          Bound property name to add one vertex/tangent pair.
static String REMOVE_VERTEX_TANGENT
          Bound property name to remove one vertex/tangent pair.
static String SET_TANGENT
          Bound property name to set one tangent.
static String SET_TANGENT_DATA
          Bound property name to set the tangent data.
static String SET_VERTEX
          Bound property name to set one vertex.
static String SET_VERTEX_DATA
          Bound property name to set the vertex data.
static String SET_VERTEX_TANGENT
          Bound property name to set one vertex/tangent pair.
static String SET_VERTEX_TANGENT_DATA
          Bound property name to set the vertex/tangent 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
TweakableShape()
          The default constructor with an empty shape.
TweakableShape(float[][] vertex)
          The constructor with the given vertex data.
TweakableShape(float[][] vertex, float[][] tangent)
          The constructor with the given vertex and tangent data.
TweakableShape(float[][] vertex, float[][] tangent, Path.Strategy pathstrategy)
          The constructor with the given vertex and tangent data and the given path strategy.
TweakableShape(float[][] vertex, float[][] tangent, Path.Strategy pathstrategy, ClosureMode closuremode)
          The constructor with the given vertex and tangent data, the given path strategy, and the given closure mode.
TweakableShape(float[][] vertex, float[][] tangent, Path.Strategy pathstrategy, ClosureMode closuremode, WindingRule windingrule)
          The constructor with the given vertex and tangent data, the given path strategy, the given closure mode, and the given winding rule.
 
Method Summary
 void addVertexTangent(int index, float[] array)
          Adds a new vertex and tangent at the given index to the given set of point and displacement coordinates represented as float[4] with the four array locations filled with x, y, dx, dy.
 void addVertexTangent(int index, float x, float y, float dx, float dy)
          Adds a new vertex and tangent at the given index with the given point and displacement coordinates x, y, dx, dy.
 void removeVertexTangent(int index)
          Removes the vertex/tangent at the given index.
 void setTangent(int index, float[] delta)
          Sets the tangent at the given index to the given displacement.
 void setTangent(int index, float dx, float dy)
          Sets the tangent at the given index to the given displacement coordinates.
 void setTangentData(float[][] tangent)
          Sets the tangent data of the shape using a 2-dimensional array of single precision numbers.
 void setVertex(int index, float[] point)
          Sets the vertex at the given index to the given point.
 void setVertex(int index, float x, float y)
          Sets the vertex at the given index to the given point coordinates.
 void setVertexData(float[][] vertex)
          Sets the vertex data of the shape using a 2-dimensional array of single precision numbers.
 void setVertexTangent(int index, float[] array)
          Sets the vertex and tangent at the given index to the given set of point and displacement coordinates represented as float[4] with the four array locations filled with x, y, dx, dy.
 void setVertexTangent(int index, float x, float y, float dx, float dy)
          Sets the vertex and tangent at the given index to the given point and displacement coordinates.
 void setVertexTangentData(float[][] vertex, float[][] tangent)
          Sets the vertex and tangent data of the shape using two 2-dimensional arrays of single precision numbers.
 
Methods inherited from class edu.neu.ccs.gui.BaseShape
addForwardingListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListeners, addPropertyChangeListeners, contains, contains, contains, contains, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBezierTangentSegmentData, getBounds, getBounds2D, getClosedBezierFrameData, getClosureMode, getCubicCurvePoint, getForwardingListener, getMergedVertexTangentData, getOpenBezierFrameData, getPath, getPathIterator, getPathIterator, getPathStrategy, getPolygonPoint, getPropertyChangeListeners, getPropertyChangeListeners, getTangentData, getVertexData, getWindingRule, hasListeners, intersects, intersects, length, makeBezierTangentSegments, makeClosedBezierFrame, makeOpenBezierFrame, makePath, makePolygonDots, removeAndAddForwardingListener, removeForwardingListener, removePropertyChangeListener, removePropertyChangeListener, removeShapeData, setClosureMode, setPathStrategy, setWindingRule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SET_VERTEX_DATA

public static final String SET_VERTEX_DATA
Bound property name to set the vertex data.

See Also:
Constant Field Values

SET_TANGENT_DATA

public static final String SET_TANGENT_DATA
Bound property name to set the tangent data.

See Also:
Constant Field Values

SET_VERTEX_TANGENT_DATA

public static final String SET_VERTEX_TANGENT_DATA
Bound property name to set the vertex/tangent data.

See Also:
Constant Field Values

SET_VERTEX

public static final String SET_VERTEX
Bound property name to set one vertex.

See Also:
Constant Field Values

SET_TANGENT

public static final String SET_TANGENT
Bound property name to set one tangent.

See Also:
Constant Field Values

SET_VERTEX_TANGENT

public static final String SET_VERTEX_TANGENT
Bound property name to set one vertex/tangent pair.

See Also:
Constant Field Values

ADD_VERTEX_TANGENT

public static final String ADD_VERTEX_TANGENT
Bound property name to add one vertex/tangent pair.

See Also:
Constant Field Values

REMOVE_VERTEX_TANGENT

public static final String REMOVE_VERTEX_TANGENT
Bound property name to remove one vertex/tangent pair.

See Also:
Constant Field Values
Constructor Detail

TweakableShape

public TweakableShape()

The default constructor with an empty shape.

The default settings are as follows:

See Also:
TweakableShape(float[][]), TweakableShape(float[][], float[][]), TweakableShape(float[][], float[][], Path.Strategy), TweakableShape(float[][], float[][], Path.Strategy, ClosureMode), TweakableShape(float[][], float[][], Path.Strategy, ClosureMode, WindingRule), setVertexTangentData(float[][], float[][])

TweakableShape

public TweakableShape(float[][] vertex)

The constructor with the given vertex data.

Precondition:

Parameters:
vertex - the vertex data
See Also:
TweakableShape(), TweakableShape(float[][], float[][]), TweakableShape(float[][], float[][], Path.Strategy), TweakableShape(float[][], float[][], Path.Strategy, ClosureMode), TweakableShape(float[][], float[][], Path.Strategy, ClosureMode, WindingRule), setVertexTangentData(float[][], float[][])

TweakableShape

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

The constructor with the given vertex and tangent data.

Precondition 1:

Precondition 2:

If tangent is null then an array of zero tangents is supplied.

Parameters:
vertex - the vertex data
tangent - the tangent data
See Also:
TweakableShape(), TweakableShape(float[][]), TweakableShape(float[][], float[][], Path.Strategy), TweakableShape(float[][], float[][], Path.Strategy, ClosureMode), TweakableShape(float[][], float[][], Path.Strategy, ClosureMode, WindingRule), setVertexTangentData(float[][], float[][])

TweakableShape

public TweakableShape(float[][] vertex,
                      float[][] tangent,
                      Path.Strategy pathstrategy)

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

Precondition 1:

Precondition 2:

If tangent is null then an array of zero tangents is supplied.

Parameters:
vertex - the vertex data
tangent - the tangent data
pathstrategy - the path strategy
See Also:
TweakableShape(), TweakableShape(float[][]), TweakableShape(float[][], float[][]), TweakableShape(float[][], float[][], Path.Strategy, ClosureMode), TweakableShape(float[][], float[][], Path.Strategy, ClosureMode, WindingRule), setVertexTangentData(float[][], float[][])

TweakableShape

public TweakableShape(float[][] vertex,
                      float[][] tangent,
                      Path.Strategy pathstrategy,
                      ClosureMode closuremode)

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

Precondition 1:

Precondition 2:

If tangent is null then an array of zero tangents is supplied.

Parameters:
vertex - the vertex data
tangent - the tangent data
pathstrategy - the path strategy
closuremode - the closure mode
See Also:
TweakableShape(), TweakableShape(float[][]), TweakableShape(float[][], float[][]), TweakableShape(float[][], float[][], Path.Strategy), TweakableShape(float[][], float[][], Path.Strategy, ClosureMode, WindingRule), setVertexTangentData(float[][], float[][])

TweakableShape

public TweakableShape(float[][] vertex,
                      float[][] tangent,
                      Path.Strategy pathstrategy,
                      ClosureMode closuremode,
                      WindingRule windingrule)

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

Precondition 1:

Precondition 2:

If tangent is null then an array of zero tangents is supplied.

Parameters:
vertex - the vertex data
tangent - the tangent data
pathstrategy - the path strategy
closuremode - the closure mode
windingrule - the winding rule
See Also:
TweakableShape(), TweakableShape(float[][]), TweakableShape(float[][], float[][]), TweakableShape(float[][], float[][], Path.Strategy), TweakableShape(float[][], float[][], Path.Strategy, ClosureMode), setVertexTangentData(float[][], float[][])
Method Detail

setVertexData

public final void setVertexData(float[][] vertex)

Sets the vertex data of the shape using a 2-dimensional array of single precision numbers.

Does not change the tangent data.

Precondition:

Does nothing if the preconditions fail.

Fires property change: SET_VERTEX_DATA.

Parameters:
vertex - the vertex data
See Also:
setTangentData(float[][]), setVertexTangentData(float[][], float[][])

setTangentData

public final void setTangentData(float[][] tangent)

Sets the tangent data of the shape using a 2-dimensional array of single precision numbers.

Does not change the vertex data.

Precondition:

If tangent is null then an array of zero tangents is supplied.

Does nothing if the preconditions fail.

Fires property change: SET_TANGENT_DATA.

Parameters:
tangent - the tangent data
See Also:
setVertexData(float[][]), setVertexTangentData(float[][], float[][])

setVertexTangentData

public final void setVertexTangentData(float[][] vertex,
                                       float[][] tangent)

Sets the vertex and tangent data of the shape using two 2-dimensional arrays of single precision numbers.

Precondition 1:

Precondition 2:

If tangent is null then an array of zero tangents is supplied.

Does nothing if the preconditions fail.

Fires property change: SET_VERTEX_TANGENT_DATA.

Parameters:
vertex - the vertex data
tangent - the tangent data
See Also:
setVertexData(float[][]), setTangentData(float[][])

setVertex

public final void setVertex(int index,
                            float x,
                            float y)

Sets the vertex at the given index to the given point coordinates.

Does nothing if the index is not in [0, length()).

Does not change the tangent data.

Fires property change: SET_VERTEX.

Parameters:
index - the vertex index
x - the new x-coordinate for the vertex
y - the new y-coordinate for the vertex
See Also:
setVertex(int, float[]), setTangent(int, float, float), setTangent(int, float[]), setVertexTangent(int, float, float, float, float), setVertexTangent(int, float[])

setVertex

public final void setVertex(int index,
                            float[] point)

Sets the vertex at the given index to the given point.

Does nothing if the index is not in [0, length()).

Does nothing if point is not float[2].

Does not change the tangent data.

Fires property change: SET_VERTEX.

Parameters:
index - the vertex index
point - the new position for the vertex
See Also:
setVertex(int, float, float), setTangent(int, float, float), setTangent(int, float[]), setVertexTangent(int, float, float, float, float), setVertexTangent(int, float[])

setTangent

public final void setTangent(int index,
                             float dx,
                             float dy)

Sets the tangent at the given index to the given displacement coordinates.

Does nothing if the index is not in [0, length()).

Does not change the vertex data.

Fires property change: SET_TANGENT.

Parameters:
index - the tangent index
dx - the new x-coordinate for the displacement
dy - the new y-coordinate for the displacement
See Also:
setVertex(int, float, float), setVertex(int, float[]), setTangent(int, float[]), setVertexTangent(int, float, float, float, float), setVertexTangent(int, float[])

setTangent

public final void setTangent(int index,
                             float[] delta)

Sets the tangent at the given index to the given displacement.

Does nothing if the index is not in [0, length()).

Does nothing if delta is not float[2].

Does not change the vertex data.

Fires property change: SET_TANGENT.

Parameters:
index - the tangent index
delta - the new displacement for the tangent
See Also:
setVertex(int, float, float), setVertex(int, float[]), setTangent(int, float, float), setVertexTangent(int, float, float, float, float), setVertexTangent(int, float[])

setVertexTangent

public final void setVertexTangent(int index,
                                   float x,
                                   float y,
                                   float dx,
                                   float dy)

Sets the vertex and tangent at the given index to the given point and displacement coordinates.

Does nothing if the index is not in [0, length()).

Fires property change: SET_VERTEX_TANGENT.

Parameters:
index - the vertex/tangent index
x - the new x-coordinate for the vertex
y - the new y-coordinate for the vertex
dx - the new x-coordinate for the displacement
dy - the new y-coordinate for the displacement
See Also:
setVertex(int, float, float), setVertex(int, float[]), setTangent(int, float, float), setTangent(int, float[]), setVertexTangent(int, float[])

setVertexTangent

public final void setVertexTangent(int index,
                                   float[] array)

Sets the vertex and tangent at the given index to the given set of point and displacement coordinates represented as float[4] with the four array locations filled with x, y, dx, dy.

Does nothing if the index is not in [0, length()).

Does nothing if array is not float[4].

Fires property change: SET_VERTEX_TANGENT.

Parameters:
index - the vertex/tangent index
array - the array for the vertex/tangent with x, y, dx, dy
See Also:
setVertex(int, float, float), setVertex(int, float[]), setTangent(int, float, float), setTangent(int, float[]), setVertexTangent(int, float, float, float, float)

addVertexTangent

public final void addVertexTangent(int index,
                                   float x,
                                   float y,
                                   float dx,
                                   float dy)

Adds a new vertex and tangent at the given index with the given point and displacement coordinates x, y, dx, dy.

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.

Fires property change: ADD_VERTEX_TANGENT.

Parameters:
index - the vertex/tangent index
x - the x-coordinate for the vertex
y - the y-coordinate for the vertex
dx - the x-coordinate for the tangent
dy - the y-coordinate for the tangent
See Also:
addVertexTangent(int, float[]), removeVertexTangent(int)

addVertexTangent

public final void addVertexTangent(int index,
                                   float[] array)

Adds a new vertex and tangent at the given index to the given set of point and displacement coordinates represented as float[4] with the four array locations filled with x, y, dx, dy.

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.

Does nothing if array is not float[4].

Fires property change: ADD_VERTEX_TANGENT.

Parameters:
index - the vertex index
array - the array for the vertex/tangent with x, y, dx, dy
See Also:
addVertexTangent(int, float, float, float, float), removeVertexTangent(int)

removeVertexTangent

public final void removeVertexTangent(int index)

Removes the vertex/tangent at the given index.

Does nothing if the index is not in [0, length()).

Fires property change: REMOVE_VERTEX_TANGENT.

Parameters:
index - the vertex index
See Also:
addVertexTangent(int, float, float, float, float), addVertexTangent(int, float[])