public class GeometryBuffer
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
GeometryBuffer.GeometryType
The Enum GeometryType.
|
| Modifier and Type | Field and Description |
|---|---|
int[] |
index
The indexes.
|
int |
indexPos
The current index position.
|
int |
pointPos
The current position in points array.
|
float[] |
points
The points.
|
GeometryBuffer.GeometryType |
type
The current geometry type.
|
| Constructor and Description |
|---|
GeometryBuffer() |
GeometryBuffer(float[] points,
int[] index)
Instantiates a new geometry buffer.
|
GeometryBuffer(int numPoints,
int numIndices)
Instantiates a new geometry buffer.
|
| Modifier and Type | Method and Description |
|---|---|
GeometryBuffer |
addPoint(float x,
float y)
Adds a point with the coordinate x, y.
|
void |
addPoint(Point p) |
void |
addPoint(PointF p) |
GeometryBuffer |
clear()
Reset buffer.
|
int[] |
ensureIndexSize(int size,
boolean copy)
Ensure index size.
|
float[] |
ensurePointSize(int size,
boolean copy)
Ensure that 'points' array can hold the number of points.
|
int |
getNumPoints() |
PointF |
getPoint(int i) |
void |
getPoint(int i,
PointF out) |
float |
getPointX(int i) |
float |
getPointY(int i) |
boolean |
isLine() |
boolean |
isPoint() |
boolean |
isPoly() |
static GeometryBuffer |
makeCircle(float x,
float y,
float radius,
int segments) |
static GeometryBuffer |
makeCircle(GeometryBuffer g,
float x,
float y,
float radius,
int segments) |
GeometryBuffer |
scale(float scaleX,
float scaleY) |
void |
setPoint(int pos,
float x,
float y)
Sets the point x,y at position pos.
|
void |
simplify(float minSqDist,
boolean keepLines)
Remove points with distance less than minSqDist
TODO could avoid superfluous copying
|
void |
startHole()
Starts a new polygon hole (inner ring).
|
GeometryBuffer |
startLine()
Start a new line.
|
void |
startPoints()
Set geometry type for points.
|
GeometryBuffer |
startPolygon()
Start a new polygon.
|
java.lang.String |
toString() |
GeometryBuffer |
translate(float dx,
float dy) |
public float[] points
public int[] index
public int indexPos
public int pointPos
public GeometryBuffer.GeometryType type
public GeometryBuffer()
public GeometryBuffer(int numPoints,
int numIndices)
numPoints - the num of expected pointsnumIndices - the num of expected indicespublic GeometryBuffer(float[] points,
int[] index)
points - the pointsindex - the indexpublic void getPoint(int i,
PointF out)
out - PointF to set coordinates to.public float getPointX(int i)
public float getPointY(int i)
public PointF getPoint(int i)
public int getNumPoints()
public GeometryBuffer clear()
public GeometryBuffer addPoint(float x, float y)
x - the x ordinatey - the y ordinatepublic boolean isPoly()
public boolean isLine()
public boolean isPoint()
public void setPoint(int pos,
float x,
float y)
pos - the posx - the x ordinatey - the y ordinatepublic void startPoints()
public GeometryBuffer startLine()
public GeometryBuffer startPolygon()
public void startHole()
public GeometryBuffer translate(float dx, float dy)
public GeometryBuffer scale(float scaleX, float scaleY)
public float[] ensurePointSize(int size,
boolean copy)
size - the number of points to holdcopy - the the current data when array is reallocatedpublic int[] ensureIndexSize(int size,
boolean copy)
size - the sizecopy - the copypublic void addPoint(Point p)
public void addPoint(PointF p)
public void simplify(float minSqDist,
boolean keepLines)
minSqDist - keepLines - keep endpoint when line would
otherwise collapse into a single pointpublic java.lang.String toString()
toString in class java.lang.Objectpublic static GeometryBuffer makeCircle(float x, float y, float radius, int segments)
public static GeometryBuffer makeCircle(GeometryBuffer g, float x, float y, float radius, int segments)