[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool SelectTool.java,1.34,1.35 Tool.java,1.
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2005-11-01 07:36:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19538/src/net/sourceforge/bprocessor/gl/tool Modified Files: SelectTool.java Tool.java ToolFactory.java Log Message: added ClippingPlane functionality, there are still several problems 1) selection does not work proberly yet 2) The size of the Clipping plane need to be larger 3) there need to be a arrow or something to select clipping planes every time 4) the transparency also need to be greater 5) need its own icon Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ToolFactory.java 29 Sep 2005 21:02:34 -0000 1.8 --- ToolFactory.java 1 Nov 2005 07:36:09 -0000 1.9 *************** *** 41,46 **** /** pencil tool */ private PencilTool pencil; ! ! /** --- 41,47 ---- /** pencil tool */ private PencilTool pencil; ! ! /** pencil tool */ ! private ClipplaneTool clipplane; /** *************** *** 53,56 **** --- 54,58 ---- move = new MoveTool(glv); extrusion = new ExtrusionTool(glv); + clipplane = new ClipplaneTool(glv); Toolbar tb = Toolbar.getInstance(); *************** *** 63,66 **** --- 65,70 ---- but = tb.registerAction(new ExtrudeAction(glv)); but.setToolTipText("Extrude"); + but = tb.registerAction(new ClipAction(glv)); + but.setToolTipText("Clipping"); Notifier.getInstance().addListener(select); *************** *** 101,104 **** --- 105,110 ---- } else if (i == Tool.PENCIL_TOOL) { return pencil; + } else if (i == Tool.CLIP_TOOL) { + return clipplane; } else { log.error("[get] No such tool " + i); *************** *** 194,198 **** /** ! * The debug action inner class */ class PencilAction extends AbstractAction { --- 200,204 ---- /** ! * The pencil action inner class */ class PencilAction extends AbstractAction { *************** *** 220,222 **** --- 226,256 ---- } } + + /** + * The clipping action inner class + */ + class ClipAction extends AbstractAction { + /** The GLView */ + private GLView glv = null; + + /** + * Constructor + * @param glv TheGLView + */ + ClipAction(GLView glv) { + this.glv = glv; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("selecticon.png"); + ImageIcon im = new ImageIcon(url); + putValue(Action.SMALL_ICON, im); + } + + /** + * Called when the button is pressed + * @param e The ActionEvent + */ + public void actionPerformed(ActionEvent e) { + glv.changeTool(Tool.CLIP_TOOL); + } + } } Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** SelectTool.java 28 Oct 2005 12:16:38 -0000 1.34 --- SelectTool.java 1 Nov 2005 07:36:09 -0000 1.35 *************** *** 8,11 **** --- 8,12 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.gl.model.ClippingPlane; import net.sourceforge.bprocessor.kernel.notification.Notification; *************** *** 22,27 **** import net.sourceforge.bprocessor.model.Space; - - import java.awt.event.ActionListener; import java.awt.event.MouseEvent; --- 23,26 ---- *************** *** 277,280 **** --- 276,281 ---- Notification n = new Notification(Notification.EDGE_SELECTED, edge.getId()); Notifier.getInstance().sendNotification(n); + } else if (obj instanceof ClippingPlane) { + selection.add(obj); } } *************** *** 297,300 **** --- 298,306 ---- Notification n = new Notification(Notification.EDGE_DESELECTED, edge.getId()); Notifier.getInstance().sendNotification(n); + } else if (obj instanceof ClippingPlane) { + log.info("Clip selected"); + if (selection.contains(obj)) { + selection.remove(obj); + } } } *************** *** 315,328 **** if (e.getKeyCode() == KeyEvent.VK_DELETE || e.getKeyCode() == KeyEvent.VK_BACK_SPACE) { ! if (target instanceof Surface) { ! Surface selectedSurface = (Surface)target; ! selection.remove(selectedSurface); ! deleteSurface(selectedSurface); ! ! } else if (target instanceof Edge) { ! Edge selectedEdge = (Edge)target; ! if (selectedEdge.getSurfaces().size() < 1) { ! selection.remove(selectedEdge); ! deleteEdge(selectedEdge); } } --- 321,339 ---- if (e.getKeyCode() == KeyEvent.VK_DELETE || e.getKeyCode() == KeyEvent.VK_BACK_SPACE) { ! Iterator it = selection.iterator(); ! while (it.hasNext()) { ! Object selected = it.next(); ! if (selected instanceof Surface) { ! Surface selectedSurface = (Surface)target; ! selection.remove(selectedSurface); ! deleteSurface(selectedSurface); ! } else if (selected instanceof Edge) { ! Edge selectedEdge = (Edge)target; ! if (selectedEdge.getSurfaces().size() < 1) { ! selection.remove(selectedEdge); ! deleteEdge(selectedEdge); ! } ! } else if (selected instanceof ClippingPlane) { ! glv.getView().removeClippingPlane((ClippingPlane)selected); } } Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Tool.java 21 Sep 2005 09:35:29 -0000 1.8 --- Tool.java 1 Nov 2005 07:36:09 -0000 1.9 *************** *** 22,27 **** /** The extrude tool */ public static final int EXTRUSION_TOOL = 2; ! /** The debug tool */ public static final int PENCIL_TOOL = 3; /** --- 22,29 ---- /** The extrude tool */ public static final int EXTRUSION_TOOL = 2; ! /** The pencil tool */ public static final int PENCIL_TOOL = 3; + /** The Clipping tool */ + public static final int CLIP_TOOL = 4; /** |