Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6024/src/net/sourceforge/bprocessor/model
Modified Files:
Command.java ParameterBlock.java
Log Message:
Edge Split implemented
AttributeView displays double values as their actual value Ð some kind of length value should be implemented to contain unit like mm.
Index: Command.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Command.java 20 Oct 2007 15:20:49 -0000 1.6
--- Command.java 20 Oct 2007 17:22:53 -0000 1.7
***************
*** 86,89 ****
--- 86,110 ----
return "Split Edge";
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public void evaluate() {
+ Edge edge = (Edge) parameters.get("edge");
+ int n = (int) (parameters.getDouble("n"));
+ Vertex from = edge.from;
+ Vertex to = edge.to;
+ Vertex v = to.minus(from);
+ double length = v.length();
+ double delta = length / n;
+ v.scale(delta / length);
+ Vertex current = from;
+ Space space = edge.getOwner();
+ for (int i = 1; i < n; i++) {
+ current = current.add(v);
+ space.insert(current);
+ }
+ Project.getInstance().changed(Project.getInstance());
+ }
}
Index: ParameterBlock.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ParameterBlock.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** ParameterBlock.java 19 Oct 2007 12:11:34 -0000 1.10
--- ParameterBlock.java 20 Oct 2007 17:22:53 -0000 1.11
***************
*** 91,94 ****
--- 91,108 ----
/**
*
+ * @param key String
+ * @return value
+ */
+ public Object get(String key) {
+ for (Attribute current : parameters) {
+ if (current.getName().equals(key)) {
+ return current.getValue();
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
* @param attribute Attribute
*/
|