|
||||||||||
| 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
Class BaseVertexShape extends BaseShape to
provide the common functionality for those classes that either do not use
the tangent data of BaseShape or compute the tangent data
automatically from the vertex data and other internal settings.
Class BaseVertexShape contains the common code for the
derived classes:
PolygonShapePolygonDotsShapeAutomaticShapeAutomaticCurveClass BaseVertexShape may not be instantiated directly
since it does not have a public constructor.
If a derived class computes tangents automatically then this must be
done by overriding the method makePath() that is inherited
from BaseShape. See the documentation in that class for
instructions on how to do the override.
| Field Summary | |
static String |
ADD_VERTEX
Bound property name to add one or more vertices. |
static String |
REMOVE_VERTEX
Bound property name to remove one or more vertices. |
static String |
SET_VERTEX
Bound property name to set one or more vertices. |
| 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 | |
protected |
BaseVertexShape()
The protected default constructor. |
| Method Summary | |
void |
addVertex(int index,
float[] point)
Adds a new vertex at the given index with a clone of the given point and makes a new path. |
void |
addVertex(int index,
float x,
float y)
Adds a new vertex at the given index with the given point coordinates and makes a new path. |
void |
addVertices(int index,
float[][] points)
Adds a new sequence of vertices at the given index using clones of the given points and makes a new path. |
void |
appendVertex(float[] point)
Appends a new vertex with a clone of the given point and makes a new path. |
void |
appendVertex(float x,
float y)
Appends a new vertex with the given point coordinates and makes a new path. |
void |
appendVertices(int index,
float[][] points)
Appends a new sequence of vertices using clones of the given points and makes a new path. |
float[][] |
removeAllVertices()
Removes all vertices, makes a new path, and returns an array with the vertices removed. |
float[] |
removeVertex(int index)
Removes the vertex at the given index, makes a new path, and returns the vertex removed. |
float[][] |
removeVertices(int m,
int n)
Removes the vertices starting at the given index m inclusive and ending at the given index n exclusive, makes a new path, and returns an array with the vertices removed. |
void |
setVertex(int index,
float[] point)
Sets the vertex at the given index to a clone of 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
public static final String ADD_VERTEX
public static final String REMOVE_VERTEX
| Constructor Detail |
protected BaseVertexShape()
| 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.
Preconditions:
null or
float[N][2] for some N.If the given vertex array is null then the
internal vertex array is set to float[0][2].
Does nothing if the precondition fails.
Fires property change: SET_VERTEX.
vertex - the vertex data to set
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()).
Fires property change: SET_VERTEX.
index - the vertex indexx - the new x-coordinate for the vertexy - the new y-coordinate for the vertex
public final void setVertex(int index,
float[] point)
Sets the vertex at the given index to a clone of 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].
Fires property change: SET_VERTEX.
index - the vertex indexpoint - the new point for the vertex at the given index
public final void addVertex(int index,
float x,
float y)
Adds a new vertex at the given index with the given point coordinates and makes a new path.
If index is 0, the insertion is at the front.
If index is length(), the insertion is at the end.
Forces the given index into the range:
0 <= index <= length()
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 add
public final void addVertex(int index,
float[] point)
Adds a new vertex at the given index with a clone of the given point and makes a new path.
If index is 0, the insertion is at the front.
If index is length(), the insertion is at the end.
Forces the given index into the range:
0 <= index <= length()
Fires property change: ADD_VERTEX.
index - the vertex indexpoint - the new vertex to add
public final void addVertices(int index,
float[][] points)
Adds a new sequence of vertices at the given index using clones of the given points and makes a new path.
If index is 0, the insertion is at the front.
If index is length(), the insertion is at the end.
Forces the given index into the range:
0 <= index <= length()
Does nothing if the given array is null
or does not have the form float[K][2].
Fires property change: ADD_VERTEX.
index - the start indexpoints - the new vertices to add
public final void appendVertex(float x,
float y)
Appends a new vertex with the given point coordinates and makes a new path.
Fires property change: ADD_VERTEX.
x - the x-coordinate for the new vertex to appendy - the y-coordinate for the new vertex to appendpublic final void appendVertex(float[] point)
Appends a new vertex with a clone of the given point and makes a new path.
Fires property change: ADD_VERTEX.
point - the new vertex to append
public final void appendVertices(int index,
float[][] points)
Appends a new sequence of vertices using clones of the given points and makes a new path.
Does nothing if the given array is null
or does not have the form float[K][2].
Fires property change: ADD_VERTEX.
points - the new vertices to appendpublic final float[] removeVertex(int index)
Removes the vertex at the given index, makes a new path, and returns the vertex removed.
If the index is not in [0, length()), no vertex is
removed and null is returned.
Fires property change: REMOVE_VERTEX.
index - the vertex index
public final float[][] removeVertices(int m,
int n)
Removes the vertices starting at the given index m inclusive and ending at the given index n exclusive, makes a new path, and returns an array with the vertices removed.
Forces m and n into range if needed.
Returns an array of length 0 if no nodes are removed.
Fires property change: REMOVE_VERTEX.
m - the starting index inclusiven - the ending index exclusivepublic final float[][] removeAllVertices()
Removes all vertices, makes a new path, and returns an array with the vertices removed.
Fires property change: REMOVE_VERTEX.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||