[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Document.java, 1.1, 1.2 Defaults.jav
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2009-08-28 12:58:54
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11722/src/net/sourceforge/bprocessor/model Modified Files: Document.java Defaults.java Project.java Persistence.java Log Message: Index: Defaults.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Defaults.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Defaults.java 22 Jun 2009 13:30:23 -0000 1.6 --- Defaults.java 28 Aug 2009 12:58:46 -0000 1.7 *************** *** 27,30 **** --- 27,38 ---- return functionalMaterial; } + + /** + * + * @param value new material + */ + public static void setFunctionalMaterial(Material value) { + functionalMaterial = value; + } *************** *** 35,38 **** --- 43,53 ---- return constructionMaterial; } + /** + * + * @param value new material + */ + public static void setConstructionMaterial(Material value) { + constructionMaterial = value; + } *************** *** 43,46 **** --- 58,68 ---- return voidMaterial; } + /** + * + * @param value new material + */ + public static void setVoidMaterial(Material value) { + voidMaterial = value; + } /** Index: Persistence.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Persistence.java,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** Persistence.java 29 Jun 2009 08:37:37 -0000 1.81 --- Persistence.java 28 Aug 2009 12:58:46 -0000 1.82 *************** *** 82,85 **** --- 82,86 ---- import java.io.FileInputStream; import java.io.FileOutputStream; + import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; *************** *** 910,923 **** * This method saves the Bmodel document to a file * @param file The output file - * @exception Exception Thrown if an exception occurs */ ! public static void save(File file) throws Exception { ! FileOutputStream fos = new FileOutputStream(file); ! Bmodel bp = externalize(); ! ! saveFile(bp, fos); ! fos.flush(); ! fos.close(); } --- 911,936 ---- * This method saves the Bmodel document to a file * @param file The output file */ ! public static void save(File file) { ! try { ! String name = file.getName(); ! File tmp; ! tmp = File.createTempFile(name, ".tmp"); ! FileOutputStream fos = new FileOutputStream(tmp); ! Bmodel bp = externalize(); ! saveFile(bp, fos); ! ! fos.flush(); ! fos.close(); ! boolean success = tmp.renameTo(file); ! if (!success) { ! System.out.println("problem while saving to " + name); ! } ! } catch (IOException e) { ! System.out.println(e.getMessage() + " while saving to " + file.getName()); ! } catch (JAXBException e) { ! System.out.println(e.getMessage() + " while marshalling model"); ! } } Index: Document.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Document.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Document.java 29 Jun 2009 08:37:37 -0000 1.1 --- Document.java 28 Aug 2009 12:58:46 -0000 1.2 *************** *** 160,162 **** --- 160,176 ---- return components; } + + /** + * + * @param name the name of the material to find + * @return the found material + */ + public Material findMaterial(String name) { + for (Material current : materials) { + if (current.getName().equals(name)) { + return current; + } + } + return null; + } } Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.180 retrieving revision 1.181 diff -C2 -d -r1.180 -r1.181 *** Project.java 29 Jun 2009 08:37:37 -0000 1.180 --- Project.java 28 Aug 2009 12:58:46 -0000 1.181 *************** *** 319,322 **** --- 319,323 ---- public Project() { super(); + System.out.println("-- construct --"); staticObservers = new LinkedList(); reset(); *************** *** 793,801 **** */ public void checkpoint() { ! redoStack.clear(); ! if (currentState != null) { ! undoStack.push(currentState); } - currentState = Persistence.externalize(); log.debug("--------CheckPoint--------"); } --- 794,807 ---- */ public void checkpoint() { ! ! Bmodel state = Persistence.externalize(); ! ! if (state != null) { ! redoStack.clear(); ! if (currentState != null) { ! undoStack.push(currentState); ! } ! currentState = state; } log.debug("--------CheckPoint--------"); } *************** *** 875,879 **** add(current); } ! changed(this); } --- 881,898 ---- add(current); } ! { ! Material construction = document.findMaterial("Construction"); ! if (construction != null) { ! Defaults.setConstructionMaterial(construction); ! } ! Material functional = document.findMaterial("Functional"); ! if (functional != null) { ! Defaults.setFunctionalMaterial(functional); ! } ! Material material = document.findMaterial("Void"); ! if (material != null) { ! Defaults.setVoidMaterial(material); ! } ! } changed(this); } *************** *** 1472,1475 **** --- 1491,1516 ---- } } + } else { + List<Surface> surfaces = new LinkedList(); + for (Surface current : space.getSurfaces()) { + if (current.getExterior() == null) { + surfaces.add(current); + } + } + if (surfaces.size() > 0) { + Command.Inverse inv = new Command.Inverse(surfaces); + Collection<Edge> soup = Surface.edges(surfaces); + List<Edge> loners = new LinkedList(); + for (Edge current : soup) { + List<Surface> lst = inv.surfaces(current); + if (lst.size() == 1) { + loners.add(current); + } + } + List<Edge> external = Command.Offset.order(loners); + List<Vertex> verts = Command.Offset.vertices(external); + Boundary b = new Boundary(convert(verts)); + location.setExternalBoundary(b); + } } *************** *** 1600,1605 **** } - private void processBoundary(Area location) { if (location.getChildren().isEmpty()) { // --- 1641,1649 ---- } private void processBoundary(Area location) { + + } + + private void processBoundary1(Area location) { if (location.getChildren().isEmpty()) { // *************** *** 1612,1617 **** LinkedList<Boundary> internals = new LinkedList(); for (Area current : location.getChildren()) { ! processBoundary(current); ! internals.add(current.getExternalBoundary()); } LinkedList<Point2d> points = new LinkedList(); --- 1656,1666 ---- LinkedList<Boundary> internals = new LinkedList(); for (Area current : location.getChildren()) { ! processBoundary1(current); ! Boundary external = current.getExternalBoundary(); ! if (external != null) { ! internals.add(current.getExternalBoundary()); ! } else { ! System.out.println("failed to create boundary on " + current); ! } } LinkedList<Point2d> points = new LinkedList(); *************** *** 1661,1666 **** processBoundary(root); - - LocationModel model = new LocationModel(); model.setLocation(root); --- 1710,1713 ---- *************** *** 1685,1689 **** List<Space> containers = new LinkedList(); for (Space current : constructs) { - System.out.println("-- " + current.getName() + " --"); Space tesselation = current.tesselate(); tesselation.setMaterial(current.getMaterial()); --- 1732,1735 ---- |