[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool AbstractPencil.java,1.25,1.26 MoveTool
Status: Pre-Alpha
Brought to you by:
henryml
From: Nordholt <nor...@us...> - 2006-05-03 10:04:49
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20891 Modified Files: AbstractPencil.java MoveTool.java Log Message: color coded intersection vertices. Changed direction lock to use hold-shift/capslock. Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** MoveTool.java 26 Apr 2006 15:29:07 -0000 1.55 --- MoveTool.java 3 May 2006 10:04:38 -0000 1.56 *************** *** 102,105 **** --- 102,106 ---- moveEntities.addAll(selection); } + excluded(getAffected(moveEntities)); if (!moveEntities.isEmpty()) { *************** *** 222,225 **** --- 223,238 ---- } } + + /** + * Invoked when a key has been released. + * @param e The KeyEvent + */ + public void keyReleased(KeyEvent e) { + if (strategy != null) { + strategy.keyReleased(e); + } else { + super.keyReleased(e); + } + } /** Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** AbstractPencil.java 1 May 2006 09:58:02 -0000 1.25 --- AbstractPencil.java 3 May 2006 10:04:38 -0000 1.26 *************** *** 31,34 **** --- 31,35 ---- import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Camera; + import net.sourceforge.bprocessor.model.Entity; *************** *** 53,56 **** --- 54,60 ---- protected Collection constructors = new HashSet(); + /** The aligning elements */ + protected Collection aligners = new HashSet(); + /** Current intersection */ protected Intersection current; *************** *** 64,69 **** /** Locked */ protected Vertex locked; ! /** wherther or not the tool is locked */ protected boolean lock; --- 68,76 ---- /** Locked */ protected Vertex locked; + + /** Wherther or not unaligned constructors are showing */ + protected boolean showing; ! /** Wherther or not the tool is locked */ protected boolean lock; *************** *** 87,90 **** --- 94,98 ---- timer.setRepeats(false); lock = false; + showing = true; plane = new Plane (0, 0, 1, 0); } *************** *** 129,133 **** lockedcopy.scale(locked.dot(unlocked)); lockedcopy = lockedcopy.add(start.vertex()); ! return new Intersection(lockedcopy, Intersection.VERTEX, lockedcopy); } else { return intersection; --- 137,141 ---- lockedcopy.scale(locked.dot(unlocked)); lockedcopy = lockedcopy.add(start.vertex()); ! return new Intersection(lockedcopy, intersection.type(), intersection.object()); } else { return intersection; *************** *** 219,224 **** Vertex to = ((Edge) edges.get(edges.size() - 1)).getTo(); - - if (from == to) { List actual = new LinkedList(); --- 227,230 ---- *************** *** 365,372 **** constructors.add(parrallel); } ! if (plane != null) { ! info(plane); ! info("origin = " + plane.origin()); ! } } } --- 371,385 ---- constructors.add(parrallel); } ! //if (plane != null) { ! //info(plane); ! //info("origin = " + plane.origin()); ! //} ! } ! } ! if (!showing) { ! aligners(constructors); ! constructors = new LinkedList(); ! if (current.object() instanceof Edge) { ! constructors.add(current.object()); } } *************** *** 405,408 **** --- 418,452 ---- /** + * Show aligners + */ + protected void showAligners() { + Iterator iter = aligners.iterator(); + while (iter.hasNext()) { + Edge current = (Edge) iter.next(); + glv.getView().addTempEdge(current); + } + } + + /** + * Hide aligners + */ + protected void hideAligners() { + Iterator iter = aligners.iterator(); + while (iter.hasNext()) { + Edge current = (Edge) iter.next(); + glv.getView().removeTempEdge(current); + } + } + + /** + * Supply the aligner elements + * @param feed Collection of edges + */ + protected void aligners(Collection feed) { + aligners.clear(); + aligners.addAll(feed); + } + + /** * Get the plane out of the XY XZ and YZ planes that is best aligned * with screen. *************** *** 517,526 **** --- 561,579 ---- case Intersection.EDGE_MIDPOINT: target = current; + glv.getView().changeColor((Entity)target, new float[] {255.0f / 255.0f, + 99.0f / 255.0f, + 71.0f / 255.0f}); break; case Intersection.EDGE_INTERSECTION: target = current; + glv.getView().changeColor((Entity)target, new float[] {118.0f / 255.0f, + 238.0f / 255.0f, + 0.0f}); break; case Intersection.SURFACE_INTERSECTION: target = current; + glv.getView().changeColor((Entity)target, new float[] {30.0f / 255.0f, + 144.0f / 255.0f, + 255.0f / 255.0f}); break; case Intersection.PLANE_INTERSECTION: *************** *** 569,573 **** /** ! * Invoked when a key has been pressed. Lets user delete what is selected. * @param e The KeyEvent */ --- 622,626 ---- /** ! * Invoked when a key has been pressed. * @param e The KeyEvent */ *************** *** 601,604 **** --- 654,663 ---- locked = start.vertex().minus(current.vertex()); locked.scale(1 / locked.length()); + lock = true; + } + } else if (e.getKeyCode() == KeyEvent.VK_CAPS_LOCK) { + if (start != null && current != null) { + locked = start.vertex().minus(current.vertex()); + locked.scale(1 / locked.length()); } lock = !lock; *************** *** 677,681 **** } } ! /** * Clean up --- 736,750 ---- } } ! ! /** ! * Invoked when a key has been released. ! * @param e The KeyEvent ! */ ! public void keyReleased(KeyEvent e) { ! if (e.getKeyCode() == KeyEvent.VK_SHIFT) { ! lock = false; ! } ! } ! /** * Clean up *************** *** 686,689 **** --- 755,759 ---- current = null; incident = null; + lock = false; constructors(new LinkedList()); feedback(new LinkedList()); |