root / trunk / extensions / extCAD / sm / PolylineCADTool.sm @ 5730
History | View | Annotate | Download (3.34 KB)
1 |
// -*- tab-width: 4; -*- |
---|---|
2 |
|
3 |
%{ |
4 |
// |
5 |
// Vicente Caballero Navarro |
6 |
%} |
7 |
|
8 |
%start Polyline::FirstPoint |
9 |
%class PolylineCADTool |
10 |
%package com.iver.cit.gvsig.gui.cad.tools.smc |
11 |
%import com.iver.cit.gvsig.gui.cad.tools.PolylineCADTool |
12 |
%import java.awt.event.InputEvent |
13 |
%import com.iver.andami.PluginServices |
14 |
|
15 |
%map Polyline |
16 |
%% |
17 |
// A task begins life in suspended animation. |
18 |
|
19 |
FirstPoint |
20 |
|
21 |
Entry { |
22 |
setQuestion( |
23 |
PluginServices.getText(this,"insert_first_point")); |
24 |
setDescription(new String[]{"cancel"}); |
25 |
} |
26 |
Exit{ |
27 |
} |
28 |
|
29 |
{ |
30 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
31 |
NextPointOrArcOrClose{ |
32 |
setQuestion(PluginServices.getText(this,"insert_next_point_arc_or_close")); |
33 |
setDescription(new String[]{"inter_arc","close_polyline","terminate","cancel"}); |
34 |
addPoint( pointX,pointY,event); |
35 |
} |
36 |
} |
37 |
NextPointOrArcOrClose{ |
38 |
|
39 |
addOption(s:String) |
40 |
[s.equals("A") || s.equals("a") || s.equals(PluginServices.getText(this,"inter_arc"))] |
41 |
NextPointOrLineOrClose { |
42 |
setQuestion(PluginServices.getText(this,"insert_next_point_line_or_close")); |
43 |
setDescription(new String[]{"inter_line","close_polyline","terminate","cancel"}); |
44 |
addOption(s); |
45 |
} |
46 |
addOption(s:String) |
47 |
[s.equals("C") || s.equals("c") || s.equals(PluginServices.getText(this,"close_polyline"))] |
48 |
FirstPoint { |
49 |
addOption(s); |
50 |
closeGeometry(); |
51 |
endGeometry(); |
52 |
end(); |
53 |
} |
54 |
addOption(s:String) |
55 |
[s.equals("T") || s.equals("t") || s.equals(PluginServices.getText(this,"terminate"))] |
56 |
FirstPoint { |
57 |
addOption(s); |
58 |
endGeometry(); |
59 |
end(); |
60 |
} |
61 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
62 |
NextPointOrArcOrClose { |
63 |
setQuestion(PluginServices.getText(this,"insert_next_point_arc_or_close")); |
64 |
setDescription(new String[]{"inter_arc","close_polyline","terminate","cancel"}); |
65 |
addPoint( pointX,pointY,event); |
66 |
} |
67 |
} |
68 |
NextPointOrLineOrClose{ |
69 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
70 |
NextPointOrLineOrClose { |
71 |
setQuestion(PluginServices.getText(this,"insert_next_point_line_or_close")); |
72 |
setDescription(new String[]{"inter_line","close_polyline","terminate","cancel"}); |
73 |
addPoint( pointX,pointY,event); |
74 |
} |
75 |
addOption(s:String) |
76 |
[s.equals("N") || s.equals("n") || s.equals(PluginServices.getText(this,"inter_line"))] |
77 |
NextPointOrArcOrClose { |
78 |
setQuestion(PluginServices.getText(this,"insert_next_point_arc_or_close")); |
79 |
setDescription(new String[]{"inter_arc","close_polyline","terminate","cancel"}); |
80 |
addOption(s); |
81 |
} |
82 |
addOption(s:String) |
83 |
[s.equals("C") || s.equals("c") || s.equals(PluginServices.getText(this,"close_polyline"))] |
84 |
FirstPoint { |
85 |
addOption(s); |
86 |
closeGeometry(); |
87 |
endGeometry(); |
88 |
end(); |
89 |
} |
90 |
addOption(s:String) |
91 |
[s.equals("T") || s.equals("t") || s.equals(PluginServices.getText(this,"terminate"))] |
92 |
FirstPoint { |
93 |
addOption(s); |
94 |
endGeometry(); |
95 |
end(); |
96 |
} |
97 |
|
98 |
} |
99 |
|
100 |
Default |
101 |
{ |
102 |
addOption(s:String) |
103 |
[s.equals(PluginServices.getText(this,"cancel"))] |
104 |
FirstPoint{ |
105 |
cancel(); |
106 |
} |
107 |
addOption(s:String) |
108 |
[s.equals("")] |
109 |
FirstPoint{ |
110 |
endGeometry(); |
111 |
} |
112 |
addOption(s:String) |
113 |
FirstPoint{ |
114 |
throwOptionException(PluginServices.getText(this,"incorrect_option"),s); |
115 |
} |
116 |
addValue(d:double) |
117 |
FirstPoint{ |
118 |
throwValueException(PluginServices.getText(this,"incorrect_value"),d); |
119 |
} |
120 |
addPoint(pointX:double,pointY:double,event:InputEvent) |
121 |
FirstPoint{ |
122 |
throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY); |
123 |
} |
124 |
|
125 |
} |
126 |
%% |