01: /*************************************************************************
02: * *
03: * 1) This source code file, in unmodified form, and compiled classes *
04: * derived from it can be used and distributed without restriction, *
05: * including for commercial use. (Attribution is not required *
06: * but is appreciated.) *
07: * *
08: * 2) Modified versions of this file can be made and distributed *
09: * provided: the modified versions are put into a Java package *
10: * different from the original package, edu.hws; modified *
11: * versions are distributed under the same terms as the original; *
12: * and the modifications are documented in comments. (Modification *
13: * here does not include simply making subclasses that belong to *
14: * a package other than edu.hws, which can be done without any *
15: * restriction.) *
16: * *
17: * David J. Eck *
18: * Department of Mathematics and Computer Science *
19: * Hobart and William Smith Colleges *
20: * Geneva, New York 14456, USA *
21: * Email: eck@hws.edu WWW: http://math.hws.edu/eck/ *
22: * *
23: *************************************************************************/package edu.hws.jcm.draw;
24:
25: import edu.hws.jcm.data.*;
26:
27: /**
28: * A Crosshair is a small cross, 15 pixels wide and high, that is drawn in
29: * a CoordinateRect at a specified point.
30: * A Crosshair is a Computable object, so should be added to a Controller to be
31: * recomputed when the coordinates of the point change.
32: */
33:
34: public class Crosshair extends DrawGeometric {
35:
36: /**
37: * Create a cross that appears at the point with coordinates (x,y).
38: */
39: public Crosshair(Value x, Value y) {
40: super (CROSS, x, y, 7, 7);
41: }
42:
43: /**
44: * Create a cross that appears on the graph of the function y=f(x)
45: * at the point with coordinates (x,f(x)). f should be a function
46: * of one variable.
47: */
48: public Crosshair(Value x, Function f) {
49: super (CROSS, x, new ValueMath(f, x), 7, 7);
50: }
51:
52: }
|