[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Command.java, 1.77, 1.78 Selector.ja
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2009-06-25 20:29:36
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16490/src/net/sourceforge/bprocessor/model Modified Files: Command.java Selector.java Project.java Persistence.java Entity.java Surface.java Camera.java SurfaceSorter.java Constructor.java Selection.java Log Message: New files Index: Constructor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Constructor.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Constructor.java 12 Nov 2007 08:05:25 -0000 1.24 --- Constructor.java 25 Jun 2009 20:29:33 -0000 1.25 *************** *** 14,18 **** import java.util.Set; - import org.apache.log4j.Logger; /** --- 14,17 ---- *************** *** 21,28 **** */ public abstract class Constructor extends Geometric implements Parametric { - - /** The logger */ - private static Logger log = Logger.getLogger(Constructor.class); - /** The origin of the constructor */ protected Vertex origin; --- 20,23 ---- Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** Command.java 19 Jun 2009 13:32:25 -0000 1.77 --- Command.java 25 Jun 2009 20:29:33 -0000 1.78 *************** *** 999,1003 **** Surface bottom = new Surface(edges); Container space = Project.getInstance().getActiveSpace(); ! Container inside = space.createConstructionSpace("Cylinder"); bottom.setFrontDomain(inside); Set<Surface> sides = new HashSet<Surface>(); --- 999,1003 ---- Surface bottom = new Surface(edges); Container space = Project.getInstance().getActiveSpace(); ! Container inside = Space.createConstructionSpace("Cylinder"); bottom.setFrontDomain(inside); Set<Surface> sides = new HashSet<Surface>(); *************** *** 1175,1179 **** public void evaluate() { double radius = parameters.getDouble("radius"); - CoordinateSystem system = Project.getInstance().getActiveCoordinateSystem(); int stacks = 8; int slices = 6; --- 1175,1178 ---- *************** *** 2495,2501 **** double width = xmax - xmin; - double height = ymax - ymin; int n; - int m; --- 2494,2498 ---- Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.224 retrieving revision 1.225 diff -C2 -d -r1.224 -r1.225 *** Surface.java 21 Apr 2009 10:21:21 -0000 1.224 --- Surface.java 25 Jun 2009 20:29:33 -0000 1.225 *************** *** 1544,1557 **** } - - private static boolean check(double[] values) { - for (int i = 0; i < values.length; i++) { - if (String.valueOf(values[i]).equals("NaN")) { - return false; - } - } - return true; - } - /** * @param edges edges --- 1544,1547 ---- Index: Entity.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Entity.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Entity.java 20 Dec 2007 14:19:55 -0000 1.23 --- Entity.java 25 Jun 2009 20:29:33 -0000 1.24 *************** *** 16,27 **** import java.util.Map; - import org.apache.log4j.Logger; /** * The entity class */ public abstract class Entity implements Serializable { - /** The Logger */ - private static Logger log = Logger.getLogger(Entity.class); - /** The id */ protected Long id; --- 16,23 ---- Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.177 retrieving revision 1.178 diff -C2 -d -r1.177 -r1.178 *** Project.java 23 Jun 2009 12:08:45 -0000 1.177 --- Project.java 25 Jun 2009 20:29:33 -0000 1.178 *************** *** 52,58 **** 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; import dk.au.perpos.spatialsupport.routefinding.io.PPLMPrinter; --- 52,60 ---- import dk.au.perpos.spatialsupport.routefinding.Boundary; ! import dk.au.perpos.spatialsupport.locationmodel.Location; ! import dk.au.perpos.spatialsupport.routefinding.Area; import dk.au.perpos.spatialsupport.routefinding.LocationModel; import dk.au.perpos.spatialsupport.routefinding.Opening; + import dk.au.perpos.spatialsupport.routefinding.Point2d; import dk.au.perpos.spatialsupport.routefinding.Segment; import dk.au.perpos.spatialsupport.routefinding.io.PPLMPrinter; *************** *** 1268,1273 **** ! private boolean eq(dk.au.perpos.spatialsupport.routefinding.Point p1, ! dk.au.perpos.spatialsupport.routefinding.Point p2) { if (p1.getX() != p2.getX()) { return false; --- 1270,1275 ---- ! private boolean eq(Point2d p1, ! Point2d p2) { if (p1.getX() != p2.getX()) { return false; *************** *** 1287,1291 **** return false; } ! private Segment find(Location location, Segment segment) { List<Boundary> all = new LinkedList(); all.add(location.getExternalBoundary()); --- 1289,1293 ---- return false; } ! private Segment find(Area location, Segment segment) { List<Boundary> all = new LinkedList(); all.add(location.getExternalBoundary()); *************** *** 1301,1306 **** } ! 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)); --- 1303,1308 ---- } ! private List<Point2d> convert(List<Vertex> vertices) { ! List<Point2d> points = new LinkedList(); for (Vertex current : vertices) { points.add(convert(current)); *************** *** 1309,1315 **** } ! private dk.au.perpos.spatialsupport.routefinding.Point convert(Vertex vertex) { ! dk.au.perpos.spatialsupport.routefinding.Point point ! = new dk.au.perpos.spatialsupport.routefinding.Point(); point.setX(vertex.getX()); point.setY(vertex.getY()); --- 1311,1317 ---- } ! private Point2d convert(Vertex vertex) { ! Point2d point ! = new Point2d(); point.setX(vertex.getX()); point.setY(vertex.getY()); *************** *** 1338,1344 **** } ! private List<Location> createLocationModel(Container space, int level, ! Map<Surface, Location> locations, Map<Edge, List<Opening>> openings) { ! List<Location> locs = new LinkedList(); List<Surface> envelope = new LinkedList(space.getEnvelope()); int no = 0; --- 1340,1346 ---- } ! private List<Area> createLocationModel(Container space, int level, ! Map<Surface, Area> locations, Map<Edge, List<Opening>> openings) { ! List<Area> locs = new LinkedList(); List<Surface> envelope = new LinkedList(space.getEnvelope()); int no = 0; *************** *** 1354,1361 **** } ! private Location createLocationModel(Container space, int level, ! Map<Surface, Location> locations, Map<Edge, List<Opening>> openings, Surface surface, int no) { ! Location location = new Location(); if (no > 0) { location.setId(space.getName() + "-" + no); --- 1356,1363 ---- } ! private Area createLocationModel(Container space, int level, ! Map<Surface, Area> locations, Map<Edge, List<Opening>> openings, Surface surface, int no) { ! Area location = new Area(); if (no > 0) { location.setId(space.getName() + "-" + no); *************** *** 1457,1461 **** } ! Map<Surface, Location> s2l = new HashMap(); Map<Edge, List<Opening>> e2o = new HashMap(); List<Edge> smoothies = new LinkedList(); --- 1459,1463 ---- } ! Map<Surface, Area> s2l = new HashMap(); Map<Edge, List<Opening>> e2o = new HashMap(); List<Edge> smoothies = new LinkedList(); *************** *** 1469,1474 **** for (Space element : space.getElements()) { if (!element.isVoid()) { ! List<Location> children = createLocationModel((Container) element, level + 1, s2l, e2o); ! for (Location child : children) { location.addChild(child); } --- 1471,1476 ---- for (Space element : space.getElements()) { if (!element.isVoid()) { ! List<Area> children = createLocationModel((Container) element, level + 1, s2l, e2o); ! for (Area child : children) { location.addChild(child); } *************** *** 1494,1502 **** } ! private Location createFlatLocationModel() { ! Location root = new Location(); root.setId("building"); root.setDescription("none"); ! Map<Surface, Location> map = new HashMap(); Map<Edge, List<Surface>> e2s = new HashMap(); int openingId = 0; --- 1496,1504 ---- } ! private Area createFlatLocationModel() { ! Area root = new Area(); root.setId("building"); root.setDescription("none"); ! Map<Surface, Area> map = new HashMap(); Map<Edge, List<Surface>> e2s = new HashMap(); int openingId = 0; *************** *** 1511,1521 **** surfaces.add(surface); } ! Location node = new Location(); map.put(surface, node); node.setHeight(3); ! List<dk.au.perpos.spatialsupport.routefinding.Point> points = new LinkedList(); for (Vertex vertex : surface.getVertices()) { ! dk.au.perpos.spatialsupport.routefinding.Point point ! = new dk.au.perpos.spatialsupport.routefinding.Point(); point.setX(vertex.getX()); point.setY(vertex.getY()); --- 1513,1523 ---- surfaces.add(surface); } ! Area node = new Area(); map.put(surface, node); node.setHeight(3); ! List<Point2d> points = new LinkedList(); for (Vertex vertex : surface.getVertices()) { ! Point2d point ! = new Point2d(); point.setX(vertex.getX()); point.setY(vertex.getY()); *************** *** 1524,1529 **** Boundary area = new Boundary(); { ! dk.au.perpos.spatialsupport.routefinding.Point previous = points.get(points.size() - 1); ! for (dk.au.perpos.spatialsupport.routefinding.Point current : points) { Segment segment = new Segment(); segment.setFrom(previous); --- 1526,1531 ---- Boundary area = new Boundary(); { ! Point2d previous = points.get(points.size() - 1); ! for (Point2d current : points) { Segment segment = new Segment(); segment.setFrom(previous); *************** *** 1553,1558 **** Surface s1 = surfaces.get(0); Surface s2 = surfaces.get(1); ! Location n1 = map.get(s1); ! Location n2 = map.get(s2); Opening o1 = new Opening(); openingId++; --- 1555,1560 ---- Surface s1 = surfaces.get(0); Surface s2 = surfaces.get(1); ! Area n1 = map.get(s1); ! Area n2 = map.get(s2); Opening o1 = new Opening(); openingId++; *************** *** 1583,1586 **** --- 1585,1639 ---- } + + private void processBoundary(Area location) { + if (location.getChildren().isEmpty()) { + // + } else { + double xmin = Double.POSITIVE_INFINITY; + double xmax = Double.NEGATIVE_INFINITY; + double ymin = Double.POSITIVE_INFINITY; + double ymax = Double.NEGATIVE_INFINITY; + + LinkedList<Boundary> internals = new LinkedList(); + for (Area current : location.getChildren()) { + processBoundary(current); + internals.add(current.getExternalBoundary()); + } + LinkedList<Point2d> points = new LinkedList(); + for (Boundary boundary : internals) { + points.addAll(boundary.getPoints()); + } + for (Point2d current : points) { + if (current.getX() < xmin) { + xmin = current.getX(); + } + if (current.getX() > xmax) { + xmax = current.getX(); + } + if (current.getY() < ymin) { + ymin = current.getY(); + } + if (current.getY() > ymax) { + ymax = current.getY(); + } + } + Point2d p1 = new Point2d(xmin, ymin); + Point2d p2 = new Point2d(xmin, ymax); + Point2d p3 = new Point2d(xmax, ymax); + Point2d p4 = new Point2d(xmax, ymin); + Segment s1 = new Segment(p1, p2); + Segment s2 = new Segment(p2, p3); + Segment s3 = new Segment(p3, p4); + Segment s4 = new Segment(p4, p1); + Boundary external = new Boundary(); + external.add(s1); + external.add(s2); + external.add(s3); + external.add(s4); + location.setExternalBoundary(external); + + } + } + /** * *************** *** 1589,1594 **** public void exportPPLM(OutputStream out) { world().setName(getName()); ! List<Location> roots = createLocationModel(world(), 1, new HashMap(), new HashMap()); ! Location root = roots.get(0); LocationModel model = new LocationModel(); model.setLocation(root); --- 1642,1651 ---- public void exportPPLM(OutputStream out) { world().setName(getName()); ! List<Area> roots = createLocationModel(world(), 1, new HashMap(), new HashMap()); ! Area root = roots.get(0); ! ! processBoundary(root); ! ! LocationModel model = new LocationModel(); model.setLocation(root); *************** *** 1658,1670 **** */ public void exportJLMA() { ! Location root = createFlatLocationModel(); PrintStream out = System.out; out.println("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"); out.println("<GST>"); out.println("<GSTNode name=\"bygning\">"); ! for (Location node : root.getChildren()) { out.println("<GSTNode name =\"" + node.getId() + "\">"); out.println("<Area>"); ! for (dk.au.perpos.spatialsupport.routefinding.Point point : node.getExternalBoundary().getPoints()) { out.println("<Point2D x=\"" + point.getX() + "\" y=\"" + point.getY() + "\" />"); --- 1715,1727 ---- */ public void exportJLMA() { ! Area root = createFlatLocationModel(); PrintStream out = System.out; out.println("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"); out.println("<GST>"); out.println("<GSTNode name=\"bygning\">"); ! for (Area node : root.getChildren()) { out.println("<GSTNode name =\"" + node.getId() + "\">"); out.println("<Area>"); ! for (Point2d point : node.getExternalBoundary().getPoints()) { out.println("<Point2D x=\"" + point.getX() + "\" y=\"" + point.getY() + "\" />"); Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** Camera.java 5 Feb 2008 14:21:08 -0000 1.58 --- Camera.java 25 Jun 2009 20:29:33 -0000 1.59 *************** *** 69,73 **** /** The ralation between cm and inches */ ! private static final double RELATION = 2.54; /** Hidden geometrics */ --- 69,73 ---- /** The ralation between cm and inches */ ! public static final double RELATION = 2.54; /** Hidden geometrics */ Index: Selector.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Selector.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Selector.java 31 Aug 2007 09:09:09 -0000 1.4 --- Selector.java 25 Jun 2009 20:29:33 -0000 1.5 *************** *** 10,15 **** import java.util.List; - import org.apache.log4j.Logger; - /** * A list of possible values for an attribute. --- 10,13 ---- *************** *** 18,24 **** public class Selector<Type> { - /** The logger */ - private static Logger log = Logger.getLogger(Selector.class); - /** The options to choose from */ private List<Type> options; --- 16,19 ---- Index: Persistence.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Persistence.java,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** Persistence.java 22 Jun 2009 12:39:16 -0000 1.78 --- Persistence.java 25 Jun 2009 20:29:33 -0000 1.79 *************** *** 442,445 **** --- 442,446 ---- * @return the new model object */ + @SuppressWarnings("unused") private static Transform internalizeTransformation(TransformType current, Collection xmls) { if (current instanceof RotateType) { *************** *** 1131,1134 **** --- 1132,1136 ---- * @return the xml object */ + @SuppressWarnings("unused") private static Object externalizeTransformation(Transform current, Map map) { if (current instanceof Rotate) { Index: SurfaceSorter.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SurfaceSorter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SurfaceSorter.java 7 May 2007 09:48:44 -0000 1.2 --- SurfaceSorter.java 25 Jun 2009 20:29:33 -0000 1.3 *************** *** 13,17 **** */ public class SurfaceSorter<T extends Surface> extends Sorter<T> { - private Edge edge; /** --- 13,16 ---- *************** *** 19,23 **** */ public SurfaceSorter(Edge edge) { ! this.edge = edge; } --- 18,22 ---- */ public SurfaceSorter(Edge edge) { ! } *************** *** 25,30 **** @Override public Entry entryFor(T surface) { - Vertex normal = surface.normal(); - Vertex direction = edge.getDirection(); return new Entry(surface, 0 , 1); } --- 24,27 ---- Index: Selection.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Selection.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Selection.java 29 Aug 2008 12:27:32 -0000 1.19 --- Selection.java 25 Jun 2009 20:29:33 -0000 1.20 *************** *** 14,18 **** import java.util.List; import java.util.Set; - import org.apache.log4j.Logger; /** --- 14,17 ---- *************** *** 22,27 **** */ public class Selection implements Collection<Geometric> { - /** The logger */ - private static Logger log = Logger.getLogger(Selection.class); private static final boolean VERIFY = false; --- 21,24 ---- |