Thread: [Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Project.java, 1.161, 1.162
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2009-03-30 09:16:57
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23363/src/net/sourceforge/bprocessor/model Modified Files: Project.java Log Message: Tesselation implemented Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.161 retrieving revision 1.162 diff -C2 -d -r1.161 -r1.162 *** Project.java 17 Feb 2009 11:08:33 -0000 1.161 --- Project.java 30 Mar 2009 09:16:49 -0000 1.162 *************** *** 28,31 **** --- 28,32 ---- import java.util.List; import java.util.Map; + import java.util.Set; import java.util.Stack; import java.util.StringTokenizer; *************** *** 47,50 **** --- 48,52 ---- import dk.au.perpos.spatialsupport.routefinding.Boundary; import dk.au.perpos.spatialsupport.routefinding.Location; + import dk.au.perpos.spatialsupport.routefinding.LocationModel; import dk.au.perpos.spatialsupport.routefinding.Opening; import dk.au.perpos.spatialsupport.routefinding.Segment; *************** *** 1297,1300 **** --- 1299,1310 ---- } + private List<dk.au.perpos.spatialsupport.routefinding.Point> convert(List<Vertex> vertices) { + List<dk.au.perpos.spatialsupport.routefinding.Point> points = new LinkedList(); + for (Vertex current : vertices) { + points.add(convert(current)); + } + return points; + } + private dk.au.perpos.spatialsupport.routefinding.Point convert(Vertex vertex) { dk.au.perpos.spatialsupport.routefinding.Point point *************** *** 1312,1316 **** } ! private Location createLocationModel() { Location root = new Location(); root.setId("building"); --- 1322,1397 ---- } ! private Location createLocationModel(Container space, int level, ! Map<Surface, Location> locations, Map<Edge, List<Opening>> openings) { ! Location location = new Location(); ! location.setId(space.getName()); ! if (level == 1) { ! location.setDescription("Site"); ! } else if (level == 2) { ! location.setDescription("Building"); ! } else if (level == 3) { ! location.setDescription("Floor"); ! } else { ! location.setDescription("Room"); ! } ! ! { ! Set<Surface> envelope = space.getEnvelope(); ! if (envelope.size() == 1) { ! Surface surface = envelope.iterator().next(); ! List<Vertex> vertices = surface.getVertices(); ! Boundary boundary = new Boundary(convert(vertices)); ! location.setExternalBoundary(boundary); ! locations.put(surface, location); ! int count = 1; ! for (Edge edge : surface.getEdges()) { ! if (edge.isSmooth()) { ! Segment segment = convert(edge); ! segment = find(location, segment); ! Opening opening = new Opening(); ! opening.setId(String.valueOf(count++)); ! opening.setDistance(0.0); ! opening.setWidth(segment.getLength()); ! opening.setSegment(segment); ! location.addOpening(opening); ! List<Opening> lst = openings.get(edge); ! lst.add(opening); ! } ! } ! } ! } ! ! Map<Surface, Location> s2l = new HashMap(); ! Map<Edge, List<Opening>> e2o = new HashMap(); ! List<Edge> smoothies = new LinkedList(); ! for (Edge edge : space.getEdges()) { ! if (edge.isSmooth()) { ! List<Opening> lst = new LinkedList(); ! e2o.put(edge, lst); ! smoothies.add(edge); ! } ! } ! for (Space element : space.getElements()) { ! if (!element.isVoid()) { ! Location child = createLocationModel((Container) element, level + 1, s2l, e2o); ! location.addChild(child); ! } ! } ! for (Edge edge : smoothies) { ! List<Opening> lst = e2o.get(edge); ! if (lst.size() == 2) { ! Opening from = lst.get(0); ! Opening to = lst.get(1); ! dk.au.perpos.spatialsupport.routefinding.Connection connection ! = new dk.au.perpos.spatialsupport.routefinding.Connection(); ! connection.setFrom(from); ! connection.setTo(to); ! connection.setId("door"); ! } ! } ! return location; ! } ! ! private Location createFlatLocationModel() { Location root = new Location(); root.setId("building"); *************** *** 1405,1412 **** */ public void exportPPLM() { ! Location root = createLocationModel(); PrintStream out = System.out; PPLMPrinter printer = new PPLMPrinter(out); ! printer.printLocationModel(root); } --- 1486,1503 ---- */ 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); ! } ! ! /** ! * ! */ ! public void exportOBJ() { ! } *************** *** 1415,1419 **** */ public void exportJLMA() { ! Location root = createLocationModel(); PrintStream out = System.out; out.println("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"); --- 1506,1510 ---- */ public void exportJLMA() { ! Location root = createFlatLocationModel(); PrintStream out = System.out; out.println("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"); |