[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool ToolFactory.java,1.37,1.38 ArcTool.jav
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-03-16 20:01:54
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv841/src/net/sourceforge/bprocessor/gl/tool Modified Files: ToolFactory.java ArcTool.java RectTool.java Pencil.java AbstractPencil.java Log Message: There is a new version of the Pencil, which currently lacks snapping length field support. The new version is however much simpler and uses a general mechanism for interaction and feedback. The general mechanism are to be extended with snapping and length field support to the benefit of Pencil and other instruments Index: Pencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Pencil.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Pencil.java 16 Mar 2006 15:24:46 -0000 1.1 --- Pencil.java 16 Mar 2006 20:01:47 -0000 1.2 *************** *** 10,17 **** --- 10,19 ---- import java.awt.Cursor; import java.awt.event.MouseEvent; + import java.util.LinkedList; import java.util.List; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.model.Intersection; + import net.sourceforge.bprocessor.model.Edge; /** *************** *** 28,34 **** private Intersection current; - /** Edges */ - private List edges; - /** * Constructor for Pencil --- 30,33 ---- *************** *** 39,42 **** --- 38,57 ---- super(glv, cursor); } + + /** + * + * Update feedback + */ + public void updateFeedback() { + if (start != null) { + Edge edge = new Edge(start.vertex(), current.vertex()); + List edges = new LinkedList(); + edges.add(edge); + feedback(edges); + } else { + feedback(new LinkedList()); + } + makeTarget(current); + } /** *************** *** 44,47 **** --- 59,66 ---- */ protected void moved(MouseEvent e) { + current = findIntersection(e); + if (current != null) { + updateFeedback(); + } } *************** *** 50,53 **** --- 69,81 ---- */ protected void pressed(MouseEvent e) { + if (start == null) { + start = current; + } else { + Edge edge = new Edge(start.vertex(), current.vertex()); + List edges = new LinkedList(); + edges.add(edge); + insertEdges(edges); + start = null; + } } Index: ArcTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ArcTool.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ArcTool.java 16 Mar 2006 09:43:50 -0000 1.5 --- ArcTool.java 16 Mar 2006 20:01:47 -0000 1.6 *************** *** 18,22 **** import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Edge; - import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Vertex; --- 18,21 ---- *************** *** 148,153 **** */ protected void moved(MouseEvent e) { ! current = (Intersection) glv.getView().getObjectAtPoint(e.getX(), e.getY(), ! elements, true, new Plane(0, 0, 1, 0)); if (current != null) { updateFeedback(); --- 147,151 ---- */ protected void moved(MouseEvent e) { ! current = findIntersection(e); if (current != null) { updateFeedback(); Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** ToolFactory.java 15 Mar 2006 10:36:29 -0000 1.37 --- ToolFactory.java 16 Mar 2006 20:01:47 -0000 1.38 *************** *** 68,72 **** /** pencil tool */ ! private PencilTool pencil; /** eraser tool */ --- 68,72 ---- /** pencil tool */ ! private Pencil pencil; /** eraser tool */ *************** *** 163,167 **** select = new SpaceTool(glv, null); ! pencil = new PencilTool(glv, pencilcursor); eraser = new EraserTool(glv, pencilcursor); arc = new ArcTool(glv, pencilcursor); --- 163,167 ---- select = new SpaceTool(glv, null); ! pencil = new Pencil(glv, pencilcursor); eraser = new EraserTool(glv, pencilcursor); arc = new ArcTool(glv, pencilcursor); Index: RectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RectTool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RectTool.java 16 Mar 2006 14:34:50 -0000 1.2 --- RectTool.java 16 Mar 2006 20:01:47 -0000 1.3 *************** *** 16,20 **** import net.sourceforge.bprocessor.gl.model.Intersection; import net.sourceforge.bprocessor.model.Edge; - import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Vertex; --- 16,19 ---- *************** *** 105,110 **** */ protected void moved(MouseEvent e) { ! current = (Intersection) glv.getView().getObjectAtPoint(e.getX(), e.getY(), ! elements, true, new Plane(0, 0, 1, 0)); if (current != null) { updateFeedback(); --- 104,108 ---- */ protected void moved(MouseEvent e) { ! current = findIntersection(e); if (current != null) { updateFeedback(); Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AbstractPencil.java 16 Mar 2006 14:34:50 -0000 1.5 --- AbstractPencil.java 16 Mar 2006 20:01:47 -0000 1.6 *************** *** 8,11 **** --- 8,12 ---- import java.awt.Cursor; + import java.awt.event.MouseEvent; import java.util.Collection; import java.util.HashSet; *************** *** 19,22 **** --- 20,24 ---- import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Geometry; + import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Surface; *************** *** 40,44 **** } ! /** * Insert a vertex into model --- 42,55 ---- } ! /** ! * Find an intersection ! * @param e MouseEvent ! * @return Intersection ! */ ! protected Intersection findIntersection(MouseEvent e) { ! Intersection intersection = (Intersection) glv.getView().getObjectAtPoint(e.getX(), e.getY(), ! elements, true, new Plane(0, 0, 1, 0)); ! return intersection; ! } /** * Insert a vertex into model |