root / trunk / extensions / extCAD / sm / RectangleCADTool.sm @ 11445
History | View | Annotate | Download (2 KB)
1 |
// -*- tab-width: 4; -*- |
---|---|
2 |
|
3 |
%{ |
4 |
// |
5 |
// Vicente Caballero Navarro |
6 |
%} |
7 |
|
8 |
%start Rectangle::FirstPoint |
9 |
%class RectangleCADTool |
10 |
%package com.iver.cit.gvsig.gui.cad.tools.smc |
11 |
%import com.iver.cit.gvsig.gui.cad.tools.RectangleCADTool |
12 |
%import java.awt.event.InputEvent |
13 |
%import com.iver.andami.PluginServices |
14 |
|
15 |
%map Rectangle |
16 |
%% |
17 |
// A task begins life in suspended animation. |
18 |
|
19 |
FirstPoint |
20 |
|
21 |
Entry { |
22 |
setQuestion( |
23 |
PluginServices.getText(this,"insert_first_point_corner")); |
24 |
setDescription(new String[]{"cancel"}); |
25 |
} |
26 |
Exit{ |
27 |
} |
28 |
|
29 |
{ |
30 |
|
31 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
32 |
SecondPointOrSquare { |
33 |
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 |
setDescription(new String[]{"square","cancel"}); |
39 |
addPoint( pointX,pointY,event); |
40 |
} |
41 |
|
42 |
} |
43 |
SecondPointOrSquare{ |
44 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
45 |
FirstPoint { |
46 |
addPoint(pointX,pointY,event); |
47 |
end(); |
48 |
} |
49 |
addOption(s:String) |
50 |
[s.equalsIgnoreCase(PluginServices.getText(this,"RectangleCADTool.square")) || s.equals(PluginServices.getText(this,"square"))] |
51 |
SecondPointSquare { |
52 |
setQuestion(PluginServices.getText(this,"insert_opposited_corner")); |
53 |
setDescription(new String[]{"cancel"}); |
54 |
addOption(s); |
55 |
} |
56 |
|
57 |
} |
58 |
SecondPointSquare{ |
59 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
60 |
FirstPoint { |
61 |
addPoint( pointX,pointY,event); |
62 |
end(); |
63 |
} |
64 |
} |
65 |
|
66 |
Default |
67 |
{ |
68 |
addOption(s:String) |
69 |
[s.equals(PluginServices.getText(this,"cancel"))] |
70 |
FirstPoint{ |
71 |
end(); |
72 |
} |
73 |
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 |
} |
86 |
%% |