[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Line.java, 1.23, 1.24 Point.java, 1.
Status: Pre-Alpha
Brought to you by:
henryml
From: Nordholt <nor...@us...> - 2006-09-08 13:26:12
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25311/src/net/sourceforge/bprocessor/model Modified Files: Line.java Point.java CoordinateSystem.java Constructor.java Log Message: Added the ability to connect geometric objects to a constructor and thus making them move with the constructor. Index: Point.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Point.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Point.java 5 Sep 2006 11:01:37 -0000 1.8 --- Point.java 8 Sep 2006 13:25:59 -0000 1.9 *************** *** 9,15 **** import java.util.ArrayList; import java.util.Collection; - import java.util.HashSet; import java.util.List; - import java.util.Set; /** --- 9,13 ---- *************** *** 33,43 **** } - /** - * @see net.sourceforge.bprocessor.model.Constructor#move(double, double, double) - */ - public void move(double x, double y, double z) { - getOrigin().move(x, y, z); - } - /** @see net.sourceforge.bprocessor.model.Geometric#move(double, double, double) */ public Vertex canMove(double x, double y, double z, Collection entities) { --- 31,34 ---- *************** *** 47,60 **** /** - * Collects the set of vertices in this geometric - * @return the set of vertices - */ - public Set collect() { - Set res = new HashSet(); - res.add(getOrigin()); - return res; - } - - /** * Return the center for the entity * @return The center as a vertex --- 38,41 ---- Index: Constructor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Constructor.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Constructor.java 5 Sep 2006 11:01:37 -0000 1.10 --- Constructor.java 8 Sep 2006 13:25:59 -0000 1.11 *************** *** 8,15 **** --- 8,19 ---- import java.util.Collection; + import java.util.HashSet; + import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Set; + import org.apache.log4j.Logger; + /** * The superclass for constructors *************** *** 17,20 **** --- 21,28 ---- */ public abstract class Constructor extends Geometric implements Parametric { + + /** The logger */ + private static Logger log = Logger.getLogger(Constructor.class); + /** The origin of the constructor */ private Vertex origin; *************** *** 25,29 **** /** Specify wether the constructor is changable */ private boolean editable; ! /** * Do not use, for persistence use only --- 33,39 ---- /** Specify wether the constructor is changable */ private boolean editable; ! ! /** Set of geometrics connected to this constructor */ ! private Set connectedGeometry = new HashSet(); /** * Do not use, for persistence use only *************** *** 96,100 **** * @see net.sourceforge.bprocessor.model.Geometric#collect() */ ! public abstract Set collect(); /** --- 106,118 ---- * @see net.sourceforge.bprocessor.model.Geometric#collect() */ ! public Set collect() { ! Set res = new HashSet(); ! res.add(getOrigin()); ! Iterator it = connectedGeometry.iterator(); ! while (it.hasNext()) { ! res.addAll(((Geometric)it.next()).collect()); ! } ! return res; ! } /** *************** *** 123,134 **** /** - * Move the constructor - * @param x the movement in x - * @param y the movement in y - * @param z the movement in z - */ - public abstract void move(double x, double y, double z); - - /** * @param dist dist * @return list of handles --- 141,144 ---- *************** *** 139,142 **** --- 149,195 ---- /** + * Connects pieces of geometry to this constructor + * @param s a set of geometrics + */ + public void connect(Set s) { + connectedGeometry.addAll(s); + } + + /** + * Connects a piece of geometry to this constructor + * @param g a geometric + */ + public void connect(Geometric g) { + log.info("connected: " + g + " to: " + this); + connectedGeometry.add(g); + } + + + + /** + * disconnects a pieces of geometry to this constructor + * @param s a set of geometrics + */ + public void disconnect(Set s) { + connectedGeometry.removeAll(s); + } + + /** + * Gets the connected geometry + * @return all connected geometry + */ + public Set getConnectedGeometry() { + return connectedGeometry; + } + + /** @see net.sourceforge.bprocessor.model.Geometric#move(double, double, double) */ + public void move(double x, double y, double z) { + Iterator it = collect().iterator(); + while (it.hasNext()) { + ((Geometric)it.next()).move(x, y, z); + } + } + + /** * Handle */ Index: CoordinateSystem.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** CoordinateSystem.java 5 Sep 2006 11:01:37 -0000 1.26 --- CoordinateSystem.java 8 Sep 2006 13:25:59 -0000 1.27 *************** *** 10,18 **** import java.util.ArrayList; import java.util.Collection; - import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; - import java.util.Set; /** --- 10,16 ---- *************** *** 27,30 **** --- 25,33 ---- public class CoordinateSystem extends Constructor { + /** + * + */ + private static final long serialVersionUID = 1L; + /** The i unit vector (x-direction) */ protected Vertex i; *************** *** 77,87 **** } - /** - * @see net.sourceforge.bprocessor.model.Constructor#move(double, double, double) - */ - public void move(double x, double y, double z) { - getOrigin().move(x, y, z); - } - /** @see net.sourceforge.bprocessor.model.Geometric#move(double, double, double) */ public Vertex canMove(double x, double y, double z, Collection entities) { --- 80,83 ---- *************** *** 303,316 **** } ! /** ! * @see net.sourceforge.bprocessor.model.Geometric#collect() ! */ ! public Set collect() { ! HashSet res = new HashSet(); ! res.add(getOrigin()); ! return res; ! } ! ! /** * @see net.sourceforge.bprocessor.model.Entity#center() */ --- 299,303 ---- } ! /** * @see net.sourceforge.bprocessor.model.Entity#center() */ Index: Line.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Line.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Line.java 5 Sep 2006 13:52:46 -0000 1.23 --- Line.java 8 Sep 2006 13:25:59 -0000 1.24 *************** *** 9,16 **** import java.util.ArrayList; import java.util.Collection; - import java.util.HashSet; import java.util.LinkedList; import java.util.List; - import java.util.Set; import org.apache.log4j.Logger; --- 9,14 ---- *************** *** 106,119 **** /** - * Collects the set of vertices in this geometric - * @return the set of vertices - */ - public Set collect() { - HashSet res = new HashSet(); - res.add(getOrigin()); - return res; - } - - /** * Return the center for the entity * @return The center as a vertex --- 104,107 ---- *************** *** 401,409 **** /** @see net.sourceforge.bprocessor.model.Geometric#move(double, double, double) */ - public void move(double x, double y, double z) { - getOrigin().move(x, y, z); - } - - /** @see net.sourceforge.bprocessor.model.Geometric#move(double, double, double) */ public Vertex canMove(double x, double y, double z, Collection entities) { // TODO Think it through --- 389,392 ---- |