Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14720/src/net/sourceforge/bprocessor/model
Modified Files:
Mesh.java
Log Message:
Improved copy
Index: Mesh.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Mesh.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** Mesh.java 20 Dec 2007 10:24:18 -0000 1.27
--- Mesh.java 20 Dec 2007 12:26:24 -0000 1.28
***************
*** 9,12 ****
--- 9,13 ----
import java.util.Collection;
+ import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
***************
*** 134,153 ****
}
! /**
! *
! */
! public void identify() {
long count = 1;
! for (Edge current : edges) {
if (current.id == null) {
current.setId(Long.valueOf(count++));
}
}
! count = 1;
! for (Vertex current : vertices) {
! if (current.id == null) {
! current.setId(Long.valueOf(count++));
! }
}
}
--- 135,165 ----
}
!
! private static void identify(Container owner, Collection<? extends Geometric> geometrics) {
long count = 1;
! for (Geometric current : geometrics) {
if (current.id == null) {
+ current.setOwner(owner);
current.setId(Long.valueOf(count++));
}
}
! }
!
! private static HashMap map(Collection<? extends Entity> entities) {
! HashMap map = new HashMap();
! for (Entity current : entities) {
! map.put(current.getId(), current);
}
+ return map;
+ }
+
+ /**
+ * @param owner Container
+ */
+ public void identify(Container owner) {
+ identify(owner, elements);
+ identify(owner, surfaces);
+ identify(owner, edges);
+ identify(owner, vertices);
}
***************
*** 307,323 ****
Container container = (Container) map.get(current);
Mesh mesh = current.mesh().copy(map);
! for (Space e : mesh.elements) {
! container.add(e);
! }
! for (Surface s : mesh.surfaces) {
! container.add(s);
! }
! for (Edge e : mesh.edges) {
! container.add(e);
! }
! for (Vertex v : mesh.vertices) {
! container.add(v);
! }
!
}
return copy;
--- 319,328 ----
Container container = (Container) map.get(current);
Mesh mesh = current.mesh().copy(map);
! mesh.identify(container);
! container.setElements(map(mesh.elements));
! container.setSurfaces(map(mesh.surfaces));
! container.setEdges(map(mesh.edges));
! container.setVertices(map(mesh.vertices));
! container.setEmpty((Container) map.get(current.empty));
}
return copy;
|