Update of /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8280/src/net/sourceforge/bprocessor/facade/modellor
Modified Files:
FacadeModellor.java
Log Message:
blabla
Index: FacadeModellor.java
===================================================================
RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/FacadeModellor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FacadeModellor.java 15 Aug 2006 08:35:01 -0000 1.2
--- FacadeModellor.java 16 Aug 2006 09:32:31 -0000 1.3
***************
*** 9,12 ****
--- 9,14 ----
import java.util.List;
import java.util.LinkedList;
+ import java.util.Set;
+ import java.util.HashSet;
import java.util.Iterator;
***************
*** 18,21 ****
--- 20,25 ----
import net.sourceforge.bprocessor.model.Vertex;
import net.sourceforge.bprocessor.model.Edge;
+ import net.sourceforge.bprocessor.model.Line;
+ import net.sourceforge.bprocessor.model.Constructor;
import org.apache.log4j.Logger;
***************
*** 35,42 ****
/** Number of vertical posts */
! private int vertPosts;
/** Number of horizontal posts */
! private int horPosts;
/** Default vertical post width */
--- 39,46 ----
/** Number of vertical posts */
! private int vertPosts = -1;
/** Number of horizontal posts */
! private int horPosts = -1;
/** Default vertical post width */
***************
*** 52,56 ****
private Surface front;
! /** The empty constructor */
public FacadeModellor() {
this.name = "Facade Modellor";
--- 56,66 ----
private Surface front;
! /** The set of vertical constructor lines */
! private Set vertCons = new HashSet();
!
! /** The set of horizontal constructor lines */
! private Set horCons = new HashSet();
!
! /** The constructor */
public FacadeModellor() {
this.name = "Facade Modellor";
***************
*** 61,64 ****
--- 71,75 ----
*/
public FacadeModellor(Space s) {
+ Project.getInstance().addObserver(this);
this.space = s;
this.name = "Facade Modellor";
***************
*** 90,95 ****
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) {
--- 101,106 ----
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) {
***************
*** 100,105 ****
}
}
!
! }
}
}
--- 111,156 ----
}
}
! if (horEdge != null && vertEdge != null) {
! Vertex cross;
! if (horEdge.contains(vertEdge.getFrom())) {
! cross = vertEdge.getFrom();
! } else {
! cross = vertEdge.getTo();
! }
! Vertex horDir = horEdge.otherVertex(cross).minus(cross);
! Vertex vertDir = vertEdge.otherVertex(cross).minus(cross);
! removeConstructors(vertCons);
! removeConstructors(horCons);
! vertCons = new HashSet();
! horCons = new HashSet();
! double interval = horEdge.getLength() / (vertPosts + 1);
! for (int i = 1; i < vertPosts + 1; i++) {
! Vertex offset = horDir.copy();
! offset.scale((interval * i) / offset.length());
! Line l = new Line(cross.add(offset), vertDir.copy(), true);
! vertCons.add(l);
! space.add(l);
! }
! interval = vertEdge.getLength() / (horPosts + 1);
! for (int i = 1; i < horPosts + 1; i++) {
! Vertex offset = vertDir.copy();
! offset.scale((interval * i) / offset.length());
! Line l = new Line(cross.add(offset), horDir.copy(), true);
! horCons.add(l);
! space.add(l);
! }
! }
! }
! }
! }
!
!
! /** Removes a set of constructors from the facade
! * @param cons the constructors
! */
! private void removeConstructors(Set cons) {
! Iterator it = cons.iterator();
! while (it.hasNext()) {
! space.remove((Constructor)it.next());
}
}
|