Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3871/src/net/sourceforge/bprocessor/gl/view
Modified Files:
PopupMenu.java
Log Message:
Automatic assignment
Index: PopupMenu.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/PopupMenu.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** PopupMenu.java 30 Mar 2009 09:16:42 -0000 1.26
--- PopupMenu.java 31 Mar 2009 11:03:24 -0000 1.27
***************
*** 408,411 ****
--- 408,438 ----
menu.add(action);
}
+ {
+ AbstractAction action = new SpaceMenuAction(sp, "Export") {
+ public void actionPerformed(ActionEvent event) {
+ List<Surface> surfaces = new LinkedList(space.getEnvelope());
+ List<Edge> edges = new LinkedList(Surface.edges(surfaces));
+ List<Vertex> vertices = new LinkedList(Edge.vertices(edges));
+
+ HashMap<Vertex, Integer> vmap = new HashMap();
+ int count = 1;
+ for (Vertex current : vertices) {
+ vmap.put(current, count++);
+ System.out.println("v " + current.getX() +
+ " " + current.getY() + " " + current.getZ());
+ }
+ for (Surface current : surfaces) {
+ List<Vertex> verts = current.getVertices();
+ System.out.print("f");
+ for (Vertex v : verts) {
+ int i = vmap.get(v);
+ System.out.print(" " + i);
+ }
+ System.out.println();
+ }
+ }
+ };
+ menu.add(action);
+ }
if (CHECKS) {
AbstractAction check = new SpaceMenuAction(sp, "Consistency Check") {
|