[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool PencilTool.java,1.12,1.13
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2005-09-05 14:29:27
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29197/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java Log Message: Adding hole functionality to pencil Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PencilTool.java 5 Sep 2005 11:43:56 -0000 1.12 --- PencilTool.java 5 Sep 2005 14:29:16 -0000 1.13 *************** *** 11,14 **** --- 11,15 ---- import java.util.ArrayList; import java.util.List; + import java.util.Set; import net.sourceforge.bprocessor.gl.GLView; *************** *** 45,48 **** --- 46,58 ---- protected Vertex alignVertex = null; + /** The exterior Surface is a Surface, where a hole is being defined */ + + protected Surface exterior = null; + + /** The candidates are the Set of surfaces that could be the exterior + * for a hole being defined. + */ + protected Set candiates = null; + /** The edges */ *************** *** 109,113 **** void onVertex(Vertex vertex) { System.out.println(vertex); - setAlignVertex(vertex); if (active == null) { --- 119,122 ---- *************** *** 119,126 **** glv.getView().setActiveEdge(active); glv.getView().setSnapVertex(to); } else { // The following lines of code are there to make sure // that a Surface is finished when clicking an edge.. - if (target != null) { if (target instanceof Edge) { --- 128,135 ---- glv.getView().setActiveEdge(active); glv.getView().setSnapVertex(to); + } else { // The following lines of code are there to make sure // that a Surface is finished when clicking an edge.. if (target != null) { if (target instanceof Edge) { *************** *** 149,152 **** --- 158,162 ---- setAlignVertex(null); glv.getView().setSnapVertex(null); + exterior = null; } } *************** *** 197,202 **** * Set current vertex to an appropriate vertex * @param event Tne MouseEvent */ ! protected void findVertex(MouseEvent event) { double x = event.getX(); double y = AbstractView.getHeight() - event.getY(); --- 207,214 ---- * Set current vertex to an appropriate vertex * @param event Tne MouseEvent + * @return if the vertex is legal */ ! protected boolean findVertex(MouseEvent event) { ! boolean legal = true; double x = event.getX(); double y = AbstractView.getHeight() - event.getY(); *************** *** 218,221 **** --- 230,241 ---- vertex.setName("V" + vertexNum++); current = vertex; + if (active != null) { + if (exterior != null) { + legal = (target == exterior); + } else { + exterior = (Surface) target; + legal = true; + } + } } if (target instanceof Edge) { *************** *** 236,239 **** --- 256,260 ---- } + return legal; } *************** *** 244,249 **** protected void pressed(MouseEvent e) { super.pressed(e); ! findVertex(e); ! onVertex(current); } /** --- 265,272 ---- protected void pressed(MouseEvent e) { super.pressed(e); ! boolean legal = findVertex(e); ! if (legal) { ! onVertex(current); ! } } /** |