[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view Display.java, 1.20, 1.21
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-10-08 13:09:27
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18514/src/net/sourceforge/bprocessor/gl/view Modified Files: Display.java Log Message: refactored drawing Index: Display.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Display.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Display.java 3 Oct 2007 11:18:56 -0000 1.20 --- Display.java 8 Oct 2007 12:11:54 -0000 1.21 *************** *** 32,35 **** --- 32,36 ---- import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Line; + import net.sourceforge.bprocessor.model.Net; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; *************** *** 241,244 **** --- 242,276 ---- } + + /** + * Drawing methods. + */ + + private static void draw(Vertex vertex) { + gl.glBegin(GL.GL_POINTS); + gl.glVertex3d(vertex.getX(), vertex.getY(), vertex.getZ()); + gl.glEnd(); + } + private static void paint(Vertex vertex, float[] color, float size) { + gl.glColor3fv(color, 0); + gl.glPointSize(size); + draw(vertex); + } + private static void paintVertices(Collection<Vertex> vertices, float[] color, float size) { + gl.glColor3fv(color, 0); + gl.glPointSize(size); + for (Vertex current : vertices) { + draw(current); + } + } + private static void selectVertices(Collection<Vertex> vertices) { + for (Vertex current : vertices) { + push(current); + draw(current); + pop(); + } + } + + private static void selectSurfaces(Collection<Surface> surfaces) { for (Surface current : surfaces) { *************** *** 357,384 **** } - private static void drawVertices(Collection<Vertex> vertices) { - gl.glColor3fv(black, 0); - gl.glPointSize(9.0f); - for (Vertex current : vertices) { - if (current != target) { - draw(current); - } - } - } - private static void selectVertices(Collection<Vertex> vertices) { - gl.glPointSize(9.0f); - for (Vertex current : vertices) { - push(current); - draw(current); - pop(); - } - } ! private static void draw(Vertex vertex) { ! gl.glBegin(GL.GL_POINTS); ! gl.glVertex3d(vertex.getX(), vertex.getY(), vertex.getZ()); ! gl.glEnd(); ! } private static void paintConstructors(Collection<Constructor> constructors) { --- 389,396 ---- } ! ! private static void paintConstructors(Collection<Constructor> constructors) { *************** *** 610,614 **** { ! if (selecting()) { Set<Vertex> visible = new HashSet(); for (Edge current : edges) { --- 622,626 ---- { ! if (selecting() || (space instanceof Net && space == project.getActiveSpace())) { Set<Vertex> visible = new HashSet(); for (Edge current : edges) { *************** *** 623,627 **** } ! // FIXME: The set of lonely vertices should be cached. Set<Vertex> mark = new HashSet(); for (Edge current : space.getEdges()) { --- 635,639 ---- } ! //FIXME: The set of lonely vertices should be cached. Set<Vertex> mark = new HashSet(); for (Edge current : space.getEdges()) { *************** *** 670,674 **** selectVertices(vertices); } else { ! drawVertices(vertices); } --- 682,692 ---- selectVertices(vertices); } else { ! float[] color; ! if (space instanceof Net) { ! color = middleblue; ! } else { ! color = black; ! } ! paintVertices(vertices, color, 9.0f); } *************** *** 711,721 **** if (current instanceof Vertex) { if (current.getOwner() != null) { ! gl.glColor3fv(redish, 0); ! gl.glPointSize(9.0f); } else { ! gl.glColor3fv(blueish, 0); ! gl.glPointSize(6.0f); } - draw((Vertex) current); } } --- 729,736 ---- if (current instanceof Vertex) { if (current.getOwner() != null) { ! paint((Vertex) current, redish, 9.0f); } else { ! paint((Vertex) current, blueish, 6.0f); } } } *************** *** 789,793 **** selectVertices(vertices); } else { ! drawVertices(vertices); } --- 804,808 ---- selectVertices(vertices); } else { ! paintVertices(vertices, black, 9.0f); } |