Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24034/src/net/sourceforge/bprocessor/model
Modified Files:
Relation.java CoordinateSystem.java
Log Message:
Implemented a "Relate" command that creates a relation between a new coordinate-system and the selected objects.
Changed alt-move to also be able to move a coordinate-system
Index: CoordinateSystem.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** CoordinateSystem.java 4 Mar 2007 23:14:45 -0000 1.34
--- CoordinateSystem.java 6 Mar 2007 10:41:24 -0000 1.35
***************
*** 40,43 ****
--- 40,69 ----
/**
+ * Create a CoordinateSystem related to the give geometric objects.
+ * @param geometrics Collection of geometric objects.
+ */
+ public static void relate(Collection<Geometric> geometrics) {
+ if (geometrics.size() > 0) {
+ Geometric leader = geometrics.iterator().next();
+ if (leader instanceof Surface) {
+ Surface surface = (Surface) leader;
+ CoordinateSystem system = surface.coordinateSystem();
+ system.setOrigin(system.getOrigin().copy());
+ for (Geometric geometric : geometrics) {
+ if (geometric instanceof Surface) {
+ Surface current = (Surface) geometric;
+ Vertex origin = current.getFirstVertex();
+ double distance = system.plane().distance(origin);
+ Relation relation = new Relation(current, String.valueOf(distance));
+ system.add(relation);
+ }
+ }
+ Project.getInstance().world().add(system);
+ Project.getInstance().changed(Project.getInstance().world());
+ }
+ }
+ }
+
+ /**
* Empty constructor for persistence only
*/
Index: Relation.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Relation.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Relation.java 4 Mar 2007 23:14:45 -0000 1.1
--- Relation.java 6 Mar 2007 10:41:24 -0000 1.2
***************
*** 37,40 ****
--- 37,49 ----
/** {@inheritDoc} */
+ public String getName() {
+ if (id != null) {
+ return "Relation " + id;
+ } else {
+ return "Relation";
+ }
+ };
+
+ /** {@inheritDoc} */
public String getGeneralName() {
return "Relation";
|