Statistics
| Revision:

root / trunk / extensions / extCAD / sm / RectangleCADTool.sm @ 11445

History | View | Annotate | Download (2 KB)

1 3766 caballero
// -*- tab-width: 4; -*-
2
3
%{
4
//
5
// Vicente Caballero Navarro
6
%}
7
8 3978 caballero
%start Rectangle::FirstPoint
9 3766 caballero
%class RectangleCADTool
10
%package com.iver.cit.gvsig.gui.cad.tools.smc
11
%import com.iver.cit.gvsig.gui.cad.tools.RectangleCADTool
12 4324 caballero
%import java.awt.event.InputEvent
13 4583 caballero
%import com.iver.andami.PluginServices
14 3766 caballero
15 3978 caballero
%map Rectangle
16 3766 caballero
%%
17
// A task begins life in suspended animation.
18
19 3978 caballero
FirstPoint
20 3766 caballero
21
	Entry {
22 4892 caballero
		setQuestion(
23 4583 caballero
		PluginServices.getText(this,"insert_first_point_corner"));
24
		setDescription(new String[]{"cancel"});
25 3766 caballero
		}
26
	Exit{
27
		}
28
29
	{
30
31 4324 caballero
		addPoint( pointX:double,pointY:double,event:InputEvent)
32 3978 caballero
			SecondPointOrSquare {
33 9121 caballero
				setQuestion(
34
					PluginServices.getText(this,"insert_point_corner")+" "+
35
					PluginServices.getText(this,"cad.or")+" "+
36
					PluginServices.getText(this,"square")+" "+
37
					"["+PluginServices.getText(this,"RectangleCADTool.square")+"]");
38 4583 caballero
				setDescription(new String[]{"square","cancel"});
39 4365 caballero
				addPoint( pointX,pointY,event);
40 3766 caballero
				}
41
42
	}
43 3978 caballero
SecondPointOrSquare{
44 4324 caballero
	addPoint( pointX:double,pointY:double,event:InputEvent)
45 3978 caballero
		FirstPoint {
46 4365 caballero
			addPoint(pointX,pointY,event);
47 3766 caballero
			end();
48
			}
49 3828 caballero
	addOption(s:String)
50 9121 caballero
		[s.equalsIgnoreCase(PluginServices.getText(this,"RectangleCADTool.square")) || s.equals(PluginServices.getText(this,"square"))]
51 3978 caballero
		SecondPointSquare {
52 4583 caballero
			setQuestion(PluginServices.getText(this,"insert_opposited_corner"));
53
			setDescription(new String[]{"cancel"});
54 3828 caballero
			addOption(s);
55 3766 caballero
			}
56
57
}
58 3978 caballero
SecondPointSquare{
59 4324 caballero
	addPoint( pointX:double,pointY:double,event:InputEvent)
60 3978 caballero
		FirstPoint {
61 4365 caballero
			addPoint( pointX,pointY,event);
62 3766 caballero
			end();
63
			}
64
}
65 3978 caballero
66 3766 caballero
Default
67
{
68 3883 caballero
	addOption(s:String)
69 4583 caballero
		[s.equals(PluginServices.getText(this,"cancel"))]
70 3978 caballero
		FirstPoint{
71 3883 caballero
			end();
72
			}
73 5730 caballero
	addOption(s:String)
74
		FirstPoint{
75
			throwOptionException(PluginServices.getText(this,"incorrect_option"),s);
76
			}
77
	addValue(d:double)
78
		FirstPoint{
79
			throwValueException(PluginServices.getText(this,"incorrect_value"),d);
80
			}
81
	addPoint(pointX:double,pointY:double,event:InputEvent)
82
		FirstPoint{
83
			throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY);
84
			}
85 3766 caballero
}
86
%%