[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool FinalMoveTool.java, 1.44, 1.45
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2007-12-17 18:33:15
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3129/src/net/sourceforge/bprocessor/gl/tool Modified Files: FinalMoveTool.java Log Message: Fixed the instance-move to use the active coordinatesystem when moving on the grid. Index: FinalMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/FinalMoveTool.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** FinalMoveTool.java 17 Dec 2007 08:44:17 -0000 1.44 --- FinalMoveTool.java 17 Dec 2007 18:33:18 -0000 1.45 *************** *** 19,22 **** --- 19,23 ---- import net.sourceforge.bprocessor.gl.Editor; + import net.sourceforge.bprocessor.gl.model.Intersection; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.gui.GUI; *************** *** 28,31 **** --- 29,33 ---- import net.sourceforge.bprocessor.model.Instance; import net.sourceforge.bprocessor.model.Mesh; + import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; *************** *** 195,198 **** --- 197,201 ---- private CoordinateSystem handle; private CoordinateSystem initialCoordinate; + private CoordinateSystem prevCs; /** *************** *** 203,208 **** public InstanceMove(Instance instance, CoordinateSystem handle) { this.instance = instance; - this.handle = handle; this.initialCoordinate = instance.getInstanceAnchor().copy(); } --- 206,215 ---- public InstanceMove(Instance instance, CoordinateSystem handle) { this.instance = instance; this.initialCoordinate = instance.getInstanceAnchor().copy(); + Vertex center = handle.projection(start.vertex()); + start = new Intersection(center, start.type(), start.object()); + this.handle = handle.copy(); + this.prevCs = Project.getInstance().getActiveCoordinateSystem().copy(); + this.prevCs.setOrigin(center); } *************** *** 211,215 **** */ public void move(Vertex delta) { ! revert(); if (current.object() instanceof Surface) { // convert the handle into the coordinatesystems of the surface and translate --- 218,222 ---- */ public void move(Vertex delta) { ! CoordinateSystem cs = null; if (current.object() instanceof Surface) { // convert the handle into the coordinatesystems of the surface and translate *************** *** 220,236 **** n = n.scale(-1); } ! CoordinateSystem cs = CoordinateSystem.systemFor(current.vertex(), n); ! CoordinateSystem anchor = new CoordinateSystem(new Vertex(1, 0, 0), new Vertex(0, 1, 0), ! new Vertex(0, 0, 1), new Vertex(0, 0, 0)); ! CoordinateSystem tmp = handle.translate(anchor); ! tmp = cs.unTranslate(tmp); ! instance.getInstanceAnchor().setOrigin(tmp.center()); ! instance.getInstanceAnchor().setIJN(tmp.getI(), tmp.getJ(), tmp.getN()); } else { ! // change i, j, n of the anchor back to its originals and then just move the delta ! instance.getInstanceAnchor().setIJN(initialCoordinate.getI(), ! initialCoordinate.getJ(), initialCoordinate.getN()); ! instance.getInstanceAnchor().move(delta.getX(), delta.getY(), delta.getZ()); } } --- 227,246 ---- n = n.scale(-1); } ! cs = CoordinateSystem.systemFor(current.vertex(), n); ! } else if (current.object() instanceof Plane) { ! Plane p = (Plane)current.object(); ! Vertex normal = p.normal(); ! cs = CoordinateSystem.systemFor(current.vertex(), normal); ! } ! if (cs == null) { ! cs = prevCs; ! cs.setOrigin(current.vertex()); } else { ! prevCs = cs; } + CoordinateSystem tmp = handle.translate(Project.getInstance().getActiveCoordinateSystem()); + tmp = cs.unTranslate(tmp); + instance.getInstanceAnchor().setOrigin(tmp.center()); + instance.getInstanceAnchor().setIJN(tmp.getI(), tmp.getJ(), tmp.getN()); } *************** *** 497,500 **** --- 507,514 ---- mover = new VectorMove(vertices); + affected = getAffected(geometrics); + current = findIntersection(e); + start = current.copy(); + if (geometrics.size() == 1) { Geometric work = geometrics.iterator().next(); *************** *** 508,512 **** } if (anchor == null) { ! anchor = space.getInstanceAnchor(); } mover = new InstanceMove(space, anchor); --- 522,526 ---- } if (anchor == null) { ! anchor = Project.getInstance().getActiveCoordinateSystem().copy(); } mover = new InstanceMove(space, anchor); *************** *** 514,520 **** } } - affected = getAffected(geometrics); - current = findIntersection(e); - start = current.copy(); updateFeedback(); setTip(secondClickTip()); --- 528,531 ---- |