Update of /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9505/src/net/sourceforge/bprocessor/facade/modellor
Modified Files:
NetFacadeModellor.java
Log Message:
checkstyle fixes
Index: NetFacadeModellor.java
===================================================================
RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/NetFacadeModellor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** NetFacadeModellor.java 28 Nov 2006 16:18:18 -0000 1.1
--- NetFacadeModellor.java 28 Nov 2006 17:23:14 -0000 1.2
***************
*** 16,19 ****
--- 16,21 ----
import net.sourceforge.bprocessor.model.Attribute;
+ import net.sourceforge.bprocessor.model.Edge;
+ import net.sourceforge.bprocessor.model.Geometry;
import net.sourceforge.bprocessor.model.Net;
import net.sourceforge.bprocessor.model.Project;
***************
*** 35,38 ****
--- 37,43 ----
private Space space;
+ /** The frame space */
+ private Space frame;
+
/** The net for this facade */
private Net net;
***************
*** 121,124 ****
--- 126,130 ----
/**
* Get the attributes of this modellor
+ * @return the attributes
*/
public List getAttributes() {
***************
*** 132,135 ****
--- 138,142 ----
/**
* Set the attributes of the modellor
+ * @param attributes the new attributes
*/
public void setAttributes(List attributes) {
***************
*** 137,143 ****
while (it.hasNext()) {
Attribute att = (Attribute)it.next();
! if (att.getName() == "Net") {
setNet((Space)att.getValue());
! } else if(att.getName() == "Framewidth") {
setFrameWidth(((Double)att.getValue()).doubleValue());
}
--- 144,150 ----
while (it.hasNext()) {
Attribute att = (Attribute)it.next();
! if (att.getName().equals("Net")) {
setNet((Space)att.getValue());
! } else if (att.getName().equals("Framewidth")) {
setFrameWidth(((Double)att.getValue()).doubleValue());
}
***************
*** 204,210 ****
*/
private void regenerate() {
! space.setVertices(new HashMap());
! space.setEdges(new HashMap());
! space.setSurfaces(new HashMap());
createFacade(net);
}
--- 211,215 ----
*/
private void regenerate() {
!
createFacade(net);
}
***************
*** 215,218 ****
--- 220,228 ----
*/
private void createFacade(Net net) {
+ if (frame == null) {
+ frame = new Space("Frame", Space.CONSTRUCTION,
+ Space.ELEMENT_LEVEL, true);
+ space.add(frame);
+ }
if (net != null) {
Iterator fields = net.getSurfaces().iterator();
***************
*** 220,225 ****
Surface field = (Surface)fields.next();
Surface fcopy = field.copyall(space);
Set sides = new HashSet();
! fcopy.extrude(depth, sides);
}
}
--- 230,246 ----
Surface field = (Surface)fields.next();
Surface fcopy = field.copyall(space);
+ Surface h = null;
+ Iterator edge = fcopy.getEdges().iterator();
+ if (edge.hasNext()) {
+ Edge e = (Edge)edge.next();
+ h = new Surface(e.offset(fcopy.getEdges(), fcopy, -frameWidth));
+ space.insert(h);
+ Geometry.holeAnalysis(h);
+ }
+ assignSame(front, fcopy, space, frame);
Set sides = new HashSet();
! extrudeIntoSpace(fcopy, depth, sides);
! sides = new HashSet();
! Geometry.holeAnalysis(extrudeIntoSpace(h, depth, sides));
}
}
***************
*** 254,256 ****
--- 275,319 ----
this.front = front;
}
+
+ /**
+ * Makes sure to extrude the a surface to the right side
+ * (towards the space of this modellor).
+ * @param s the surface
+ * @param delta the length to extrude
+ * @param sides this set will hold the sides of the extrusion
+ * @return the top surface of the extrusion
+ */
+ private Surface extrudeIntoSpace(Surface s, double delta, Set sides) {
+ int deltaCorrection = 1;
+ if (s.normal().dot(front.normal()) < 0) {
+ deltaCorrection *= -1;
+ }
+ if (front.getFrontDomain() != space) {
+ deltaCorrection *= -1;
+ }
+ return s.extrude(delta * deltaCorrection, sides);
+ }
+
+ /**
+ * Assign space sp2 to the same 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 assignSame(Surface s1, Surface s2, Space sp1, Space sp2) {
+ if (s1.getFrontDomain() == sp1) {
+ if (s1.normal().dot(s2.normal()) > 0) {
+ s2.setFrontDomain(sp2);
+ } else {
+ s2.setBackDomain(sp2);
+ }
+ } else if (s1.getBackDomain() == sp1) {
+ if (s1.normal().dot(s2.normal()) > 0) {
+ s2.setBackDomain(sp2);
+ } else {
+ s2.setFrontDomain(sp2);
+ }
+ }
+ }
}
|