[Bprocessor-commit] facade/src/net/sourceforge/bprocessor/facade/modellor NetFacadeModellor.java,
Status: Pre-Alpha
Brought to you by:
henryml
|
From: Nordholt <nor...@us...> - 2007-01-30 16:19:13
|
Update of /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15659/src/net/sourceforge/bprocessor/facade/modellor Modified Files: NetFacadeModellor.java Log Message: made the windows and doors more detailed. Made it possiple to change the front surface. Index: NetFacadeModellor.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/NetFacadeModellor.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** NetFacadeModellor.java 29 Jan 2007 18:12:12 -0000 1.10 --- NetFacadeModellor.java 30 Jan 2007 16:18:57 -0000 1.11 *************** *** 48,52 **** /** The framewidth of the facade */ ! private double frameWidth = 0.1; /** The depth of the facade */ --- 48,52 ---- /** The framewidth of the facade */ ! private double frameWidth = 0.045; /** The depth of the facade */ *************** *** 216,219 **** --- 216,222 ---- */ public void setNet(Space net) { + if (this.net != null) { + space.remove(net); + } this.net = (Net)net; space.add(net); *************** *** 326,332 **** if (frame == null) { frame = new Space("Frame", ! Space.CONSTRUCTION, ! Space.ELEMENT_LEVEL, ! true); space.add(frame); } --- 329,335 ---- if (frame == null) { frame = new Space("Frame", ! Space.CONSTRUCTION, ! Space.ELEMENT_LEVEL, ! true); space.add(frame); } *************** *** 352,370 **** Iterator fieldEdges = field.getEdges().iterator(); Map envF = field.getParameters().environment(); ! Double extraFrame = 0.0; ! if (envF.get("type") instanceof Selector) { ! Selector sel = (Selector)envF.get("type"); ! if (sel.getCurrentValue() == null) { ! log.info("current null...strange"); ! } else if (sel.getCurrentValue().equals("Empty")) { ! extraFrame = 0.0; ! } else if (sel.getCurrentValue().equals("Glass")) { ! extraFrame = 0.0; ! } else if (sel.getCurrentValue().equals("Window")) { ! extraFrame = 0.05; ! } else if (sel.getCurrentValue().equals("Door")) { ! extraFrame = 0.12; ! } ! } while (fieldEdges.hasNext()) { Edge e = (Edge)fieldEdges.next(); --- 355,359 ---- Iterator fieldEdges = field.getEdges().iterator(); Map envF = field.getParameters().environment(); ! while (fieldEdges.hasNext()) { Edge e = (Edge)fieldEdges.next(); *************** *** 372,378 **** double width = ((Double)envE.get("width")).doubleValue(); if (outline.contains(e)) { ! offsetMap.put(e, Double.valueOf(-(width + extraFrame))); } else { ! offsetMap.put(e, Double.valueOf(-((width / 2) + extraFrame))); } } --- 361,367 ---- double width = ((Double)envE.get("width")).doubleValue(); if (outline.contains(e)) { ! offsetMap.put(e, Double.valueOf(-(width))); } else { ! offsetMap.put(e, Double.valueOf(-((width / 2)))); } } *************** *** 382,385 **** --- 371,431 ---- Set sides2 = new HashSet(); Geometry.holeAnalysis(space.insert(extrudeIntoSpace(hole, depth, sides2))); + Double extraFrame = 0.0; + if (envF.get("type") instanceof Selector) { + Selector sel = (Selector)envF.get("type"); + if (sel.getCurrentValue().equals("Empty")) { + extraFrame = 0.0; + } else if (sel.getCurrentValue().equals("Glass")) { + extraFrame = 0.0; + } else if (sel.getCurrentValue().equals("Window")) { + extraFrame = 0.05; + } else if (sel.getCurrentValue().equals("Door")) { + extraFrame = 0.12; + } + } + if (extraFrame > 0) { + Map offmap1 = new HashMap<Edge, Double>(); + Map offmap2 = new HashMap<Edge, Double>(); + for (Object o: hole.getEdges()) { + Edge e = (Edge)o; + offmap1.put(e, 0.02); + offmap2.put(e, -(extraFrame - 0.02)); + } + Surface in = new Surface(Edge.placeOffset(hole.getEdges(), hole, offmap1)); + Surface out = new Surface(Edge.placeOffset(hole.getEdges(), hole, offmap2)); + hole.getExterior().removeHole(hole); + pushIntoSpace(hole, 0.05); + Geometry.holeAnalysis(hole); + in = space.insert(in); + out = space.insert(out); + + Space wf = new Space("Window Frame", + Space.CONSTRUCTION, + Space.ELEMENT_LEVEL, + true); + Space g = new Space("Glass", + Space.CONSTRUCTION, + Space.ELEMENT_LEVEL, + true); + g.setTransparent(true); + space.add(g); + space.add(wf); + assignSame(front, in, space, wf); + assignSame(front, out, space, g); + + Set sides = new HashSet(); + Surface inEx = extrudeIntoSpace(in, 0.05, sides); + assignSame(front, inEx, space, frame); + space.add(inEx); + assignSame(front, inEx, space, frame); + Geometry.holeAnalysis(inEx); + sides = new HashSet(); + Surface outEx = extrudeIntoSpace(out, 0.05, sides); + outEx = space.insert(outEx); + assignOpposite(front, outEx, space, g); + assignOpposite(front, hole, space, wf); + Geometry.holeAnalysis(outEx); + Geometry.holeAnalysis(hole); + } } } *************** *** 494,497 **** --- 540,561 ---- /** + * Pushes a surface into the space of the modellor by some length + * along the surface normal + * @param s the surface to push + * @param delta the lenght to push + */ + private void pushIntoSpace(Surface s, double delta) { + int deltaCorrection = 1; + if (s.normal().dot(front.normal()) < 0) { + deltaCorrection *= -1; + } + if (front.getFrontDomain() != space) { + deltaCorrection *= -1; + } + Vertex n = s.normal().copy(delta*deltaCorrection); + s.move(n.getX(), n.getY(), n.getZ()); + } + + /** * Assign space sp2 to the same side of s2 as space sp1 is assigned to s1 * @param s1 first surface *************** *** 515,518 **** --- 579,602 ---- } } + + /** + * Assign space sp2 to the opposite side of s2 as space sp1 is assigned to s1 + * @param s1 first surface + * @param s2 second surface + * @param sp1 first space + * @param sp2 second space + */ + private void assignOpposite(Surface s1, Surface s2, Space sp1, Space sp2) { + Space back = s2.getBackDomain(); + Space front = s2.getFrontDomain(); + assignSame(s1, s2, sp1, sp2); + if (s2.getBackDomain() == sp2) { + s2.setBackDomain(back); + s2.setFrontDomain(sp2); + } else { + s2.setFrontDomain(front); + s2.setBackDomain(sp2); + } + } /** |