[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool AbstractTool.java,1.13,1.14 ExtrusionT
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2005-09-07 11:30:43
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12390/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java ExtrusionTool.java MoveTool.java SelectTool.java Tool.java Log Message: All made to resemble a selection list instead of one edge vertex and surface Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** SelectTool.java 2 Sep 2005 13:42:36 -0000 1.16 --- SelectTool.java 7 Sep 2005 11:30:34 -0000 1.17 *************** *** 15,23 **** import net.sourceforge.bprocessor.model.Edge; ! //import net.sourceforge.bprocessor.model.EdgeFacade; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.VertexFacade; import net.sourceforge.bprocessor.model.Surface; ! //import net.sourceforge.bprocessor.model.SurfaceFacade; import java.awt.event.MouseEvent; --- 15,27 ---- import net.sourceforge.bprocessor.model.Edge; ! import net.sourceforge.bprocessor.model.EdgeFacade; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.VertexFacade; import net.sourceforge.bprocessor.model.Surface; ! import net.sourceforge.bprocessor.model.SurfaceFacade; ! import net.sourceforge.bprocessor.model.FunctionalSpaceFacade; ! import net.sourceforge.bprocessor.model.FunctionalSpace; ! import net.sourceforge.bprocessor.model.ConstructionSpace; ! import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; import java.awt.event.MouseEvent; *************** *** 26,30 **** import java.util.Iterator; ! import java.util.List; import java.util.ArrayList; import java.util.Set; --- 30,34 ---- import java.util.Iterator; ! //import java.util.List; import java.util.ArrayList; import java.util.Set; *************** *** 39,54 **** private static Logger log = Logger.getLogger(SelectTool.class); - /** The selected objects */ - protected static List selection; - - /** 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 Viewtype */ protected int viewType; --- 43,46 ---- *************** *** 57,63 **** protected Object target; - static { - selection = new ArrayList(); - } /** * The constructor --- 49,52 ---- *************** *** 104,125 **** if (target == null) { log.info("target was null"); - Iterator it = selection.iterator(); - while (it.hasNext()) { - deselect(it.next()); - } selection = new ArrayList(); } else if ((e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) == InputEvent.SHIFT_DOWN_MASK) { - select(target); if (!selection.contains(target)) { ! selection.add(target); } } else { - Iterator it = selection.iterator(); - while (it.hasNext()) { - deselect(it.next()); - } selection = new ArrayList(); select(target); ! selection.add(target); } } --- 93,108 ---- if (target == null) { log.info("target was null"); selection = new ArrayList(); } else if ((e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) == InputEvent.SHIFT_DOWN_MASK) { if (!selection.contains(target)) { ! select(target); ! //selection.add(target); ! } else { ! deselect(target); } } else { selection = new ArrayList(); select(target); ! //selection.add(target); } } *************** *** 235,249 **** public void handleNotification(Notification n) { if (n.getType().equals(Notification.VERTEX_SELECTED)) { ! //selection.add(VertexFacade.getInstance().findById(n.getObject())); } else if (n.getType().equals(Notification.VERTEX_DESELECTED)) { ! //selectedVertex = null; } else if (n.getType().equals(Notification.EDGE_SELECTED)) { ! // selection.add(EdgeFacade.getInstance().findById(n.getObject())); } else if (n.getType().equals(Notification.EDGE_DESELECTED)) { ! //selectedEdge = null; } else if (n.getType().equals(Notification.SURFACE_SELECTED)) { ! //selection.add(SurfaceFacade.getInstance().findById(n.getObject())); } else if (n.getType().equals(Notification.SURFACE_DESELECTED)) { ! //selectedSurface = null; } } --- 218,294 ---- public void handleNotification(Notification n) { if (n.getType().equals(Notification.VERTEX_SELECTED)) { ! Object o = VertexFacade.getInstance().findById(n.getObject()); ! if (!selection.contains(o)) { ! selection.add(o); ! } } else if (n.getType().equals(Notification.VERTEX_DESELECTED)) { ! Object o = VertexFacade.getInstance().findById(n.getObject()); ! if (selection.contains(o)) { ! selection.remove(o); ! } } else if (n.getType().equals(Notification.EDGE_SELECTED)) { ! Object o = EdgeFacade.getInstance().findById(n.getObject()); ! if (!selection.contains(o)) { ! selection.add(o); ! } } else if (n.getType().equals(Notification.EDGE_DESELECTED)) { ! Object o = EdgeFacade.getInstance().findById(n.getObject()); ! if (selection.contains(o)) { ! selection.remove(o); ! } } else if (n.getType().equals(Notification.SURFACE_SELECTED)) { ! Object o = SurfaceFacade.getInstance().findById(n.getObject()); ! if (!selection.contains(o)) { ! selection.add(o); ! } } else if (n.getType().equals(Notification.SURFACE_DESELECTED)) { ! Object o = SurfaceFacade.getInstance().findById(n.getObject()); ! if (selection.contains(o)) { ! selection.remove(o); ! } ! } else if (n.getType().equals(Notification.FUNCTIONAL_SPACE_SELECTED)) { ! FunctionalSpace fs = ! (FunctionalSpace)FunctionalSpaceFacade.getInstance().findById(n.getObject()); ! Set s = fs.getSurfaces(); ! Iterator it = s.iterator(); ! while (it.hasNext()) { ! Surface surface = (Surface)it.next(); ! if (!selection.contains(surface)) { ! selection.add(surface); ! } ! } ! } else if (n.getType().equals(Notification.FUNCTIONAL_SPACE_DESELECTED)) { ! FunctionalSpace fs = ! (FunctionalSpace)FunctionalSpaceFacade.getInstance().findById(n.getObject()); ! Set s = fs.getSurfaces(); ! Iterator it = s.iterator(); ! while (it.hasNext()) { ! Surface surface = (Surface)it.next(); ! if (selection.contains(surface)) { ! selection.remove(surface); ! } ! } ! } else if (n.getType().equals(Notification.CONSTRUCTION_SPACE_SELECTED)) { ! ConstructionSpace cs = ! (ConstructionSpace)ConstructionSpaceFacade.getInstance().findById(n.getObject()); ! Set s = cs.getSurfaces(); ! Iterator it = s.iterator(); ! while (it.hasNext()) { ! Surface surface = (Surface)it.next(); ! if (!selection.contains(surface)) { ! selection.add(surface); ! } ! } ! } else if (n.getType().equals(Notification.CONSTRUCTION_SPACE_DESELECTED)) { ! ConstructionSpace cs = ! (ConstructionSpace)ConstructionSpaceFacade.getInstance().findById(n.getObject()); ! Set s = cs.getSurfaces(); ! Iterator it = s.iterator(); ! while (it.hasNext()) { ! Surface surface = (Surface)it.next(); ! if (selection.contains(surface)) { ! selection.remove(surface); ! } ! } } } *************** *** 260,264 **** type.equals(Notification.EDGE_DESELECTED) || type.equals(Notification.SURFACE_SELECTED) || ! type.equals(Notification.SURFACE_DESELECTED)) { return true; } --- 305,313 ---- type.equals(Notification.EDGE_DESELECTED) || type.equals(Notification.SURFACE_SELECTED) || ! type.equals(Notification.SURFACE_DESELECTED) || ! type.equals(Notification.FUNCTIONAL_SPACE_SELECTED) || ! type.equals(Notification.FUNCTIONAL_SPACE_DESELECTED) || ! type.equals(Notification.CONSTRUCTION_SPACE_SELECTED) || ! type.equals(Notification.CONSTRUCTION_SPACE_DESELECTED)) { return true; } Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MoveTool.java 6 Sep 2005 13:40:10 -0000 1.8 --- MoveTool.java 7 Sep 2005 11:30:34 -0000 1.9 *************** *** 38,52 **** private static final int XZ = 1; - /** The speed of moving in 3D view */ - private int moveSpeed = 60; - /** The the moving mode in 3D view */ private int moveMode = XY; /** The previous X coordinate */ ! private int lastX = 0; /** The previous Y cordinate */ ! private int lastY = 0; /** The plane to drag according to */ --- 38,49 ---- private static final int XZ = 1; /** The the moving mode in 3D view */ private int moveMode = XY; /** The previous X coordinate */ ! private int previousX = 0; /** The previous Y cordinate */ ! private int previousY = 0; /** The plane to drag according to */ *************** *** 67,94 **** protected void pressed(MouseEvent e) { super.pressed(e); ! lastX = e.getX(); ! lastY = e.getY(); if (target instanceof Vertex) { ! dragPlane = new Plane(0, 0, 1, 0); } else if (target instanceof Edge) { ! dragPlane = new Plane(0, 0, 1, 0); } else if (target instanceof Surface) { Surface sel = (Surface)target; ! dragPlane = sel.plane(); ! log.info("" + dragPlane); } // make a orthogonal plane to the current one if (moveMode == XZ) { ! log.info("orthogonal"); Transformation trans = glv.getView().transformation(); ! int x = lastX; ! int y = lastY; Vertex near = new Vertex("near", x, y, 0.0); Vertex far = new Vertex("far", x, y, 1.0); Edge ray = new Edge("ray", near, far); ray = trans.unProject(ray); ! dragPlane = dragPlane.orthogonalPlane(ray); ! } } --- 64,103 ---- protected void pressed(MouseEvent e) { super.pressed(e); ! previousX = e.getX(); ! previousY = e.getY(); + if (target != null) { + dragPlane = findMovePlane(); + } + log.info("plane: " + dragPlane); + } + + /** + * Finds the plan to move the element on + * @return The movement plane + */ + protected Plane findMovePlane() { + Plane temp = null; if (target instanceof Vertex) { ! temp = new Plane(0, 0, 1, 0); } else if (target instanceof Edge) { ! temp = new Plane(0, 0, 1, 0); } else if (target instanceof Surface) { Surface sel = (Surface)target; ! temp = sel.plane(); } // make a orthogonal plane to the current one if (moveMode == XZ) { ! log.info("ortho"); Transformation trans = glv.getView().transformation(); ! int x = previousX; ! int y = previousY; Vertex near = new Vertex("near", x, y, 0.0); Vertex far = new Vertex("far", x, y, 1.0); Edge ray = new Edge("ray", near, far); ray = trans.unProject(ray); ! return temp.orthogonalPlane(ray); ! } ! return temp; } *************** *** 113,122 **** View view = glv.getView(); ! double[] from = view.toPlaneCoords(new double[] {lastX, lastY}, dragPlane); ! log.info("from " + from[0] + ", " + from[1] + ", " + from[2]); double[] to = view.toPlaneCoords(new double[] {x, y}, dragPlane); - log.info("to " + to[0] + ", " + to[1] + ", " + to[2]); double[] delta = new double[] {to[0] - from[0], to[1] - from[1], to[2] - from[2]}; ! log.info("delta " + delta[0] + ", " + delta[1] + ", " + delta[2]); move(selection, delta); } else { --- 122,133 ---- View view = glv.getView(); ! double[] from = view.toPlaneCoords(new double[] {previousX, previousY}, dragPlane); double[] to = view.toPlaneCoords(new double[] {x, y}, dragPlane); double[] delta = new double[] {to[0] - from[0], to[1] - from[1], to[2] - from[2]}; ! if (log.isDebugEnabled()) { ! log.debug("from " + from[0] + ", " + from[1] + ", " + from[2]); ! log.debug("to " + to[0] + ", " + to[1] + ", " + to[2]); ! log.debug("delta " + delta[0] + ", " + delta[1] + ", " + delta[2]); ! } move(selection, delta); } else { *************** *** 124,244 **** } ! lastX = e.getX(); ! lastY = e.getY(); } ! /* int x = e.getX(); ! int y = e.getY(); ! if (viewType == View.VIEW_3D) { ! double deltaX = ((double)(x - lastX)) / moveSpeed; ! double deltaY = ((double)(y - lastY)) / moveSpeed; ! double[] coords; ! if (selectedSurface != null) { ! List l = Util.traverse(selectedSurface); ! for (int i = 0; i < l.size(); i++) { ! Vertex v = (Vertex)l.get(i); ! if (moveMode == XY) { ! coords = new double[] {v.getX() + deltaX, ! v.getY() - deltaY, ! v.getZ() + 0}; ! updateVertex(v, coords); ! } else { ! coords = new double[] {v.getX() + deltaX, ! v.getY() + 0, ! v.getZ() - deltaY}; ! updateVertex(v, coords); ! } ! } ! ! Set innerSurfaces = selectedSurface.getInnerSurfaces(); ! if (innerSurfaces != null) { ! Iterator innerIt = innerSurfaces.iterator(); ! while (innerIt.hasNext()) { ! Surface innerSurface = (Surface)innerIt.next(); ! List innerEdges = Util.traverse(innerSurface); ! for (int i = 0; i < innerEdges.size(); i++) { ! Vertex v = (Vertex)innerEdges.get(i); ! if (moveMode == XY) { ! coords = new double[] {v.getX() + deltaX, ! v.getY() - deltaY, ! v.getZ() + 0}; ! updateVertex(v, coords); ! } else { ! coords = new double[] {v.getX() + deltaX, ! v.getY() + 0, ! v.getZ() - deltaY}; ! updateVertex(v, coords); ! } ! } ! } ! } ! } else if (selectedEdge != null) { ! Vertex to = selectedEdge.getTo(); ! Vertex from = selectedEdge.getFrom(); ! if (moveMode == XY) { ! coords = new double[] {to.getX() + deltaX, ! to.getY() - deltaY, ! to.getZ() + 0}; ! updateVertex(to, coords); ! coords = new double[] {from.getX() + deltaX, ! from.getY() - deltaY, ! from.getZ() + 0}; ! updateVertex(from, coords); ! } else { ! coords = new double[] {to.getX() + deltaX, ! to.getY() + 0, ! to.getZ() - deltaY}; ! updateVertex(to, coords); ! coords = new double[] {from.getX() + deltaX, ! from.getY() + 0, ! from.getZ() - deltaY}; ! updateVertex(from, coords); ! } ! } ! } else { ! if (selectedVertex != null) { ! View view = glv.getView(); ! double[] coords = view.toCanvasCoords(new double[]{x, y}); ! coords = snapToGrid(coords); ! updateVertex(selectedVertex, coords); ! } else if (selectedSurface != null) { ! View view = glv.getView(); ! double[] coordsa = view.toCanvasCoords(new double[]{x, y}); ! double[] coordsb = view.toCanvasCoords(new double[]{lastX, lastY}); ! double[] delta = new double[] {coordsa[0] - coordsb[0], ! coordsa[1] - coordsb[1], ! coordsa[2] - coordsb[2]}; ! ! List l = Util.traverse(selectedSurface); ! for (int i = 0; i < l.size(); i++) { ! Vertex v = (Vertex)l.get(i); ! coordsa = new double[] {v.getX() + delta[0], ! v.getY() + delta[1], ! v.getZ() + delta[2]}; ! updateVertex(v, coordsa); ! } ! } else if (selectedEdge != null) { ! View view = glv.getView(); ! double[] coordsa = view.toCanvasCoords(new double[]{x, y}); ! double[] coordsb = view.toCanvasCoords(new double[]{lastX, lastY}); ! double[] delta = new double[] {coordsa[0] - coordsb[0], ! coordsa[1] - coordsb[1], ! coordsa[2] - coordsb[2]}; ! Vertex to = selectedEdge.getTo(); ! Vertex from = selectedEdge.getFrom(); ! ! coordsa = new double[] {to.getX() + delta[0], ! to.getY() + delta[1], ! to.getZ() + delta[2]}; ! updateVertex(to, coordsa); ! coordsa = new double[] {from.getX() + delta[0], ! from.getY() + delta[1], ! from.getZ() + delta[2]}; ! updateVertex(from, coordsa); ! } ! } ! lastX = x; ! lastY = y; ! }*/ ! /** * Move the entire selection --- 135,142 ---- } ! previousX = e.getX(); ! previousY = e.getY(); } ! /** * Move the entire selection *************** *** 296,305 **** double[] coords = new double[] {to.getX() + delta[0], ! to.getY() + delta[1], ! to.getZ() + delta[2]}; updateVertex(to, coords); coords = new double[] {from.getX() + delta[0], ! from.getY() + delta[1], ! from.getZ() + delta[2]}; updateVertex(from, coords); } --- 194,203 ---- double[] coords = new double[] {to.getX() + delta[0], ! to.getY() + delta[1], ! to.getZ() + delta[2]}; updateVertex(to, coords); coords = new double[] {from.getX() + delta[0], ! from.getY() + delta[1], ! from.getZ() + delta[2]}; updateVertex(from, coords); } *************** *** 312,318 **** private void move(Vertex vertex, double[] delta) { double[] coords = new double[] {vertex.getX() + delta[0], ! vertex.getY() + delta[1], ! vertex.getZ() + delta[2]}; ! coords = snapToGrid(coords); updateVertex(vertex, coords); } --- 210,215 ---- private void move(Vertex vertex, double[] delta) { double[] coords = new double[] {vertex.getX() + delta[0], ! vertex.getY() + delta[1], ! vertex.getZ() + delta[2]}; updateVertex(vertex, coords); } *************** *** 324,337 **** */ public void keyPressed(KeyEvent e) { ! if (e.getKeyCode() == KeyEvent.VK_X) { ! if (moveSpeed > 13) { ! moveSpeed -= 3; ! } ! } else if (e.getKeyCode() == KeyEvent.VK_Z) { ! moveSpeed += 3; ! } else if (e.getKeyCode() == KeyEvent.VK_A) { moveMode = XY; } else if (e.getKeyCode() == KeyEvent.VK_S) { moveMode = XZ; } else { super.keyPressed(e); --- 221,234 ---- */ public void keyPressed(KeyEvent e) { ! if (e.getKeyCode() == KeyEvent.VK_A) { moveMode = XY; + if (target != null) { + dragPlane = findMovePlane(); + } } else if (e.getKeyCode() == KeyEvent.VK_S) { moveMode = XZ; + if (target != null) { + dragPlane = findMovePlane(); + } } else { super.keyPressed(e); Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Tool.java 30 Aug 2005 12:53:21 -0000 1.4 --- Tool.java 7 Sep 2005 11:30:34 -0000 1.5 *************** *** 10,13 **** --- 10,15 ---- import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; + + import java.util.List; /** * The tool interface *************** *** 26,28 **** --- 28,36 ---- /** The hole tool */ public static final int HOLE_TOOL = 5; + + /** + * Return the current selection + * @return The list of selected objects + */ + public List getSelection(); } Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** AbstractTool.java 31 Aug 2005 14:56:32 -0000 1.13 --- AbstractTool.java 7 Sep 2005 11:30:34 -0000 1.14 *************** *** 19,24 **** --- 19,26 ---- import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; + import java.awt.event.InputEvent; import java.util.List; + import java.util.ArrayList; import java.util.Iterator; import java.util.Set; *************** *** 38,45 **** /** The mouse movement in x axis since press */ ! protected static int dx = 0; /** The mouse movement in y axis since press */ ! protected static int dy = 0; /** An vertex counter */ --- 40,47 ---- /** The mouse movement in x axis since press */ ! private static int dx = 0; /** The mouse movement in y axis since press */ ! private static int dy = 0; /** An vertex counter */ *************** *** 61,64 **** --- 63,69 ---- private static ActionListener moveAction; + /** The selected objects */ + protected static List selection; + /** The carmera move timer */ private static Timer timer; *************** *** 69,72 **** --- 74,78 ---- static { timer = new Timer(40, null); + selection = new ArrayList(); } *************** *** 193,200 **** pressPos[0] = e.getX(); pressPos[1] = e.getY(); ! if (currentButton == MouseEvent.BUTTON2) { timer.addActionListener(zoomAction); ! } else if (currentButton == MouseEvent.BUTTON3) { timer.addActionListener(moveAction); } --- 199,208 ---- pressPos[0] = e.getX(); pressPos[1] = e.getY(); + int zoommask = InputEvent.ALT_DOWN_MASK | InputEvent.BUTTON1_DOWN_MASK; + int rotamask = InputEvent.CTRL_DOWN_MASK | InputEvent.BUTTON1_DOWN_MASK; ! if (currentButton == MouseEvent.BUTTON2 || (e.getModifiersEx() & zoommask) == zoommask) { timer.addActionListener(zoomAction); ! } else if (currentButton == MouseEvent.BUTTON3 || (e.getModifiersEx() & rotamask) == rotamask) { timer.addActionListener(moveAction); } *************** *** 210,218 **** public void mouseReleased(MouseEvent e) { int currentButton = e.getButton(); ! if (currentButton == MouseEvent.BUTTON3) { timer.removeActionListener(moveAction); this.dx = 0; this.dy = 0; ! } else if (currentButton == MouseEvent.BUTTON2) { timer.removeActionListener(zoomAction); this.dx = 0; --- 218,230 ---- public void mouseReleased(MouseEvent e) { int currentButton = e.getButton(); ! int zoommask = InputEvent.ALT_DOWN_MASK | InputEvent.BUTTON1_DOWN_MASK; ! int rotamask = InputEvent.CTRL_DOWN_MASK | InputEvent.BUTTON1_DOWN_MASK; ! ! if (currentButton == MouseEvent.BUTTON3 || (e.getModifiersEx() & rotamask) == rotamask) { timer.removeActionListener(moveAction); this.dx = 0; this.dy = 0; ! } else if (currentButton == MouseEvent.BUTTON2 || ! (e.getModifiersEx() & zoommask) == zoommask) { timer.removeActionListener(zoomAction); this.dx = 0; *************** *** 420,423 **** --- 432,443 ---- } } + + /** + * Return the current selection + * @return The list of selected objects + */ + public List getSelection() { + return selection; + } /** Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ExtrusionTool.java 6 Sep 2005 13:32:11 -0000 1.6 --- ExtrusionTool.java 7 Sep 2005 11:30:34 -0000 1.7 *************** *** 42,46 **** /** the selected surface */ ! private static Surface selectedSurface = null; /** the dragplane */ --- 42,46 ---- /** the selected surface */ ! // private static Surface selectedSurface = null; /** the dragplane */ *************** *** 60,64 **** */ protected void dragged(MouseEvent e) { ! if (selectedSurface != null) { if (!selectedSurface.equals(dragSurface)) { if (isExtrudeable(selectedSurface)) { --- 60,65 ---- */ protected void dragged(MouseEvent e) { ! if (target instanceof Surface) { ! Surface selectedSurface = (Surface)target; if (!selectedSurface.equals(dragSurface)) { if (isExtrudeable(selectedSurface)) { *************** *** 66,70 **** } else { dragSurface = null; ! createExtension(); } } --- 67,71 ---- } else { dragSurface = null; ! createExtension(selectedSurface); } } *************** *** 86,95 **** } } else { - /* - old style code. - double dX = pressPos[0] - e.getX(); - double dY = pressPos[1] - e.getY(); - double delta = (dX - dY) / 60; - */ Vertex normal = dragSurface.normal(); normal.scale(1 / normal.length()); --- 87,90 ---- *************** *** 177,181 **** pressPos[1] = e.getY(); if (target instanceof Surface) { ! selectedSurface = (Surface)target; View view = glv.getView(); Transformation trans = view.transformation(); --- 172,176 ---- pressPos[1] = e.getY(); if (target instanceof Surface) { ! Surface selectedSurface = (Surface)target; View view = glv.getView(); Transformation trans = view.transformation(); *************** *** 194,199 **** norm[1] * clickPoint[1] + norm[2] * clickPoint[2]))); - } else { - selectedSurface = null; } } --- 189,192 ---- *************** *** 214,218 **** private Surface extendSurface(Surface extendSurf) { ConstructionSpace newCSpace = new ConstructionSpace("innerSpace"); ! Space outer = selectedSurface.getFrontSpace(); Edge previousEdge = null; Vertex previousVertex = null; --- 207,211 ---- private Surface extendSurface(Surface extendSurf) { ConstructionSpace newCSpace = new ConstructionSpace("innerSpace"); ! Space outer = extendSurf.getFrontSpace(); Edge previousEdge = null; Vertex previousVertex = null; *************** *** 221,225 **** List edges = extendSurf.getEdges(); List top = new ArrayList(edges.size()); ! newCSpace.addSurface(selectedSurface); Iterator i = edges.iterator(); Edge current = null; --- 214,218 ---- List edges = extendSurf.getEdges(); List top = new ArrayList(edges.size()); ! newCSpace.addSurface(extendSurf); Iterator i = edges.iterator(); Edge current = null; *************** *** 314,319 **** /** * Do all the initial extrusion stuff */ ! private void createExtension() { Surface top = extendSurface(selectedSurface); Set innerSurfaces = selectedSurface.getInnerSurfaces(); --- 307,313 ---- /** * Do all the initial extrusion stuff + * @param selectedSurface the surface to create extension to */ ! private void createExtension(Surface selectedSurface) { Surface top = extendSurface(selectedSurface); Set innerSurfaces = selectedSurface.getInnerSurfaces(); |