[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model/modellor Box.java, 1.1, 1.2
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-06-19 12:01:26
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9145/src/net/sourceforge/bprocessor/model/modellor Modified Files: Box.java Log Message: Simple box modellor implemented Index: Box.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/Box.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Box.java 18 Jun 2007 13:22:01 -0000 1.1 --- Box.java 19 Jun 2007 12:01:19 -0000 1.2 *************** *** 8,17 **** --- 8,22 ---- package net.sourceforge.bprocessor.model.modellor; + import java.util.Collection; + import java.util.LinkedList; import java.util.List; import java.util.Map; import net.sourceforge.bprocessor.model.Attribute; + import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Space; + import net.sourceforge.bprocessor.model.Surface; + import net.sourceforge.bprocessor.model.Vertex; /** *************** *** 23,26 **** --- 28,36 ---- private Space space; + private double width; + private double height; + private double depth; + + /** * *************** *** 39,42 **** --- 49,55 ---- space = new Space("Interior", Space.CONSTRUCTION, Space.SPACE_LEVEL, true); union.add(space); + width = 1.0; + height = 1.0; + depth = 1.0; } *************** *** 44,49 **** @Override public void getAttributes(List<Attribute> attributes) { ! // TODO Auto-generated method stub ! } --- 57,63 ---- @Override public void getAttributes(List<Attribute> attributes) { ! attributes.add(new Attribute("width", Double.valueOf(width), true)); ! attributes.add(new Attribute("height", Double.valueOf(height), true)); ! attributes.add(new Attribute("depth", Double.valueOf(depth), true)); } *************** *** 51,55 **** @Override public void getSubContent(Map<String, Object> map) { ! // TODO Auto-generated method stub } --- 65,71 ---- @Override public void getSubContent(Map<String, Object> map) { ! map.put("width", Double.valueOf(width)); ! map.put("height", Double.valueOf(height)); ! map.put("depth", Double.valueOf(depth)); } *************** *** 71,76 **** @Override public void setAttributes(Map<String, Attribute> map) { ! // TODO Auto-generated method stub ! } --- 87,93 ---- @Override public void setAttributes(Map<String, Attribute> map) { ! width = ((Double) map.get("width").getValue()).doubleValue(); ! height = ((Double) map.get("height").getValue()).doubleValue(); ! depth = ((Double) map.get("depth").getValue()).doubleValue(); } *************** *** 78,83 **** @Override public void setSubContent(Map<String, Object> map) { ! // TODO Auto-generated method stub ! } --- 95,101 ---- @Override public void setSubContent(Map<String, Object> map) { ! width = ((Double) map.get("width")).doubleValue(); ! height = ((Double) map.get("height")).doubleValue(); ! depth = ((Double) map.get("depth")).doubleValue(); } *************** *** 86,89 **** --- 104,131 ---- public void update(Object entity) { System.out.println("update " + space); + union.clear(); + union.add(space); + Vertex v1 = new Vertex(0, 0, 0); + Vertex v2 = new Vertex(width, 0, 0); + Vertex v3 = new Vertex(width, height, 0); + Vertex v4 = new Vertex(0, height, 0); + Edge e1 = new Edge(v1, v2); + Edge e2 = new Edge(v2, v3); + Edge e3 = new Edge(v3, v4); + Edge e4 = new Edge(v4, v1); + List<Edge> edges = new LinkedList(); + edges.add(e1); + edges.add(e2); + edges.add(e3); + edges.add(e4); + Surface bottom = new Surface(edges); + bottom.setFrontDomain(space); + Collection<Surface> sides = new LinkedList(); + Surface top = bottom.extrusion(depth, sides); + for (Surface current : sides) { + union.insert(current); + } + union.insert(top); + union.insert(bottom); } |