[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view View.java, 1.180, 1.181 EdgeAttribute
Status: Pre-Alpha
Brought to you by:
henryml
|
From: Michael L. <he...@us...> - 2007-02-07 10:08:02
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31126/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Removed Files: EdgeAttributes.java SurfaceAttributes.java Log Message: Small refactorings of edge drawing --- EdgeAttributes.java DELETED --- --- SurfaceAttributes.java DELETED --- Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.180 retrieving revision 1.181 diff -C2 -d -r1.180 -r1.181 *** View.java 31 Jan 2007 09:18:27 -0000 1.180 --- View.java 7 Feb 2007 10:00:02 -0000 1.181 *************** *** 9,12 **** --- 9,13 ---- import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.tool.SpaceTool; + import net.sourceforge.bprocessor.gl.model.EdgeAttributes; import net.sourceforge.bprocessor.gl.model.GlObject; import net.sourceforge.bprocessor.gl.model.Intersection; *************** *** 303,306 **** --- 304,317 ---- /** The y-coordinate of last selection */ protected double y; + + /** + * Keeps track of the current EdgeAttributes. + */ + private EdgeAttributes currentEdgeAttributes; + + /** + * Keeps track of the current stippling + */ + private boolean stipple; /** The mode of selecting. Either edges or surfaces */ *************** *** 575,578 **** --- 586,610 ---- } + + /** + * Apply edge attributes + * @param attributes the new attributes + */ + public void apply(EdgeAttributes attributes) { + if (attributes != currentEdgeAttributes) { + currentEdgeAttributes = attributes; + gl.glLineWidth(attributes.getLineWidth()); + gl.glColor3fv(attributes.getColor(), 0); + if (attributes.isStipple() != stipple) { + stipple = attributes.isStipple(); + if (stipple) { + gl.glEnable(GL.GL_LINE_STIPPLE); + } else { + gl.glDisable(GL.GL_LINE_STIPPLE); + } + } + } + } + /** * The function responsible for drawing at each update *************** *** 802,830 **** gl.glEnd(); } ! ! /** ! * Draw a coordinate system ! */ ! protected void coords() { ! double size = View.gridSize(); ! gl.glLineWidth(1.0f); ! gl.glBegin(GL.GL_LINES); ! gl.glDisable(GL.GL_DEPTH_TEST); ! gl.glColor3fv(X_AXIS_COLOR, 0); ! gl.glVertex3d(0.0, 0.0, 0.0); ! gl.glVertex3d(size * 2, 0.0, 0.0); ! gl.glColor3fv(Y_AXIS_COLOR, 0); ! gl.glVertex3d(0.0, 0.0, 0.0); ! gl.glVertex3d(0.0, size * 2, 0.0); ! gl.glEnd(); ! gl.glEnable(GL.GL_DEPTH_TEST); ! gl.glBegin(GL.GL_LINES); ! gl.glColor3fv(Z_AXIS_COLOR, 0); ! gl.glVertex3d(0.0, 0.0, 0.0); ! gl.glVertex3d(0.0, 0.0, size * 2); ! gl.glEnd(); ! } ! ! /** * Draw all the existing elements --- 834,838 ---- gl.glEnd(); } ! /** * Draw all the existing elements *************** *** 950,954 **** } } - { Iterator iter = highligts.iterator(); --- 958,961 ---- *************** *** 1196,1199 **** --- 1203,1207 ---- /** + * FIXME edge-drawing * Draw an object with depth test disabled. * @param o The Object *************** *** 1333,1336 **** --- 1341,1345 ---- /** + * FIXME edge-drawing * Draw a constructor * @param constructor The constructor *************** *** 1546,1549 **** --- 1555,1559 ---- /** + * FIXME edge-drawing * Draw constructor line * @param from Origin *************** *** 1559,1562 **** --- 1569,1573 ---- /** + * FIXME edge-drawing * Draw constructor line * @param from Origin *************** *** 1576,1580 **** /** ! * * @param gld The GLDrawable * @param edges The edges --- 1587,1591 ---- /** ! * FIXME edge-drawing * @param gld The GLDrawable * @param edges The edges *************** *** 2293,2296 **** --- 2304,2308 ---- /** + * FIXME edge-drawing * Draw a constructor edge * @param e Edge *************** *** 2303,2306 **** --- 2315,2319 ---- /** + * FIXME edge-drawing * Draw an Edge * @param e The Edge to draw *************** *** 2315,2319 **** gl.glEnd(); } ! } /** --- 2328,2343 ---- gl.glEnd(); } ! } ! ! private void drawEdge(Edge edge, EdgeAttributes attributes) { ! apply(attributes); ! drawEdge(edge); ! } ! private void drawEdges(Collection<Edge> edges, EdgeAttributes attributes) { ! apply(attributes); ! for (Edge edge : edges) { ! drawEdge(edge); ! } ! } /** |