Thread: [Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool PencilTool.java,NONE,1.1 ToolFactory.j
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2005-08-22 14:31:14
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28239/src/net/sourceforge/bprocessor/gl/tool Modified Files: ToolFactory.java SelectTool.java Added Files: PencilTool.java Removed Files: DebugTool.java Log Message: Vertex selection in getObjectAt() --- DebugTool.java DELETED --- Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ToolFactory.java 10 Aug 2005 12:42:46 -0000 1.3 --- ToolFactory.java 22 Aug 2005 14:30:59 -0000 1.4 *************** *** 44,48 **** /** debug tool */ ! private DebugTool debug; /** --- 44,48 ---- /** debug tool */ ! private PencilTool debug; /** *************** *** 55,59 **** move = new MoveTool(glv); extrusion = new ExtrusionTool(glv); ! debug = new DebugTool(glv); Toolbar tb = Toolbar.getInstance(); --- 55,59 ---- move = new MoveTool(glv); extrusion = new ExtrusionTool(glv); ! debug = new PencilTool(glv); Toolbar tb = Toolbar.getInstance(); *************** *** 239,243 **** this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("selecticon.png"); ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); --- 239,243 ---- this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("drawicon.png"); ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SelectTool.java 19 Aug 2005 09:49:20 -0000 1.6 --- SelectTool.java 22 Aug 2005 14:30:59 -0000 1.7 *************** *** 114,117 **** --- 114,122 ---- viewType = View.VIEW_3D; o = view.getObjectAtPoint(x, y); + if (o instanceof Vertex) { + Vertex vertex = (Vertex)o; + Notification n = new Notification(Notification.VERTEX_SELECTED, vertex.getId()); + Notifier.getInstance().sendNotification(n); + } if (o instanceof Edge) { Edge edge = (Edge)o; *************** *** 123,127 **** Notification n = new Notification(Notification.SURFACE_SELECTED, surface.getId()); Notifier.getInstance().sendNotification(n); ! } } else { Vertex v = vertexCollide(coords); --- 128,133 ---- Notification n = new Notification(Notification.SURFACE_SELECTED, surface.getId()); Notifier.getInstance().sendNotification(n); ! } ! } else { Vertex v = vertexCollide(coords); --- NEW FILE: PencilTool.java --- //--------------------------------------------------------------------------------- // $Id: PencilTool.java,v 1.1 2005/08/22 14:30:59 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import java.awt.event.MouseEvent; import java.util.LinkedList; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; /** * The DebugTool */ public class PencilTool extends SelectTool { /** The height */ private int height = 0; /** The current number of surfaces */ private int number = 0; /** The current factor */ private int factor = 0; /** * Constructor * @param glv The GLView */ public PencilTool(GLView glv) { super(glv); } /** * Create n surfaces to test performance. * @param n The number of surfaces to create */ void createSurfaces(int n) { double coords[] = new double[3]; coords[0] = -1; coords[1] = height; coords[2] = -1; Vertex a = createVertex(coords); coords[0] = 1; coords[1] = height; coords[2] = -1; Vertex b = createVertex(coords); coords[0] = 1; coords[1] = height; coords[2] = 1; Vertex c = createVertex(coords); coords[0] = -1; coords[1] = height; coords[2] = 1; height++; Vertex d = createVertex(coords); Edge e1 = createEdge(a, b); Edge e2 = createEdge(b, c); Edge e3 = createEdge(c, d); Edge e4 = createEdge(d, a); LinkedList edges = new LinkedList(); edges.add(e1); edges.add(e2); edges.add(e3); edges.add(e4); Surface s = createSurface(edges); } /** * Invoked when a mouse button has been pressed on a component. * @param e The MouseEvent object */ protected void pressed(MouseEvent e) { super.pressed(e); int x = e.getX(); int y = e.getY(); View v = glv.getView(); } /** * Invoked when the mouse cursor has been moved * @param e The MouseEvent object */ protected void moved(MouseEvent e) { int x = e.getX(); int y = e.getY(); View v = glv.getView(); } /** * Invoked when the mouse is held pressed and moved * @param e The MouseEvent object */ protected void dragged(MouseEvent e) { int x = e.getX(); int y = e.getY(); View v = glv.getView(); } /** * Invoked when a mouse button has been released on a component. * @param e The MouseEvent */ protected void released(MouseEvent e) { int x = e.getX(); int y = e.getY(); View v = glv.getView(); } } |