[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool MoveTool.java, 1.66, 1.67 VectorMoveT
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2006-09-05 11:01:51
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30487/src/net/sourceforge/bprocessor/gl/tool Modified Files: MoveTool.java VectorMoveTool.java ControlledMoveTool.java Log Message: Added canMove to all geometric objects that are supposed to given a direction check how much of is is leagal to move. Made vectorMove check the geometry for the possible move distance before moving. The move method in the movetools now return a vector that is the actual moved vector. When there are only one selected object then the object is moved otherwise the collection of affected vertices are. Index: ControlledMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ControlledMoveTool.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ControlledMoveTool.java 21 Aug 2006 14:25:13 -0000 1.3 --- ControlledMoveTool.java 5 Sep 2006 11:01:43 -0000 1.4 *************** *** 225,233 **** /** ! * Move the vertices ! * @param objects Collection of geometric objects ! * @param delta Vertex (vector) */ ! public void move(Collection objects, Vertex delta) { if (slideMap != null && slideMap.keySet().containsAll(vertices)) { Vertex directionCopy = direction.copy(); --- 225,231 ---- /** ! * @see net.sourceforge.bprocessor.gl.tool.MoveTool#move(Collection, Vertex) */ ! public Vertex move(Collection objects, Vertex delta) { if (slideMap != null && slideMap.keySet().containsAll(vertices)) { Vertex directionCopy = direction.copy(); *************** *** 265,269 **** --- 263,269 ---- Project.getInstance().changed(vertices); } + return delta; } + return new Vertex(0, 0, 0); } Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** MoveTool.java 28 Aug 2006 05:53:53 -0000 1.66 --- MoveTool.java 5 Sep 2006 11:01:43 -0000 1.67 *************** *** 31,35 **** * Move Tool */ ! public class MoveTool extends AbstractPencil { /** Entities */ protected Set entities = new HashSet(); --- 31,35 ---- * Move Tool */ ! public abstract class MoveTool extends AbstractPencil { /** Entities */ protected Set entities = new HashSet(); *************** *** 69,76 **** * @param objects Collection of geometric objects * @param delta Vertex (vector) */ ! public void move(Collection objects, Vertex delta) { ! ! } /** --- 69,75 ---- * @param objects Collection of geometric objects * @param delta Vertex (vector) + * @return The achieved movement */ ! public abstract Vertex move(Collection objects, Vertex delta); /** *************** *** 151,157 **** current = current.copy(); to = current.vertex(); ! move(vertices, to.minus(last)); update(); - last = to; updateFeedback(); } --- 150,159 ---- current = current.copy(); to = current.vertex(); ! if (Selection.primary().size() < 2) { ! last = move(entities, to.minus(last)).add(last); ! } else { ! last = move(vertices, to.minus(last)).add(last); ! } update(); updateFeedback(); } Index: VectorMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/VectorMoveTool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** VectorMoveTool.java 21 Aug 2006 14:25:13 -0000 1.4 --- VectorMoveTool.java 5 Sep 2006 11:01:43 -0000 1.5 *************** *** 32,45 **** /** ! * Move the vertices ! * @param objects Collection of geometric objects ! * @param delta Vertex (vector) */ ! public void move(Collection objects, Vertex delta) { if (objects != null) { Iterator it = objects.iterator(); while (it.hasNext()) { Object elm = it.next(); if (elm instanceof Geometric) { ((Geometric)elm).move(delta.getX(), delta.getY(), delta.getZ()); } --- 32,53 ---- /** ! * @see net.sourceforge.bprocessor.gl.tool.MoveTool#move(Collection, Vertex) */ ! public Vertex move(Collection objects, Vertex delta) { if (objects != null) { + // Find the movable distance Iterator it = objects.iterator(); while (it.hasNext()) { Object elm = it.next(); if (elm instanceof Geometric) { + Vertex move = ((Geometric)elm).canMove(delta.getX(), delta.getY(), delta.getZ(), objects); + delta = move; + } + } + // Move + it = objects.iterator(); + while (it.hasNext()) { + Object elm = it.next(); + if (elm instanceof Geometric) { ((Geometric)elm).move(delta.getX(), delta.getY(), delta.getZ()); } *************** *** 47,50 **** --- 55,59 ---- Project.getInstance().changed(vertices); } + return delta; } } |