Thread: [Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view View.java,1.22,1.23 AbstractView.java,
Status: Pre-Alpha
Brought to you by:
henryml
From: Nordholt <nor...@us...> - 2005-11-30 15:43:29
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18773 Modified Files: View.java AbstractView.java Log Message: added support for temporary vertices, edges and surfaces to be drawn but not added to the database Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** AbstractView.java 30 Nov 2005 08:51:49 -0000 1.63 --- AbstractView.java 30 Nov 2005 15:43:21 -0000 1.64 *************** *** 176,179 **** --- 176,188 ---- private boolean backLabelSelect = false; + /** Temporary edges. Will be drawn but not put in database */ + private Set tempEdges; + + /** Temporary surfaces. Will be drawn but not put in database */ + private Set tempSurfaces; + + /** Temporary verticies. Will be drawn but not put in database */ + private Set tempVertices; + static { setTransparency(100); *************** *** 239,242 **** --- 248,254 ---- lineColor = STD_LINE_COLOR; gridColor = GRID_COLOR; + tempEdges = new HashSet(); + tempSurfaces = new HashSet(); + tempVertices = new HashSet(); } *************** *** 684,687 **** --- 696,705 ---- drawEdge(e); } + //draw all temporary edges. + Iterator tempEdgeIt = tempEdges.iterator(); + while (tempEdgeIt.hasNext()) { + Edge e = (Edge)tempEdgeIt.next(); + drawEdge(e); + } } *************** *** 701,704 **** --- 719,736 ---- } } + //Draw any temporary vertex not part of an edge + gl.glColor3fv(lineColor); + it = tempVertices.iterator(); + while (it.hasNext()) { + Vertex v = (Vertex)it.next(); + if (v.getEdges().isEmpty()) { + gl.glColor3fv(lineColor); + gl.glPointSize(5.0f); + gl.glBegin(GL.GL_POINTS); + gl.glVertex3d(v.getX(), v.getY(), v.getZ()); + gl.glEnd(); + gl.glPointSize(1.0f); + } + } } *************** *** 1038,1051 **** if (to != null && from != null) { if (e.getConstructor()) { - Vertex minus = to.minus(from); - minus.scale(1 / minus.length()); gl.glEnable(GL.GL_LINE_STIPPLE); gl.glBegin(GL.GL_LINE_STRIP); ! gl.glVertex3d(to.getX() + minus.getX() * 50, ! to.getY() + minus.getY() * 50, ! to.getZ() + minus.getZ() * 50); ! gl.glVertex3d(from.getX() + minus.getX() * -50, ! from.getY() + minus.getY() * -50, ! from.getZ() + minus.getZ() * -50); gl.glEnd(); gl.glDisable(GL.GL_LINE_STIPPLE); --- 1070,1081 ---- if (to != null && from != null) { if (e.getConstructor()) { gl.glEnable(GL.GL_LINE_STIPPLE); gl.glBegin(GL.GL_LINE_STRIP); ! gl.glVertex3d(to.getX(), ! to.getY(), ! to.getZ()); ! gl.glVertex3d(from.getX(), ! from.getY(), ! from.getZ()); gl.glEnd(); gl.glDisable(GL.GL_LINE_STIPPLE); *************** *** 1127,1130 **** --- 1157,1176 ---- } } + + it = tempSurfaces.iterator(); + while (it.hasNext()) { + Surface s = (Surface)it.next(); + if (!selection.contains(s)) { + if ((s.getBackDomain() instanceof FunctionalSpace) && + (s.getFrontDomain() instanceof FunctionalSpace)) { + //gl.glEnable(GL.GL_POLYGON_STIPPLE); + //gl.glPolygonStipple(transparency); + //drawSurface(s); + //gl.glDisable(GL.GL_POLYGON_STIPPLE); + } else { + drawSurface(s); + } + } + } } *************** *** 1741,1743 **** --- 1787,1838 ---- gridColor = color; } + + /** + * Adds a temporary surface to be drawn. + * @param s the surface + */ + public void addTempSurface(Surface s) { + tempSurfaces.add(s); + } + + /** + * Removes a temporary surface + * @param s the surface to remove + */ + public void removeTempSurface(Surface s) { + tempSurfaces.remove(s); + } + + /** + * Adds a temporary edge to be drawn. + * @param e the edge + */ + public void addTempEdge(Edge e) { + tempEdges.add(e); + } + + /** + * Removes a temporary edge + * @param e the edge to remove + */ + public void removeTempEdge(Edge e) { + tempEdges.remove(e); + } + + /** + * Adds a temporary surface to be drawn. + * @param v the vertex + */ + public void addTempVertex(Vertex v) { + tempVertices.add(v); + } + + /** + * Removes a temporary vertex + * @param v the vertex to remove + */ + public void removeTempVertex(Vertex v) { + tempVertices.remove(v); + } + } Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** View.java 23 Nov 2005 19:05:14 -0000 1.22 --- View.java 30 Nov 2005 15:43:20 -0000 1.23 *************** *** 287,299 **** */ public void setBGColor(float[] color); ! /** * Sets the line color * @param color the color. */ public void setLineColor(float[] color); ! /** * Sets the grid color * @param color the color. */ public void setGridColor(float[] color); } --- 287,336 ---- */ public void setBGColor(float[] color); ! /** * Sets the line color * @param color the color. */ public void setLineColor(float[] color); ! /** * Sets the grid color * @param color the color. */ public void setGridColor(float[] color); + + /** + * Adds a temporary surface to be drawn. + * @param s the surface + */ + public void addTempSurface(Surface s); + + /** + * Removes a temporary surface + * @param s the surface to remove + */ + public void removeTempSurface(Surface s); + + /** + * Adds a temporary edge to be drawn. + * @param e the edge + */ + public void addTempEdge(Edge e); + + /** + * Removes a temporary edge + * @param e the edge to remove + */ + public void removeTempEdge(Edge e); + + /** + * Adds a temporary surface to be drawn. + * @param v the vertex + */ + public void addTempVertex(Vertex v); + + /** + * Removes a temporary vertex + * @param v the vertex to remove + */ + public void removeTempVertex(Vertex v); + } |