Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14673/src/net/sourceforge/bprocessor/model
Modified Files:
SpaceAnalysis.java Container.java
Log Message:
Work in progress
Index: SpaceAnalysis.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SpaceAnalysis.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** SpaceAnalysis.java 13 Oct 2008 10:54:13 -0000 1.13
--- SpaceAnalysis.java 16 Apr 2009 11:12:10 -0000 1.14
***************
*** 22,27 ****
! private static final int FORWARD = 1;
! private static final int BACKWARD = -1;
private Map<Edge, List<Surface>> edgemap;
--- 22,29 ----
! /** */
! public static final int FORWARD = 1;
! /** */
! public static final int BACKWARD = -1;
private Map<Edge, List<Surface>> edgemap;
***************
*** 29,33 ****
private Set<Surface> mark;
! private static int travel(Surface surface, Edge edge) {
Vertex vertex = surface.getFirstVertex();
for (Edge current : surface.getEdges()) {
--- 31,41 ----
private Set<Surface> mark;
! /**
! *
! * @param surface Surface
! * @param edge Edge
! * @return status
! */
! public static int travel(Surface surface, Edge edge) {
Vertex vertex = surface.getFirstVertex();
for (Edge current : surface.getEdges()) {
Index: Container.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Container.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** Container.java 31 Mar 2009 11:03:21 -0000 1.18
--- Container.java 16 Apr 2009 11:12:10 -0000 1.19
***************
*** 17,20 ****
--- 17,21 ----
import java.util.List;
import java.util.Map;
+ import java.util.Queue;
import java.util.Set;
***************
*** 1517,1519 ****
--- 1518,1568 ----
}
+ /**
+ *
+ * @param leader Surface
+ */
+ public void orient(Surface leader) {
+ List<Surface> envelope = new LinkedList(getEnvelope());
+ Command.Inverse inv = new Command.Inverse(envelope);
+ Set<Surface> mark = new HashSet();
+ Queue<Surface> queue = new LinkedList();
+ queue.add(leader);
+ mark.add(leader);
+ while (!queue.isEmpty()) {
+ Surface current = queue.remove();
+ for (Edge edge : current.getEdges()) {
+ List<Surface> lst = inv.surfaces(edge);
+ for (Surface adjacent : lst) {
+ if (!mark.contains(adjacent)) {
+ mark.add(adjacent);
+ queue.add(adjacent);
+ int lead = SpaceAnalysis.travel(current, edge);
+ int follow = SpaceAnalysis.travel(adjacent, edge);
+ if (lead == follow) {
+ adjacent.flip();
+ }
+ }
+ }
+ }
+ }
+
+ List<Surface> unreachable = new LinkedList();
+ for (Surface current : envelope) {
+ if (!mark.contains(current)) {
+ unreachable.add(current);
+ }
+ }
+
+ if (unreachable.isEmpty()) {
+ System.out.println("-- everything reachable --");
+ } else {
+ System.out.println("-- unreachable --");
+ for (Surface current : unreachable) {
+ System.out.println(" " + current);
+ }
+ }
+ }
+
+
+
}
|