[Bprocessor-commit] facade/src/net/sourceforge/bprocessor/facade/modellor FacadeModellor.java, 1.1
Status: Pre-Alpha
Brought to you by:
henryml
From: Nordholt <nor...@us...> - 2006-08-15 08:35:06
|
Update of /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11897/src/net/sourceforge/bprocessor/facade/modellor Modified Files: FacadeModellor.java Log Message: some work on the facade modellor Index: FacadeModellor.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/FacadeModellor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FacadeModellor.java 11 Aug 2006 11:44:37 -0000 1.1 --- FacadeModellor.java 15 Aug 2006 08:35:01 -0000 1.2 *************** *** 9,12 **** --- 9,13 ---- import java.util.List; import java.util.LinkedList; + import java.util.Iterator; import net.sourceforge.bprocessor.model.modellor.Modellor; *************** *** 14,17 **** --- 15,21 ---- import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Surface; + import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Vertex; + import net.sourceforge.bprocessor.model.Edge; import org.apache.log4j.Logger; *************** *** 48,53 **** private Surface front; - - /** The empty constructor */ public FacadeModellor() { --- 52,55 ---- *************** *** 61,64 **** --- 63,70 ---- this.space = s; this.name = "Facade Modellor"; + Iterator it = space.getEnvelope().iterator(); + if (it.hasNext()) { + front = (Surface)it.next(); + } } *************** *** 77,80 **** --- 83,106 ---- */ public void update(Object entity) { + if (this.front != null) { + List edges = this.front.getEdges(); + if (edges.size() == 4) { + Iterator it = edges.iterator(); + Edge vertEdge = null; + Edge horEdge = null; + while (it.hasNext() && + vertEdge == null && + horEdge == null) { + Edge e = (Edge)it.next(); + if (Math.abs(e.getDirection().dot(new Vertex(0, 0, 1))) < 0.0001) { + horEdge = e; + } else if (Math.abs(e.getDirection().dot(new Vertex(1, 0, 0))) < 0.0001 && + Math.abs(e.getDirection().dot(new Vertex(0, 1, 0))) < 0.0001) { + vertEdge = e; + } + } + + } + } } *************** *** 84,92 **** */ public void setAttributes(List attributes) { ! } /** ! * Return a list of the attributes in the object * @return the list of attributes for the object */ --- 110,135 ---- */ public void setAttributes(List attributes) { ! Iterator it = attributes.iterator(); ! while (it.hasNext()) { ! Attribute a = (Attribute)it.next(); ! if (a.getName().equals("Name")) { ! name = (String)a.getValue(); ! } else if (a.getName().equals("Front")) { ! front = (Surface)a.getValue(); ! } else if (a.getName().equals("V-posts")) { ! vertPosts = ((Double)a.getValue()).intValue(); ! } else if (a.getName().equals("H-posts")) { ! horPosts = ((Double)a.getValue()).intValue(); ! } else if (a.getName().equals("V-postwidth")) { ! vertPostWidth = ((Double)a.getValue()).doubleValue(); ! } else if (a.getName().equals("H-postwidth")) { ! horPostWidth = ((Double)a.getValue()).doubleValue(); ! } ! } ! Project.getInstance().changed(space); } /** ! * Retrn a list of the attributes in the object * @return the list of attributes for the object */ *************** *** 94,100 **** LinkedList attributes = new LinkedList(); attributes.add(new Attribute("Name", name)); ! Attribute a = new Attribute("V-posts", new Double(vertPosts)); ! a.setPrecision(1); ! attributes.add(a); attributes.add(new Attribute("H-posts", new Double(horPosts))); attributes.add(new Attribute("V-postwidth", new Double(vertPostWidth))); --- 137,142 ---- LinkedList attributes = new LinkedList(); attributes.add(new Attribute("Name", name)); ! attributes.add(new Attribute("Front", front, true)); ! attributes.add(new Attribute("V-posts", new Double(vertPosts))); attributes.add(new Attribute("H-posts", new Double(horPosts))); attributes.add(new Attribute("V-postwidth", new Double(vertPostWidth))); |