Thread: [Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view ViewToolbarFactory.java, 1.4, 1.5 Vie
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-11-09 12:23:28
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2120/src/net/sourceforge/bprocessor/gl/view Modified Files: ViewToolbarFactory.java View.java Display.java Log Message: implemented ability to turn edges off Index: ViewToolbarFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/ViewToolbarFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ViewToolbarFactory.java 12 Oct 2007 11:06:52 -0000 1.4 --- ViewToolbarFactory.java 9 Nov 2007 12:23:29 -0000 1.5 *************** *** 64,70 **** --- 64,98 ---- but.setToolTipText("Grid"); but.setSelected(true); + + + but = tb.registerAction(new ViewEdges(glv)); + but.setToolTipText("Edges"); + but.setSelected(true); } + class ViewEdges extends AbstractAction { + private GLView glv; + + ViewEdges(GLView glv) { + this.glv = glv; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("Biconedges.gif"); + ImageIcon im = new ImageIcon(url); + putValue(Action.SMALL_ICON, im); + } + + /** {@inheritDoc} */ + public void actionPerformed(ActionEvent event) { + JToggleButton button = (JToggleButton) event.getSource(); + if (button.isSelected()) { + glv.getView().enableEdges(); + } else { + glv.getView().disableEdges(); + } + glv.repaint(); + } + } + class ViewGrid extends AbstractAction { private GLView glv; Index: Display.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Display.java,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** Display.java 9 Nov 2007 10:42:16 -0000 1.50 --- Display.java 9 Nov 2007 12:23:29 -0000 1.51 *************** *** 63,66 **** --- 63,67 ---- private static boolean intersecting; private static boolean construction; + private static boolean edgesEnabled; private static int mode; private static boolean transparency; *************** *** 276,279 **** --- 277,298 ---- /** + * Returns true if edges are visible + * @return true if edges are visible + */ + public static boolean edgesEnabled() { + return edgesEnabled; + } + + /** + * Sets the edges flag specifying if edges + * are visible + * @param value new value of edges flag + */ + public static void edgesEnabled(boolean value) { + edgesEnabled = value; + } + + + /** * Returns the mode * @return the mode *************** *** 448,453 **** private static void paintSurfaces(Collection<Surface> surfaces, float[] color) { ! gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glPolygonOffset(1.0f, 1.0f); apply(color, 1.0f); for (Surface current : surfaces) { --- 467,474 ---- private static void paintSurfaces(Collection<Surface> surfaces, float[] color) { ! if (edgesEnabled) { ! gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glPolygonOffset(1.0f, 1.0f); ! } apply(color, 1.0f); for (Surface current : surfaces) { *************** *** 456,460 **** } } ! gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); } --- 477,483 ---- } } ! if (edgesEnabled) { ! gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); ! } } *************** *** 472,477 **** gl.glEnable(GL.GL_LIGHTING); gl.glShadeModel(GL.GL_SMOOTH); ! gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glPolygonOffset(1.0f, 1.0f); gl.glEnable(GL.GL_CULL_FACE); gl.glCullFace(GL.GL_BACK); --- 495,503 ---- gl.glEnable(GL.GL_LIGHTING); gl.glShadeModel(GL.GL_SMOOTH); ! ! if (edgesEnabled) { ! gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glPolygonOffset(1.0f, 1.0f); ! } gl.glEnable(GL.GL_CULL_FACE); gl.glCullFace(GL.GL_BACK); *************** *** 498,502 **** } } ! gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); gl.glDisable(GL.GL_CULL_FACE); gl.glDisable(GL.GL_LIGHTING); --- 524,530 ---- } } ! if (edgesEnabled) { ! gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); ! } gl.glDisable(GL.GL_CULL_FACE); gl.glDisable(GL.GL_LIGHTING); *************** *** 874,878 **** } } ! { Set<Edge> visible = new HashSet(); for (Surface current : surfaces) { --- 902,907 ---- } } ! ! if (edgesEnabled) { Set<Edge> visible = new HashSet(); for (Surface current : surfaces) { Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.255 retrieving revision 1.256 diff -C2 -d -r1.255 -r1.256 *** View.java 6 Nov 2007 18:27:00 -0000 1.255 --- View.java 9 Nov 2007 12:23:29 -0000 1.256 *************** *** 283,286 **** --- 283,288 ---- private boolean gridEnabled; + private boolean edgesEnabled; + private boolean showTransparent = true; *************** *** 440,443 **** --- 442,446 ---- noneColor = NONE_COLOR; gridEnabled = true; + edgesEnabled = true; tempConstructors = new HashSet<Constructor>(); tempEdges = new HashSet<Edge>(); *************** *** 535,538 **** --- 538,555 ---- /** + * Enable edges + */ + public void enableEdges() { + edgesEnabled = true; + } + + /** + * Disable edges + */ + public void disableEdges() { + edgesEnabled = false; + } + + /** * * *************** *** 615,618 **** --- 632,636 ---- Display.selecting(hitdetection); Display.construction(gridEnabled); + Display.edgesEnabled(edgesEnabled); Display.mode(drawMode); Display.transparency(showTransparent); |