Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18243
Modified Files:
DrawTool.java
Log Message:
adds spaces to the surfaces
Index: DrawTool.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/DrawTool.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** DrawTool.java 30 Aug 2005 12:47:25 -0000 1.7
--- DrawTool.java 2 Sep 2005 13:44:19 -0000 1.8
***************
*** 11,14 ****
--- 11,19 ----
import net.sourceforge.bprocessor.model.Vertex;
import net.sourceforge.bprocessor.model.VertexFacade;
+ import net.sourceforge.bprocessor.model.Space;
+ import net.sourceforge.bprocessor.model.FunctionalSpace;
+ import net.sourceforge.bprocessor.model.FunctionalSpaceFacade;
+ import net.sourceforge.bprocessor.model.ConstructionSpace;
+ import net.sourceforge.bprocessor.model.ConstructionSpaceFacade;
import net.sourceforge.bprocessor.gl.view.View;
import net.sourceforge.bprocessor.gl.GLView;
***************
*** 127,130 ****
--- 132,147 ----
activeEdge.setTo(to);
updateEdge(activeEdge);
+ Surface s = createSurface(edges);
+ Space sp = findSpace(s);
+ if (sp != null) {
+ sp.addSurface(s);
+ }
+ 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");
+ }
} else {
to = activeEdge.getTo();
***************
*** 135,139 ****
edges.add(activeEdge);
}
- Surface s = createSurface(edges);
glv.getView().setAlignVertex(null);
glv.getView().setActiveEdge(null);
--- 152,155 ----
***************
*** 141,144 ****
--- 157,178 ----
}
+
+ /**
+ * 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;
+ }
+
/**
* Add an edge to the parent edgelist
|