Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2369
Modified Files:
View.java
Log Message:
objects can be given a color, tempobjects can be drawn on top of everything
Index: View.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v
retrieving revision 1.73
retrieving revision 1.74
diff -C2 -d -r1.73 -r1.74
*** View.java 25 Mar 2006 18:10:04 -0000 1.73
--- View.java 29 Mar 2006 18:35:56 -0000 1.74
***************
*** 22,25 ****
--- 22,26 ----
import net.sourceforge.bprocessor.model.Vertex;
import net.sourceforge.bprocessor.model.Surface;
+ import net.sourceforge.bprocessor.model.Entity;
import java.util.ArrayList;
***************
*** 30,33 ****
--- 31,36 ----
import java.util.Collection;
import java.util.Set;
+ import java.util.Map;
+ import java.util.HashMap;
import java.awt.event.ActionEvent;
***************
*** 278,281 ****
--- 281,290 ----
private Set tempVertices;
+ /** Entities that should be drawn on top of everything else*/
+ private Set onTopEntities;
+
+ /** Maps entities to a color */
+ private Map colorMap;
+
static {
setTransparency(100);
***************
*** 368,371 ****
--- 377,382 ----
tempSurfaces = new HashSet();
tempVertices = new HashSet();
+ onTopEntities = new HashSet();
+ colorMap = new HashMap();
Toolbar tb = Toolbar.getInstance();
***************
*** 824,827 ****
--- 835,845 ----
gl.glEnd();
gl.glPointSize(1.0f);
+ }
+
+ {
+ Iterator it = onTopEntities.iterator();
+ while (it.hasNext()) {
+ drawObject(it.next());
+ }
}
}
***************
*** 829,833 ****
/**
! * Draw an object
* @param o The Object
*/
--- 847,851 ----
/**
! * Draw an object with depth test disabled.
* @param o The Object
*/
***************
*** 911,915 ****
while (iter.hasNext()) {
Edge current = (Edge)iter.next();
! if (current.getConstructor()) {
gl.glColor3fv(constructorColor);
drawConstructor(current);
--- 929,942 ----
while (iter.hasNext()) {
Edge current = (Edge)iter.next();
! float[] color = (float[])colorMap.get(current);
! if (color != null) {
! gl.glColor3fv(color);
! if (current.getConstructor()) {
! drawConstructor(current);
! } else {
! drawEdge(current);
! }
! gl.glColor3fv(lineColor);
! } else if (current.getConstructor()) {
gl.glColor3fv(constructorColor);
drawConstructor(current);
***************
*** 2346,2349 ****
--- 2373,2384 ----
}
+ /**
+ * Adds a temporary edge to be drawn on top.
+ * @param e the edge
+ */
+ public void addTempEdgeOnTop(Edge e) {
+ onTopEntities.add(e);
+ }
+
/**
* Removes a temporary edge
***************
*** 2363,2366 ****
--- 2398,2409 ----
/**
+ * Adds a temporary vertex to be drawn on top.
+ * @param v the vertex
+ */
+ public void addTempVertexOnTop(Vertex v) {
+ onTopEntities.add(v);
+ }
+
+ /**
* Removes a temporary vertex
* @param v the vertex to remove
***************
*** 2369,2373 ****
--- 2412,2440 ----
tempVertices.remove(v);
}
+
+ /**
+ * Removes a temporary Entity that is on top
+ * @param e the entity to remove
+ */
+ public void removeEntityOnTop(Entity e) {
+ onTopEntities.remove(e);
+ }
+
+ /**
+ * Puts a new color in the color map for an entity
+ * @param e the entity
+ * @param color the color
+ */
+ public void changeColor(Entity e, float[] color) {
+ colorMap.put(e, color);
+ }
+ /**
+ * Clears the color of an entity in the color map
+ * @param e the entity
+ */
+ public void clearColor(Entity e) {
+ colorMap.remove(e);
+ }
/**
|