Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27782
Modified Files:
ToolFactory.java
Log Message:
added tape measure tool
Index: ToolFactory.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** ToolFactory.java 22 Nov 2005 13:40:22 -0000 1.15
--- ToolFactory.java 29 Nov 2005 19:00:39 -0000 1.16
***************
*** 50,54 ****
/** rotation tool */
! private RotationTool rotation;
/** The previous tool */
--- 50,57 ----
/** rotation tool */
! private RotationTool rotation;
!
! /** Tape measure tool */
! private TapeMeasureTool tapeMeasure;
/** The previous tool */
***************
*** 68,71 ****
--- 71,75 ----
Cursor pencilcursor
= Toolkit.getDefaultToolkit().createCustomCursor(pencilimage, new Point(7, 8), "Pencil");
+
url = cl.getResource("Bcursorrotcam.gif");
Image rotationImage = Toolkit.getDefaultToolkit().getImage(url);
***************
*** 90,93 ****
--- 94,100 ----
but = tb.registerAction(new RotationAction(glv));
but.setToolTipText("Rotation");
+ but = tb.registerAction(new TapeMeasureAction(glv));
+ but.setToolTipText("Tape Measure");
+
select = new SpaceTool(glv, null);
***************
*** 97,100 ****
--- 104,109 ----
clipplane = new ClipplaneTool(glv, pencilcursor);
rotation = new RotationTool(glv, rotationCursor, dragCursor);
+ tapeMeasure = new TapeMeasureTool(glv, pencilcursor);
+
Notifier.getInstance().addListener(select);
***************
*** 112,116 ****
return factory;
}
!
/**
* Get the default tool
--- 121,125 ----
return factory;
}
!
/**
* Get the default tool
***************
*** 157,160 ****
--- 166,172 ----
currentTool = rotation;
return rotation;
+ } else if (i == Tool.TAPE_MEASURE_TOOL) {
+ currentTool = tapeMeasure;
+ return tapeMeasure;
} else {
log.error("[get] No such tool " + i);
***************
*** 311,315 ****
}
}
!
/**
* The clipping action inner class
--- 323,327 ----
}
}
!
/**
* The clipping action inner class
***************
*** 318,322 ****
/** The GLView */
private GLView glv = null;
!
/**
* Constructor
--- 330,334 ----
/** The GLView */
private GLView glv = null;
!
/**
* Constructor
***************
*** 330,334 ****
putValue(Action.SMALL_ICON, im);
}
!
/**
* Called when the button is pressed
--- 342,347 ----
putValue(Action.SMALL_ICON, im);
}
!
!
/**
* Called when the button is pressed
***************
*** 339,341 ****
--- 352,384 ----
}
}
+
+
+ /**
+ * The tape measure action inner class
+ */
+ class TapeMeasureAction extends AbstractAction {
+ /** The GLView */
+ private GLView glv = null;
+
+ /**
+ * Constructor
+ * @param glv TheGLView
+ */
+ TapeMeasureAction(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.TAPE_MEASURE_TOOL);
+ }
+ }
+
}
|