[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view AbstractView.java,1.22,1.23 View.java,
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2005-09-07 11:30:42
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12390/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java View.java ViewFactory.java Log Message: All made to resemble a selection list instead of one edge vertex and surface Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** AbstractView.java 6 Sep 2005 13:51:21 -0000 1.22 --- AbstractView.java 7 Sep 2005 11:30:34 -0000 1.23 *************** *** 7,12 **** package net.sourceforge.bprocessor.gl.view; - import net.sourceforge.bprocessor.kernel.notification.Notification; - import net.sourceforge.bprocessor.gl.GLView; --- 7,10 ---- *************** *** 85,97 **** protected static Vertex alignVertex = null; - /** The selected vertex */ - protected static Vertex selectedVertex = null; - - /** The selected edge */ - protected static Edge selectedEdge = null; - - /** The selected surface */ - protected static Surface selectedSurface = null; - /** The GL */ protected GL gl = null; --- 83,86 ---- *************** *** 224,228 **** gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); ! gl.glDepthMask(true); // grid and coords are always completely lit --- 213,217 ---- gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); ! //gl.glDepthMask(true); // grid and coords are always completely lit *************** *** 314,318 **** Set edges = EdgeFacade.getInstance().findAll(); Set vertices = VertexFacade.getInstance().findAll(); ! int[] mode = new int[1]; gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); --- 303,308 ---- Set edges = EdgeFacade.getInstance().findAll(); Set vertices = VertexFacade.getInstance().findAll(); ! List selection = glv.getTool().getSelection(); ! int[] mode = new int[1]; gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); *************** *** 324,346 **** if (mode[0] != GL.GL_SELECT) { gl.glEnable(GL.GL_DEPTH_TEST); ! // draw selected surface ! if (selectedSurface != null) { ! gl.glColor3fv(SELECTED_COLOR); ! gl.glEnable(GL.GL_POLYGON_STIPPLE); ! gl.glPolygonStipple(transparency); ! selectedSurface = SurfaceFacade.getInstance().findById(selectedSurface.getId()); ! drawSurface(selectedSurface); ! gl.glDisable(GL.GL_POLYGON_STIPPLE); } ! ! // draw all the surfaces in the model ! if (drawMode != WIREFRAME_MODE) { ! Iterator it = surfaces.iterator(); ! gl.glColor3fv(SURFACE_COLOR); ! while (it.hasNext()) { ! Surface s = (Surface)it.next(); ! if (!s.equals(selectedSurface)) { ! drawSurface(s); ! } } } --- 314,349 ---- if (mode[0] != GL.GL_SELECT) { gl.glEnable(GL.GL_DEPTH_TEST); ! ! if (drawMode == LIGHTING_MODE) { ! gl.glEnable(GL.GL_LIGHTING); ! } else { ! gl.glDisable(GL.GL_LIGHTING); } ! // draw selection ! Iterator selit = selection.iterator(); ! while (selit.hasNext()) { ! Object o = selit.next(); ! gl.glColor3fv(SELECTED_COLOR); ! if (o instanceof Vertex) { ! gl.glPointSize(5.0f); ! gl.glBegin(GL.GL_POINTS); ! Vertex v = VertexFacade.getInstance().findById(((Vertex)o).getId()); ! gl.glVertex3d(v.getX(), v.getY(), v.getZ()); ! gl.glEnd(); ! gl.glPointSize(1.0f); ! } else if (o instanceof Edge) { ! Edge e = EdgeFacade.getInstance().findById(((Edge)o).getId()); ! Vertex to = e.getTo(); ! Vertex from = e.getFrom(); ! gl.glBegin(GL.GL_LINES); ! gl.glVertex3d(to.getX(), to.getY(), to.getZ()); ! gl.glVertex3d(from.getX(), from.getY(), from.getZ()); ! gl.glEnd(); ! } else if (o instanceof Surface) { ! gl.glEnable(GL.GL_POLYGON_STIPPLE); ! gl.glPolygonStipple(transparency); ! Surface s = SurfaceFacade.getInstance().findById(((Surface)o).getId()); ! drawSurface(s); ! gl.glDisable(GL.GL_POLYGON_STIPPLE); } } *************** *** 393,431 **** gl.glPointSize(1.0f); } - - // draw selected vertex - if (selectedVertex != null) { - gl.glColor3fv(SELECTED_COLOR); - gl.glPointSize(5.0f); - gl.glBegin(GL.GL_POINTS); - selectedVertex = VertexFacade.getInstance().findById(selectedVertex.getId()); - gl.glVertex3d(selectedVertex.getX(), selectedVertex.getY(), selectedVertex.getZ()); - gl.glEnd(); - gl.glPointSize(1.0f); - } - - // draw selected edge - if (selectedEdge != null) { - gl.glColor3fv(SELECTED_COLOR); - selectedEdge = EdgeFacade.getInstance().findById(selectedEdge.getId()); - Vertex to = selectedEdge.getTo(); - Vertex from = selectedEdge.getFrom(); - gl.glBegin(GL.GL_LINES); - gl.glVertex3d(to.getX(), to.getY(), to.getZ()); - gl.glVertex3d(from.getX(), from.getY(), from.getZ()); - gl.glEnd(); - } // draw all the edges in the model ! Iterator eit = edges.iterator(); ! gl.glColor3fv(STD_LINE_COLOR); ! while (eit.hasNext()) { ! Edge e = (Edge)eit.next(); ! if (!e.equals(selectedEdge)) { drawEdge(e); } } - gl.glEnable(GL.GL_LIGHTING); } else { // HERE STARTS SELECTION MODE DRAWING if (selectMode == VERTICES || selectMode == ALL) { --- 396,425 ---- gl.glPointSize(1.0f); } // draw all the edges in the model ! if (drawMode != LIGHTING_MODE) { ! Iterator eit = edges.iterator(); ! gl.glColor3fv(STD_LINE_COLOR); ! while (eit.hasNext()) { ! Edge e = (Edge)eit.next(); drawEdge(e); } + } else { + gl.glEnable(GL.GL_LIGHTING); + } + + // draw all the surfaces in the model + if (drawMode != WIREFRAME_MODE) { + Iterator it = surfaces.iterator(); + gl.glColor3fv(SURFACE_COLOR); + while (it.hasNext()) { + Surface s = (Surface)it.next(); + if (!selection.contains(s)) { + drawSurface(s); + } + } } } else { + // HERE STARTS SELECTION MODE DRAWING if (selectMode == VERTICES || selectMode == ALL) { *************** *** 746,787 **** /** - * Handle a notification - * @param n The notification - */ - public void handleNotification(Notification n) { - if (n.getType().equals(Notification.VERTEX_SELECTED)) { - selectedVertex = VertexFacade.getInstance().findById(n.getObject()); - } else if (n.getType().equals(Notification.VERTEX_DESELECTED)) { - selectedVertex = null; - } else if (n.getType().equals(Notification.EDGE_SELECTED)) { - selectedEdge = EdgeFacade.getInstance().findById(n.getObject()); - } else if (n.getType().equals(Notification.EDGE_DESELECTED)) { - selectedEdge = null; - } else if (n.getType().equals(Notification.SURFACE_SELECTED)) { - selectedSurface = SurfaceFacade.getInstance().findById(n.getObject()); - } else if (n.getType().equals(Notification.SURFACE_DESELECTED)) { - selectedSurface = null; - } - glv.repaint(true); - } - - /** - * Should the listener handle this notification - * @param type The notification type - * @return Returns true on SELECTED events; otherwise false - */ - public boolean isNotificationEnabled(String type) { - if (type.equals(Notification.VERTEX_SELECTED) || - type.equals(Notification.VERTEX_DESELECTED) || - type.equals(Notification.EDGE_SELECTED) || - type.equals(Notification.EDGE_DESELECTED) || - type.equals(Notification.SURFACE_SELECTED) || - type.equals(Notification.SURFACE_DESELECTED)) { - return true; - } - return false; - } - - /** * Initialize the objectTable and the name-stack * @param gl The GL --- 740,743 ---- Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** View.java 6 Sep 2005 08:36:22 -0000 1.10 --- View.java 7 Sep 2005 11:30:34 -0000 1.11 *************** *** 7,12 **** package net.sourceforge.bprocessor.gl.view; - import net.sourceforge.bprocessor.kernel.notification.NotificationListener; - import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Vertex; --- 7,10 ---- *************** *** 18,22 **** * The View Interface */ ! public interface View extends GLEventListener, NotificationListener { /** The 3D view view */ public static final int VIEW_3D = 0; --- 16,20 ---- * The View Interface */ ! public interface View extends GLEventListener { /** The 3D view view */ public static final int VIEW_3D = 0; Index: ViewFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/ViewFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ViewFactory.java 31 Aug 2005 14:56:31 -0000 1.5 --- ViewFactory.java 7 Sep 2005 11:30:34 -0000 1.6 *************** *** 7,11 **** package net.sourceforge.bprocessor.gl.view; - import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.gui.Toolbar; import net.sourceforge.bprocessor.gl.GLView; --- 7,10 ---- *************** *** 51,60 **** viewYZ = new ViewYZ(glv); - Notifier n = Notifier.getInstance(); - n.addListener(view3D); - n.addListener(viewXY); - n.addListener(viewXZ); - n.addListener(viewYZ); - Toolbar tb = Toolbar.getInstance(); JButton but = tb.registerAction(new View3DAction(glv)); --- 50,53 ---- |