svn-gvsig-desktop / tags / v1_1_2_Build_1044 / extensions / extCAD / sm / CircleCADTool.sm @ 43233
History | View | Annotate | Download (2.28 KB)
1 |
// -*- tab-width: 4; -*- |
---|---|
2 |
|
3 |
%{ |
4 |
// |
5 |
// Vicente Caballero Navarro |
6 |
%} |
7 |
|
8 |
%start Circle::CenterPointOr3p |
9 |
%class CircleCADTool |
10 |
%package com.iver.cit.gvsig.gui.cad.tools.smc |
11 |
%import com.iver.cit.gvsig.gui.cad.tools.CircleCADTool |
12 |
%import java.awt.event.InputEvent |
13 |
%import com.iver.andami.PluginServices |
14 |
|
15 |
%map Circle |
16 |
%% |
17 |
// A task begins life in suspended animation. |
18 |
|
19 |
CenterPointOr3p |
20 |
|
21 |
Entry { |
22 |
setQuestion( |
23 |
PluginServices.getText(this,"insert_central_point_or_3p")); |
24 |
setDescription(new String[]{"cancel","3P"}); |
25 |
} |
26 |
Exit{ |
27 |
} |
28 |
|
29 |
{ |
30 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
31 |
PointOrRadius { |
32 |
setQuestion(PluginServices.getText(this,"insert_radius_or_second_point")); |
33 |
setDescription(new String[]{"cancel"}); |
34 |
addPoint( pointX,pointY,event); |
35 |
} |
36 |
addOption( s:String) |
37 |
[s.equals("3p") || s.equals("3P")] |
38 |
FirstPoint{ |
39 |
setQuestion(PluginServices.getText(this,"insert_first_point")); |
40 |
setDescription(new String[]{"cancel"}); |
41 |
addOption( s); |
42 |
} |
43 |
} |
44 |
PointOrRadius{ |
45 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
46 |
CenterPointOr3p { |
47 |
addPoint( pointX,pointY,event); |
48 |
end(); |
49 |
} |
50 |
addValue( d:double) |
51 |
CenterPointOr3p { |
52 |
addValue( d); |
53 |
end(); |
54 |
} |
55 |
} |
56 |
SecondPoint{ |
57 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
58 |
ThirdPoint { |
59 |
setQuestion(PluginServices.getText(this,"insert_third_point")); |
60 |
setDescription(new String[]{"cancel"}); |
61 |
addPoint( pointX,pointY,event); |
62 |
} |
63 |
} |
64 |
ThirdPoint{ |
65 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
66 |
CenterPointOr3p { |
67 |
addPoint( pointX,pointY,event); |
68 |
end(); |
69 |
} |
70 |
} |
71 |
|
72 |
FirstPoint{ |
73 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
74 |
SecondPoint { |
75 |
setQuestion(PluginServices.getText(this,"insert_second_point")); |
76 |
setDescription(new String[]{"cancel"}); |
77 |
addPoint( pointX,pointY,event); |
78 |
} |
79 |
} |
80 |
|
81 |
Default |
82 |
{ |
83 |
addOption(s:String) |
84 |
[s.equals(PluginServices.getText(this,"cancel"))] |
85 |
CenterPointOr3p{ |
86 |
end(); |
87 |
} |
88 |
addOption(s:String) |
89 |
CenterPointOr3p{ |
90 |
throwOptionException(PluginServices.getText(this,"incorrect_option"),s); |
91 |
} |
92 |
addValue(d:double) |
93 |
CenterPointOr3p{ |
94 |
throwValueException(PluginServices.getText(this,"incorrect_value"),d); |
95 |
} |
96 |
addPoint(pointX:double,pointY:double,event:InputEvent) |
97 |
CenterPointOr3p{ |
98 |
throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY); |
99 |
} |
100 |
} |
101 |
%% |