[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Project.java, 1.163, 1.164
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2009-04-23 08:18:02
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28042/src/net/sourceforge/bprocessor/model Modified Files: Project.java Log Message: Export of PPLM Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.163 retrieving revision 1.164 diff -C2 -d -r1.163 -r1.164 *** Project.java 21 Apr 2009 10:21:21 -0000 1.163 --- Project.java 23 Apr 2009 08:17:46 -0000 1.164 *************** *** 28,31 **** --- 28,32 ---- import java.util.List; import java.util.Map; + import java.util.Queue; import java.util.Set; import java.util.Stack; *************** *** 1361,1364 **** --- 1362,1415 ---- Boundary boundary = new Boundary(convert(vertices)); location.setExternalBoundary(boundary); + + { + List<Surface> holes = new LinkedList(surface.getHoles()); + if (holes.size() > 0) { + Command.Inverse inv = new Command.Inverse(holes); + Collection<Edge> soup = Surface.edges(holes); + List<Edge> loners = new LinkedList(); + for (Edge current : soup) { + List<Surface> lst = inv.surfaces(current); + if (lst.size() == 1) { + loners.add(current); + } + } + + List<List<Edge>> internals = new LinkedList(); + Set<Edge> bag = new HashSet(loners); + while (!bag.isEmpty()) { + List<Edge> partition = new LinkedList(); + Queue<Edge> queue = new LinkedList(); + Edge leader = bag.iterator().next(); + bag.remove(leader); + queue.add(leader); + partition.add(leader); + while (!queue.isEmpty()) { + Edge current = queue.remove(); + List<Edge> fl = inv.edges(current.from); + List<Edge> tl = inv.edges(current.to); + List<Edge> lst = new LinkedList(); + lst.addAll(fl); + lst.addAll(tl); + for (Edge adjacant : lst) { + if (bag.contains(adjacant)) { + bag.remove(adjacant); + partition.add(adjacant); + queue.add(adjacant); + } + } + } + internals.add(partition); + } + for (List<Edge> partition : internals) { + List<Edge> internal = Command.Offset.order(partition); + List<Vertex> verts = Command.Offset.vertices(internal); + Boundary b = new Boundary(convert(verts)); + location.addInternalBoundary(b); + } + } + } + + locations.put(surface, location); int count = 1; *************** *** 1502,1513 **** /** * */ ! public void exportPPLM() { world().setName(getName()); Location root = createLocationModel(world(), 1, new HashMap(), new HashMap()); LocationModel model = new LocationModel(); model.setLocation(root); ! PrintStream out = System.out; ! PPLMPrinter printer = new PPLMPrinter(out); printer.printLocationModel(model); } --- 1553,1564 ---- /** * + * @param out OutputStream */ ! public void exportPPLM(OutputStream out) { world().setName(getName()); Location root = createLocationModel(world(), 1, new HashMap(), new HashMap()); LocationModel model = new LocationModel(); model.setLocation(root); ! PPLMPrinter printer = new PPLMPrinter(new PrintStream(out)); printer.printLocationModel(model); } |