Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20484/src/net/sourceforge/bprocessor/gl/model
Modified Files:
SelectionPath.java
Log Message:
Made recursive inference of intersection on instances with instances...
Index: SelectionPath.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model/SelectionPath.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SelectionPath.java 7 Dec 2007 14:38:54 -0000 1.1
--- SelectionPath.java 12 Dec 2007 12:56:09 -0000 1.2
***************
*** 7,13 ****
--- 7,20 ----
package net.sourceforge.bprocessor.gl.model;
+ import java.util.Collections;
+ import java.util.HashMap;
import java.util.List;
import java.util.LinkedList;
+ import java.util.Set;
+
+ import net.sourceforge.bprocessor.model.CoordinateSystem;
import net.sourceforge.bprocessor.model.Geometric;
+ import net.sourceforge.bprocessor.model.Space;
+ import net.sourceforge.bprocessor.model.Vertex;
/**
***************
*** 79,81 ****
--- 86,123 ----
return path.size();
}
+
+ /**
+ * Translate a geometric out of the selected path
+ * @param geometric The geometric to untranslate
+ * @return The unTranslated geometric
+ */
+ public Geometric translateOut(Geometric geometric) {
+ List<Geometric> reversed = new LinkedList<Geometric>(path);
+ Collections.reverse(reversed);
+ Geometric untranslated = geometric.copy(new HashMap());
+ Set<Vertex> vertices = untranslated.collect();
+ for (Geometric current : reversed) {
+ if (current instanceof Space) {
+ CoordinateSystem cs = ((Space)current).getInstanceAnchor();
+ cs.unTranslateIt(vertices);
+ }
+ }
+ return untranslated;
+ }
+
+ /**
+ * Translate a geometric into the selected path
+ * @param geometric The geometric to translate
+ * @return The translated geometric
+ */
+ public Geometric translateIn(Geometric geometric) {
+ Geometric translated = geometric;
+ for (Geometric current : path) {
+ if (current instanceof Space) {
+ CoordinateSystem cs = ((Space)current).getInstanceAnchor();
+ cs.translateIt(geometric.collect());
+ }
+ }
+ return translated;
+ }
}
|