diff options
author | Sven Gothel <[email protected]> | 2011-03-30 15:25:18 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-03-30 15:25:18 +0200 |
commit | 630a9ea52b16da6badb31a98b70893f8d294b4e8 (patch) | |
tree | 8ab07c2ff6a670381e2592c09a83bd7cf60a1f2c /src/com/jogamp/graph/geom/Outline.java | |
parent | d06d5596d18101c876c869a514e42e795ee9357c (diff) |
Remove generics notion of Type<Vertex>, since Vertex _is_ the lowest denominator for our implementation and curve API
Diffstat (limited to 'src/com/jogamp/graph/geom/Outline.java')
-rw-r--r-- | src/com/jogamp/graph/geom/Outline.java | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/com/jogamp/graph/geom/Outline.java b/src/com/jogamp/graph/geom/Outline.java index 4e588623e..85b6e8001 100644 --- a/src/com/jogamp/graph/geom/Outline.java +++ b/src/com/jogamp/graph/geom/Outline.java @@ -45,9 +45,9 @@ import com.jogamp.graph.math.VectorUtil; * @see OutlineShape, Region * */ -public class Outline<T extends Vertex> implements Comparable<Outline<T>>{ +public class Outline implements Comparable<Outline> { - private ArrayList<T> vertices = new ArrayList<T>(3); + private ArrayList<Vertex> vertices = new ArrayList<Vertex>(3); private boolean closed = false; private AABBox box = new AABBox(); @@ -63,7 +63,7 @@ public class Outline<T extends Vertex> implements Comparable<Outline<T>>{ * end of the outline loop/strip. * @param vertex Vertex to be added */ - public final void addVertex(T vertex) { + public final void addVertex(Vertex vertex) { vertices.add(vertex); box.resize(vertex.getX(), vertex.getY(), vertex.getZ()); } @@ -72,38 +72,36 @@ public class Outline<T extends Vertex> implements Comparable<Outline<T>>{ addVertex(factory, x, y, 0f, onCurve); } - @SuppressWarnings("unchecked") public final void addVertex(Vertex.Factory<? extends Vertex> factory, float x, float y, float z, boolean onCurve) { Vertex v = factory.create(x, y, z); v.setOnCurve(onCurve); - addVertex((T)v); + addVertex(v); } - @SuppressWarnings("unchecked") public final void addVertex(Vertex.Factory<? extends Vertex> factory, float[] coordsBuffer, int offset, int length, boolean onCurve) { Vertex v = factory.create(coordsBuffer, offset, length); v.setOnCurve(onCurve); - addVertex((T)v); + addVertex(v); } - public T getVertex(int index){ + public Vertex getVertex(int index){ return vertices.get(index); } public boolean isEmpty(){ return (vertices.size() == 0); } - public T getLastVertex(){ + public Vertex getLastVertex(){ if(isEmpty()){ return null; } return vertices.get(vertices.size()-1); } - public ArrayList<T> getVertices() { + public ArrayList<Vertex> getVertices() { return vertices; } - public void setVertices(ArrayList<T> vertices) { + public void setVertices(ArrayList<Vertex> vertices) { this.vertices = vertices; } public AABBox getBox() { @@ -122,11 +120,10 @@ public class Outline<T extends Vertex> implements Comparable<Outline<T>>{ public void setClosed(boolean closed) { this.closed = closed; if(closed){ - T first = vertices.get(0); - T last = getLastVertex(); + Vertex first = vertices.get(0); + Vertex last = getLastVertex(); if(!VectorUtil.checkEquality(first.getCoord(), last.getCoord())){ - @SuppressWarnings("unchecked") - T v = (T) first.clone(); + Vertex v = first.clone(); vertices.add(v); } } @@ -136,7 +133,7 @@ public class Outline<T extends Vertex> implements Comparable<Outline<T>>{ * as criteria. * @see java.lang.Comparable#compareTo(java.lang.Object) */ - public int compareTo(Outline<T> outline) { + public int compareTo(Outline outline) { float size = box.getSize(); float newSize = outline.getBox().getSize(); if(size < newSize){ |