[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool ControlledMoveTool.java, 1.7, 1.8
Status: Pre-Alpha
Brought to you by:
henryml
|
From: rimestad <rim...@us...> - 2007-02-19 15:50:27
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22780/src/net/sourceforge/bprocessor/gl/tool Modified Files: ControlledMoveTool.java Log Message: improved the interaction in the controlled move tool Index: ControlledMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ControlledMoveTool.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ControlledMoveTool.java 2 Jan 2007 17:47:08 -0000 1.7 --- ControlledMoveTool.java 19 Feb 2007 15:50:21 -0000 1.8 *************** *** 19,24 **** --- 19,28 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.gl.view.Transformation; + import net.sourceforge.bprocessor.gl.view.View; + import net.sourceforge.bprocessor.model.ClippingPlane; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Geometric; + import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Surface; *************** *** 34,37 **** --- 38,42 ---- /** Direction */ private Vertex direction; + /** the logger */ private static Logger log = Logger.getLogger(ControlledMoveTool.class); *************** *** 63,66 **** --- 68,77 ---- } else if (geo instanceof Vertex) { map = createSlideMap((Vertex)geo); + } else if (geo instanceof ClippingPlane) { + ClippingPlane cp = (ClippingPlane) geo; + map = new HashMap(); + map.put(cp.center(), cp.getNormal()); + } else { + log.warn(geo.getClass().getName() + " is not able to be moved controlled"); } if (map != null) { *************** *** 196,199 **** --- 207,229 ---- found = direction != null; } + if (!found) { + return false; + } else { + // Make the intersection mechanism in abstractpencil lock to the workingplane + double startx = e.getX(); + double starty = e.getY(); + View view = glv.getView(); + Transformation trans = view.transformation(); + double x = startx; + double y = View.getHeight() - starty; + Vertex near = new Vertex(x, y, 0.0); + Vertex far = new Vertex(x, y, 1.0); + Edge ray = new Edge(near, far); + ray = trans.unProject(ray); + Vertex center = start.vertex(); + Plane plane = new Plane(direction.getX(), direction.getY(), direction.getZ(), center); + lockingPlane = plane.orthogonalPlane(ray); + lock = true; + } } } *************** *** 224,227 **** --- 254,261 ---- } else if (geo instanceof Vertex) { return (Vertex)slideMap.get(geo); + } else if (geo instanceof ClippingPlane) { + return ((ClippingPlane)geo).getNormal(); + } else { + log.info("A nonsupported object in direction method in ControlledMoveTool"); } return null; |