Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3916/src/net/sourceforge/bprocessor/gl/tool
Modified Files:
Tool.java ToolFactory.java
Added Files:
ConstructorTool.java
Log Message:
Added Tool to creating constructors that currently can only create Points
Index: ToolFactory.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** ToolFactory.java 6 Jul 2006 10:39:38 -0000 1.50
--- ToolFactory.java 6 Jul 2006 13:13:50 -0000 1.51
***************
*** 108,111 ****
--- 108,114 ----
private Protractor protractor;
+ /** Constructor tool */
+ private ConstructorTool constructor;
+
/** The previous tool */
private Tool previousTool;
***************
*** 197,200 ****
--- 200,204 ----
fly = new CameraFlyTool(glv, flyCursor);
walk = new CameraWalkTool(glv, walkCursor);
+ constructor = new ConstructorTool(glv, pencilcursor);
Toolbar tb = Toolbar.getInstance();
***************
*** 222,226 ****
"Bclip.gif", "Clipping");
!
tb.addSeparator(3);
--- 226,230 ----
"Bclip.gif", "Clipping");
! this.registerTool(Tool.CONSTRUCTOR_TOOL, constructor, "Biconconstructor.gif", "Constructor");
tb.addSeparator(3);
--- NEW FILE: ConstructorTool.java ---
//---------------------------------------------------------------------------------
// $Id: ConstructorTool.java,v 1.1 2006/07/06 13:13:50 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.Cursor;
import java.awt.event.MouseEvent;
import net.sourceforge.bprocessor.gl.GLView;
import net.sourceforge.bprocessor.model.Point;
import net.sourceforge.bprocessor.model.Project;
import net.sourceforge.bprocessor.model.Vertex;
/**
* ConstructorTool
*/
public class ConstructorTool extends AbstractPencil {
/**
* Constructor for ConstructorTool
* @param glv The GLView
* @param cursor The Cursor
*/
public ConstructorTool(GLView glv, Cursor cursor) {
super(glv, cursor);
}
/**
* Insert a point into current space
* @param vertex The vertex
*/
protected void insertPoint(Vertex vertex) {
Point point = new Point(vertex.copy());
Project.getInstance().getActiveSpace().add(point);
Project.getInstance().changed(Project.getInstance());
}
/**
* @param e MouseEvent
*/
protected void moved(MouseEvent e) {
current = findIntersection(e);
if (current != null) {
makeTarget(current);
updateConstructors();
}
}
/**
* @param e MouseEvent
*/
protected void pressed(MouseEvent e) {
if (start == null) {
start = current;
} else {
if (start.vertex().equalEps(current.vertex())) {
insertPoint(current.vertex());
start = null;
}
}
}
/**
* @param e MouseEvent
*/
protected void dragged(MouseEvent e) {
}
/**
* @param e MouseEvent
*/
protected void released(MouseEvent e) {
}
}
Index: Tool.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** Tool.java 6 Jul 2006 10:39:38 -0000 1.22
--- Tool.java 6 Jul 2006 13:13:50 -0000 1.23
***************
*** 48,53 ****
/** The Protractor tool */
public static final int PROTRACTOR_TOOL = 13;
/** The controlled extrude tool */
! public static final int MULTI_EXTRUDE_TOOL = 14;
/**
--- 48,55 ----
/** The Protractor tool */
public static final int PROTRACTOR_TOOL = 13;
+ /** The Constructor tool */
+ public static final int CONSTRUCTOR_TOOL = 14;
/** The controlled extrude tool */
! public static final int MULTI_EXTRUDE_TOOL = 15;
/**
|