[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool MoveTool.java,1.16,1.17
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2005-11-25 10:20:21
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4684/src/net/sourceforge/bprocessor/gl/tool Modified Files: MoveTool.java Log Message: Movetool now collects vertices to move in a set to avoid moving the same vertex more than once Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** MoveTool.java 7 Nov 2005 07:21:21 -0000 1.16 --- MoveTool.java 25 Nov 2005 10:20:11 -0000 1.17 *************** *** 21,25 **** --- 21,27 ---- import java.util.Collection; + import java.util.HashSet; import java.util.Iterator; + import java.util.Set; import org.apache.log4j.Logger; *************** *** 58,61 **** --- 60,66 ---- /** The plane to drag according to */ private Plane dragPlane; + + /** The set of vertices to move **/ + private Set vertices; /** *************** *** 67,71 **** super(glv, cursor); } ! /** * Invoked when a mouse button has been pressed on a component. --- 72,100 ---- super(glv, cursor); } ! ! /** ! * Collect vertices from object ! * @param o The object ! * @param vertices The vertices ! */ ! private void collect(Object o, Set vertices) { ! if (o instanceof Vertex) { ! vertices.add(o); ! } else if (o instanceof Edge) { ! Edge edge = (Edge) o; ! vertices.add(edge.getFrom()); ! vertices.add(edge.getTo()); ! } else if (o instanceof Surface) { ! Surface surface = (Surface) o; ! vertices.addAll(surface.getVertices()); ! if (surface.getInnerSurfaces() != null) { ! Iterator iter = surface.getInnerSurfaces().iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! collect(current, vertices); ! } ! } ! } ! } /** * Invoked when a mouse button has been pressed on a component. *************** *** 82,85 **** --- 111,125 ---- parentPos = new Vertex("parent", initial.getX(), initial.getY(), initial.getZ()); from = new Vertex("from", initial.getX(), initial.getY(), initial.getZ()); + + vertices = new HashSet(); + Iterator iter = selection.iterator(); + while (iter.hasNext()) { + collect(iter.next(), vertices); + } + // There is a delay before selection has been updated with target + // because asynch notifications are being used to update selection. + // TODO fix it + // Meanwhile just collect points from target. + collect(target, vertices); } } *************** *** 128,131 **** --- 168,172 ---- dragPlane = null; parentPos = null; + vertices = null; } *************** *** 164,168 **** } ! move(selection, delta); from.move(delta.getX(), delta.getY(), delta.getZ()); glv.setLength(from.minus(initial).length()); --- 205,209 ---- } ! move(vertices, delta); from.move(delta.getX(), delta.getY(), delta.getZ()); glv.setLength(from.minus(initial).length()); |