[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Line.java, 1.13, 1.14 Geometric.java
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-07-23 09:17:42
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16633/src/net/sourceforge/bprocessor/model Modified Files: Line.java Geometric.java Point.java Project.java CoordinateSystem.java Log Message: Possible to draw in active plane Index: Geometric.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometric.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Geometric.java 18 Jul 2006 14:04:37 -0000 1.7 --- Geometric.java 23 Jul 2006 09:17:36 -0000 1.8 *************** *** 35,38 **** --- 35,47 ---- /** + * The parent is the by default the owning space. + * Can be overwritten to return something else. + * @return The parent + */ + public Geometric parent() { + return owner; + } + + /** * Get the name * @return The name Index: Point.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Point.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Point.java 21 Jul 2006 14:59:47 -0000 1.4 --- Point.java 23 Jul 2006 09:17:36 -0000 1.5 *************** *** 74,78 **** */ public String getGeneralName() { ! return "Constructor-Point"; } } --- 74,78 ---- */ public String getGeneralName() { ! return "Point"; } } Index: CoordinateSystem.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** CoordinateSystem.java 21 Jul 2006 14:59:47 -0000 1.16 --- CoordinateSystem.java 23 Jul 2006 09:17:36 -0000 1.17 *************** *** 11,14 **** --- 11,15 ---- import java.util.HashSet; import java.util.Iterator; + import java.util.LinkedList; import java.util.List; import java.util.Set; *************** *** 250,262 **** */ public void setAttributes(List attributes) { ! // TODO Auto-generated method stub } ! /** * @see net.sourceforge.bprocessor.model.Parametric#getAttributes() */ public List getAttributes() { - // TODO Auto-generated method stub ArrayList res = new ArrayList(); return res; } --- 251,277 ---- */ public void setAttributes(List attributes) { ! Vertex orig = new Vertex(0, 0, 0); ! ! orig.setX(((Double)(((Attribute)attributes.get(1)).getValue())).doubleValue()); ! orig.setY(((Double)(((Attribute)attributes.get(2)).getValue())).doubleValue()); ! orig.setZ(((Double)(((Attribute)attributes.get(3)).getValue())).doubleValue()); ! setOrigin(orig); ! setActive(((Boolean)(((Attribute)attributes.get(4)).getValue())).booleanValue()); } ! /** * @see net.sourceforge.bprocessor.model.Parametric#getAttributes() */ public List getAttributes() { ArrayList res = new ArrayList(); + res.add(new Attribute("name", "Origin", false)); + res.add(new Attribute("X", new Double(getOrigin().getX()))); + res.add(new Attribute("Y", new Double(getOrigin().getY()))); + res.add(new Attribute("Z", new Double(getOrigin().getZ()))); + if (isActive()) { + res.add(new Attribute("Active", Boolean.TRUE)); + } else { + res.add(new Attribute("Active", Boolean.FALSE)); + } return res; } *************** *** 266,270 **** */ public String getGeneralName() { ! return "Constructor-Coordinatesystem"; } --- 281,289 ---- */ public String getGeneralName() { ! if (onlyPlane()) { ! return "Plane"; ! } else { ! return "Coordinatesystem"; ! } } *************** *** 284,286 **** --- 303,333 ---- onlyPlane = what; } + + /** + * Surface + * @param size Size + * @return Surface + */ + public Surface surface(double size) { + Vertex origin = getOrigin(); + Vertex v = i.copy(); + Vertex u = j.copy(); + v.scale(size); + u.scale(size); + Vertex a = origin.add(u).minus(v); + Vertex b = origin.add(u).add(v); + Vertex c = origin.minus(u).add(v); + Vertex d = origin.minus(u).minus(v); + Edge e1 = new Edge(a, b); + Edge e2 = new Edge(b, c); + Edge e3 = new Edge(c, d); + Edge e4 = new Edge(d, a); + List edges = new LinkedList(); + edges.add(e1); + edges.add(e2); + edges.add(e3); + edges.add(e4); + Surface surface = new Surface(edges); + return surface; + } } Index: Line.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Line.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Line.java 21 Jul 2006 14:59:47 -0000 1.13 --- Line.java 23 Jul 2006 09:17:36 -0000 1.14 *************** *** 139,143 **** */ public String getGeneralName() { ! return "Constructor-Line"; } --- 139,143 ---- */ public String getGeneralName() { ! return "Line"; } *************** *** 185,188 **** --- 185,204 ---- /** + * Return an edge for this line + * @param length The the length + * @return Edge + */ + public Edge edge(double length) { + Vertex origin = getOrigin(); + Vertex direction = getDirection().copy(); + direction.scale(length); + Vertex from = origin.minus(direction); + Vertex to = origin.add(direction); + Edge constructor = new Guide(from, to); + constructor.setConstructor(true); + return constructor; + } + + /** * Vertex representing the tip of the vector defining this line */ *************** *** 205,208 **** --- 221,253 ---- setDirection(minus(getOrigin())); } + + /** + * Return the line + * @return parent + */ + public Geometric parent() { + return Line.this; + } + } + /** + * Guide + */ + private class Guide extends Edge { + /** + * Constructor + * @param from Vertex + * @param to Vertex + */ + public Guide(Vertex from, Vertex to) { + super(from, to); + } + + /** + * Parent + * @return This line + */ + public Geometric parent() { + return Line.this; + } } } Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** Project.java 21 Jul 2006 14:59:47 -0000 1.64 --- Project.java 23 Jul 2006 09:17:36 -0000 1.65 *************** *** 110,117 **** activeCoordinateSystem.setActive(true); world.add(activeCoordinateSystem); - - world.add(new Point(new Vertex(10, 10, 3))); - world.add(new Line(new Vertex(3, 3, 3), new Vertex(1, 1, 0), true)); - world.add(new Line(new Vertex(5, 0, 5), new Vertex(1, 0, 0), false)); constraints = new LinkedList(); globals = new ParameterBlock(); --- 110,113 ---- |