[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool PencilTool.java,1.17,1.18
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2005-09-14 07:03:52
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26218 Modified Files: PencilTool.java Log Message: Added the space automation Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** PencilTool.java 8 Sep 2005 08:21:06 -0000 1.17 --- PencilTool.java 14 Sep 2005 07:03:44 -0000 1.18 *************** *** 5,9 **** // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- - package net.sourceforge.bprocessor.gl.tool; --- 5,8 ---- *************** *** 24,32 **** --- 23,41 ---- import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.VertexFacade; + import net.sourceforge.bprocessor.model.FunctionalSpaceFacade; + import net.sourceforge.bprocessor.model.FunctionalSpace; + import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; + import net.sourceforge.bprocessor.model.ConstructionSpace; + import net.sourceforge.bprocessor.model.Space; + + import java.util.Iterator; + import org.apache.log4j.Logger; /** * The DebugTool */ public class PencilTool extends SelectTool { + /** The logger */ + private static Logger log = Logger.getLogger(PencilTool.class); /** The active */ *************** *** 40,44 **** /** The current */ - protected Vertex current = null; --- 49,52 ---- *************** *** 47,51 **** /** The exterior Surface is a Surface, where a hole is being defined */ - protected Surface exterior = null; --- 55,58 ---- *************** *** 54,60 **** */ protected Set candiates = null; ! ! /** The edges */ ! protected List edges = null; --- 61,66 ---- */ protected Set candiates = null; ! ! /** The edges */ protected List edges = null; *************** *** 100,103 **** --- 106,110 ---- alignVertex = vertex; } + /** * Intern the surface *************** *** 109,112 **** --- 116,120 ---- } } + /** * Called with the vertex that are clicked on - either: *************** *** 161,164 **** --- 169,185 ---- SurfaceFacade.getInstance().update(surface); } + + // Do automation with spaces + Space sp = findSpace(surface); + if (sp != null) { + sp.addSurface(surface); + } + if (sp instanceof ConstructionSpace) { + ConstructionSpaceFacade.getInstance().update((ConstructionSpace)sp); + } else if (sp instanceof FunctionalSpace) { + FunctionalSpaceFacade.getInstance().update((FunctionalSpace)sp); + } else { + log.warn("No space was found"); + } } edges = null; *************** *** 173,176 **** --- 194,198 ---- } } + /** * Round to grid *************** *** 259,264 **** Plane xy = new Plane(0, 0, 1, 0); Vertex vertex = xy.intersection(ray); ! vertex.setName("V" + vertexNum++); ! current = vertex; } if (current.getId() == null) { --- 281,288 ---- Plane xy = new Plane(0, 0, 1, 0); Vertex vertex = xy.intersection(ray); ! if (vertex != null) { ! vertex.setName("V" + vertexNum++); ! current = vertex; ! } } if (current.getId() == null) { *************** *** 319,321 **** --- 343,361 ---- } + /** + * Find the space we did draw in + * @param s The surface to check for the location of + * @return The Space + */ + private Space findSpace(Surface s) { + Set set = FunctionalSpaceFacade.getInstance().findAll(); + Iterator it = set.iterator(); + while (it.hasNext()) { + Space fs = (Space)it.next(); + if (fs.getName().equals("Ext")) { + return fs; + } + } + return null; + } } |