public class GPointsArray extends Object
| Constructor and Description |
|---|
GPointsArray()
Constructor
|
GPointsArray(ArrayList<PVector> vectors)
Constructor
|
GPointsArray(float[] x,
float[] y)
Constructor
|
GPointsArray(float[] x,
float[] y,
String[] labels)
Constructor
|
GPointsArray(GPoint[] points)
Constructor
|
GPointsArray(GPointsArray points)
Constructor
|
GPointsArray(int initialSize)
Constructor
|
GPointsArray(PVector[] vectors)
Constructor
|
GPointsArray(PVector[] vectors,
String[] labels)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(ArrayList<PVector> vectors)
Adds a new set of points to the array
|
void |
add(float[] x,
float[] y)
Adds a new set of points to the array
|
void |
add(float[] x,
float[] y,
String[] labels)
Adds a new set of points to the array
|
void |
add(float x,
float y)
Adds a new point to the array
|
void |
add(float x,
float y,
String label)
Adds a new point to the array
|
void |
add(GPoint point)
Adds a new point to the array
|
void |
add(GPoint[] pts)
Adds a new set of points to the array
|
void |
add(GPointsArray pts)
Adds a new set of points to the array
|
void |
add(int index,
float x,
float y)
Adds a new point to the array
|
void |
add(int index,
float x,
float y,
String label)
Adds a new point to the array
|
void |
add(int index,
GPoint point)
Adds a new point to the array
|
void |
add(int index,
PVector v)
Adds a new point to the array
|
void |
add(int index,
PVector v,
String label)
Adds a new point to the array
|
void |
add(PVector v)
Adds a new point to the array
|
void |
add(PVector[] vectors)
Adds a new set of points to the array
|
void |
add(PVector[] vectors,
String[] labels)
Adds a new set of points to the array
|
void |
add(PVector v,
String label)
Adds a new point to the array
|
GPoint |
get(int index)
Returns a given point in the array
|
String |
getLabel(int index)
Returns the text label of a point in the array
|
GPoint |
getLastPoint()
Returns the latest point added to the array
|
int |
getNPoints()
Returns the total number of points in the array
|
boolean |
getValid(int index)
Returns if a point in the array is valid or not
|
float |
getX(int index)
Returns the x coordinate of a point in the array
|
float |
getY(int index)
Returns the y coordinate of a point in the array
|
boolean |
isValid(int index)
Returns if a point in the array is valid or not
|
void |
remove(int index)
Removes one of the points in the array
|
void |
removeInvalidPoints()
Removes invalid points from the array
|
void |
removeRange(int fromIndex,
int toIndex)
Removes a range of points in the array
|
void |
set(GPointsArray pts)
Sets all the points in the array
|
void |
set(int index,
float x,
float y,
String label)
Sets the x and y coordinates of a specific point in the array
|
void |
set(int index,
GPoint point)
Sets the x and y coordinates and the label of a point with those from
another point
|
void |
set(int index,
PVector v,
String label)
Sets the x and y coordinates of a specific point in the array
|
void |
setLabel(int index,
String label)
Sets the text label of a specific point in the array
|
void |
setNPoints(int nPoints)
Sets the total number of points in the array
|
void |
setX(int index,
float x)
Sets the x coordinate of a specific point in the array
|
void |
setXY(int index,
float x,
float y)
Sets the x and y coordinates of a specific point in the array
|
void |
setXY(int index,
PVector v)
Sets the x and y coordinates of a specific point in the array
|
void |
setY(int index,
float y)
Sets the y coordinate of a specific point in the array
|
public GPointsArray()
public GPointsArray(int initialSize)
initialSize - the initial estimate for the size of the arraypublic GPointsArray(GPoint[] points)
points - an array of pointspublic GPointsArray(GPointsArray points)
points - an array of pointspublic GPointsArray(float[] x,
float[] y,
String[] labels)
x - the points x coordinatesy - the points y coordinateslabels - the points text labelspublic GPointsArray(float[] x,
float[] y)
x - the points x coordinatesy - the points y coordinatespublic GPointsArray(PVector[] vectors, String[] labels)
vectors - an array of Processing vectors with the points x and y
coordinateslabels - the points text labelspublic GPointsArray(PVector[] vectors)
vectors - an array of Processing vectors with the points x and y
coordinatespublic void add(GPoint point)
point - the pointpublic void add(float x,
float y,
String label)
x - the point x coordinatey - the point y coordinatelabel - the point text labelpublic void add(float x,
float y)
x - the point x coordinatey - the point y coordinatepublic void add(PVector v, String label)
v - the Processing vector with the point x and y coordinateslabel - the point text labelpublic void add(PVector v)
v - the Processing vector with the point x and y coordinatespublic void add(int index,
GPoint point)
index - the point positionpoint - the pointpublic void add(int index,
float x,
float y,
String label)
index - the point positionx - the point x coordinatey - the point y coordinatelabel - the point text labelpublic void add(int index,
float x,
float y)
index - the point positionx - the point x coordinatey - the point y coordinatepublic void add(int index,
PVector v,
String label)
index - the point positionv - the Processing vector with the point x and y coordinateslabel - the point text labelpublic void add(int index,
PVector v)
index - the point positionv - the Processing vector with the point x and y coordinatespublic void add(GPoint[] pts)
pts - the new set of pointspublic void add(GPointsArray pts)
pts - the new set of pointspublic void add(float[] x,
float[] y,
String[] labels)
x - the points x coordinatesy - the points y coordinateslabels - the points text labelspublic void add(float[] x,
float[] y)
x - the points x coordinatesy - the points y coordinatespublic void add(PVector[] vectors, String[] labels)
vectors - the Processing vectors with the points x and y coordinateslabels - the points text labelspublic void add(PVector[] vectors)
vectors - the Processing vectors with the points x and y coordinatespublic void add(ArrayList<PVector> vectors)
vectors - the Processing vectors with the points x and y coordinatespublic void remove(int index)
index - the point index.public void removeRange(int fromIndex,
int toIndex)
fromIndex - the lower point index.toIndex - the end point index.public void removeInvalidPoints()
public void set(GPointsArray pts)
pts - the new points. The number of points could differ from the
original.public void set(int index,
GPoint point)
index - the point index. If the index equals the array size, it will
add a new point to the array.point - the point to usepublic void set(int index,
float x,
float y,
String label)
index - the point index. If the index equals the array size, it will
add a new point to the array.x - the point new x coordinatey - the point new y coordinatelabel - the point new text labelpublic void set(int index,
PVector v,
String label)
index - the point index. If the index equals the array size, it will
add a new point to the array.v - the Processing vector with the point new x and y coordinateslabel - the point new text labelpublic void setX(int index,
float x)
index - the point indexx - the point new x coordinatepublic void setY(int index,
float y)
index - the point indexy - the point new y coordinatepublic void setXY(int index,
float x,
float y)
index - the point indexx - the point new x coordinatey - the point new y coordinatepublic void setXY(int index,
PVector v)
index - the point indexv - the Processing vector with the point new x and y coordinatespublic void setLabel(int index,
String label)
index - the point indexlabel - the point new text labelpublic void setNPoints(int nPoints)
nPoints - the new total number of points in the array. It should be
smaller than the current number.public int getNPoints()
public GPoint get(int index)
index - the point index in the arraypublic float getX(int index)
index - the point index in the arraypublic float getY(int index)
index - the point index in the arraypublic String getLabel(int index)
index - the point index in the arraypublic boolean getValid(int index)
index - the point index in the arraypublic boolean isValid(int index)
index - the point index in the arraypublic GPoint getLastPoint()
Processing Library grafica by Javier Gracia Carpio. (c) 2015