svn-gvsig-desktop / tags / v1_11_0_Build_1304 / extensions / extCAD / sm / PolylineCADTool.sm @ 40002
History | View | Annotate | Download (8.74 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 |
[ctxt.isPolygonLayer()] |
32 |
NextPointOrArcOrClose{ |
33 |
setQuestion( |
34 |
PluginServices.getText(this,"insert_next_point")+", "+ |
35 |
PluginServices.getText(this,"arc")+ |
36 |
"["+PluginServices.getText(this,"PolylineCADTool.arc")+"], "+ |
37 |
PluginServices.getText(this,"cad.or")+" "+ |
38 |
PluginServices.getText(this,"end")+ |
39 |
"["+PluginServices.getText(this,"PolylineCADTool.end")+"]"); |
40 |
setDescription(new String[]{"inter_arc","terminate","cancel"}); |
41 |
addPoint( pointX,pointY,event); |
42 |
} |
43 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
44 |
NextPointOrArcOrClose{ |
45 |
setQuestion( |
46 |
PluginServices.getText(this,"insert_next_point")+", "+ |
47 |
PluginServices.getText(this,"arc")+ |
48 |
"["+PluginServices.getText(this,"PolylineCADTool.arc")+"], "+ |
49 |
PluginServices.getText(this,"close_polyline")+ |
50 |
"["+PluginServices.getText(this,"PolylineCADTool.close_polyline")+"], "+ |
51 |
PluginServices.getText(this,"cad.or")+" "+ |
52 |
PluginServices.getText(this,"end")+ |
53 |
"["+PluginServices.getText(this,"PolylineCADTool.end")+"]"); |
54 |
setDescription(new String[]{"inter_arc","close_polyline","terminate","cancel"}); |
55 |
addPoint( pointX,pointY,event); |
56 |
} |
57 |
} |
58 |
NextPointOrArcOrClose{ |
59 |
addOption(s:String) |
60 |
[ctxt.isPolygonLayer() && (s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.arc")) || s.equals(PluginServices.getText(this,"inter_arc")))] |
61 |
NextPointOrLineOrClose { |
62 |
setQuestion( |
63 |
PluginServices.getText(this,"insert_next_point")+", "+ |
64 |
PluginServices.getText(this,"line")+ |
65 |
"["+PluginServices.getText(this,"PolylineCADTool.line")+"], "+ |
66 |
PluginServices.getText(this,"cad.or")+" "+ |
67 |
PluginServices.getText(this,"end")+ |
68 |
"["+PluginServices.getText(this,"PolylineCADTool.end")+"]"); |
69 |
setDescription(new String[]{"inter_line","terminate","cancel"}); |
70 |
addOption(s); |
71 |
} |
72 |
addOption(s:String) |
73 |
[s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.arc")) || s.equals(PluginServices.getText(this,"inter_arc"))] |
74 |
NextPointOrLineOrClose { |
75 |
setQuestion( |
76 |
PluginServices.getText(this,"insert_next_point")+", "+ |
77 |
PluginServices.getText(this,"line")+ |
78 |
"["+PluginServices.getText(this,"PolylineCADTool.line")+"], "+ |
79 |
PluginServices.getText(this,"close_polyline")+ |
80 |
"["+PluginServices.getText(this,"PolylineCADTool.close_polyline")+"], "+ |
81 |
PluginServices.getText(this,"cad.or")+" "+ |
82 |
PluginServices.getText(this,"end")+ |
83 |
"["+PluginServices.getText(this,"PolylineCADTool.end")+"]"); |
84 |
setDescription(new String[]{"inter_line","close_polyline","terminate","cancel"}); |
85 |
addOption(s); |
86 |
} |
87 |
addOption(s:String) |
88 |
[s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.close_polyline")) || s.equals(PluginServices.getText(this,"close_polyline"))] |
89 |
FirstPoint { |
90 |
addOption(s); |
91 |
closeGeometry(); |
92 |
endGeometry(); |
93 |
end(); |
94 |
} |
95 |
addOption(s:String) |
96 |
[(s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.end")) || s.equals(PluginServices.getText(this,"terminate"))) && ctxt.getLinesCount()!=0 ] |
97 |
FirstPoint { |
98 |
addOption(s); |
99 |
endGeometry(); |
100 |
end(); |
101 |
} |
102 |
addOption(s:String) |
103 |
[!s.equals(PluginServices.getText(this,"cancel"))] |
104 |
NextPointOrArcOrClose { |
105 |
} |
106 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
107 |
[ctxt.isPolygonLayer()] |
108 |
NextPointOrArcOrClose { |
109 |
setQuestion( |
110 |
PluginServices.getText(this,"insert_next_point")+", "+ |
111 |
PluginServices.getText(this,"arc")+ |
112 |
"["+PluginServices.getText(this,"PolylineCADTool.arc")+"], "+ |
113 |
PluginServices.getText(this,"cad.or")+" "+ |
114 |
PluginServices.getText(this,"end")+ |
115 |
"["+PluginServices.getText(this,"PolylineCADTool.end")+"]"); |
116 |
setDescription(new String[]{"inter_arc","terminate","cancel"}); |
117 |
addPoint( pointX,pointY,event); |
118 |
} |
119 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
120 |
NextPointOrArcOrClose { |
121 |
setQuestion( |
122 |
PluginServices.getText(this,"insert_next_point")+", "+ |
123 |
PluginServices.getText(this,"arc")+ |
124 |
"["+PluginServices.getText(this,"PolylineCADTool.arc")+"], "+ |
125 |
PluginServices.getText(this,"close_polyline")+ |
126 |
"["+PluginServices.getText(this,"PolylineCADTool.close_polyline")+"], "+ |
127 |
PluginServices.getText(this,"cad.or")+" "+ |
128 |
PluginServices.getText(this,"end")+ |
129 |
"["+PluginServices.getText(this,"PolylineCADTool.end")+"]"); |
130 |
setDescription(new String[]{"inter_arc","close_polyline","terminate","cancel"}); |
131 |
addPoint( pointX,pointY,event); |
132 |
} |
133 |
} |
134 |
NextPointOrLineOrClose{ |
135 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
136 |
[ctxt.isPolygonLayer()] |
137 |
NextPointOrLineOrClose { |
138 |
setQuestion( |
139 |
PluginServices.getText(this,"insert_next_point")+", "+ |
140 |
PluginServices.getText(this,"line")+ |
141 |
"["+PluginServices.getText(this,"PolylineCADTool.line")+"], "+ |
142 |
PluginServices.getText(this,"cad.or")+" "+ |
143 |
PluginServices.getText(this,"end")+ |
144 |
"["+PluginServices.getText(this,"PolylineCADTool.end")+"]"); |
145 |
setDescription(new String[]{"inter_line","terminate","cancel"}); |
146 |
addPoint( pointX,pointY,event); |
147 |
} |
148 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
149 |
NextPointOrLineOrClose { |
150 |
setQuestion( |
151 |
PluginServices.getText(this,"insert_next_point")+", "+ |
152 |
PluginServices.getText(this,"line")+ |
153 |
"["+PluginServices.getText(this,"PolylineCADTool.line")+"], "+ |
154 |
PluginServices.getText(this,"close_polyline")+ |
155 |
"["+PluginServices.getText(this,"PolylineCADTool.close_polyline")+"], "+ |
156 |
PluginServices.getText(this,"cad.or")+" "+ |
157 |
PluginServices.getText(this,"end")+ |
158 |
"["+PluginServices.getText(this,"PolylineCADTool.end")+"]"); |
159 |
setDescription(new String[]{"inter_line","close_polyline","terminate","cancel"}); |
160 |
addPoint( pointX,pointY,event); |
161 |
} |
162 |
addOption(s:String) |
163 |
[ctxt.isPolygonLayer() && (s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.line")) || s.equals(PluginServices.getText(this,"inter_line")))] |
164 |
NextPointOrArcOrClose { |
165 |
setQuestion( |
166 |
PluginServices.getText(this,"insert_next_point")+", "+ |
167 |
PluginServices.getText(this,"arc")+ |
168 |
"["+PluginServices.getText(this,"PolylineCADTool.arc")+"], "+ |
169 |
PluginServices.getText(this,"cad.or")+" "+ |
170 |
PluginServices.getText(this,"end")+ |
171 |
"["+PluginServices.getText(this,"PolylineCADTool.end")+"]"); |
172 |
setDescription(new String[]{"inter_arc","terminate","cancel"}); |
173 |
addOption(s); |
174 |
} |
175 |
addOption(s:String) |
176 |
[s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.line")) || s.equals(PluginServices.getText(this,"inter_line"))] |
177 |
NextPointOrArcOrClose { |
178 |
setQuestion( |
179 |
PluginServices.getText(this,"insert_next_point")+", "+ |
180 |
PluginServices.getText(this,"arc")+ |
181 |
"["+PluginServices.getText(this,"PolylineCADTool.arc")+"], "+ |
182 |
PluginServices.getText(this,"close_polyline")+ |
183 |
"["+PluginServices.getText(this,"PolylineCADTool.close_polyline")+"], "+ |
184 |
PluginServices.getText(this,"cad.or")+" "+ |
185 |
PluginServices.getText(this,"end")+ |
186 |
"["+PluginServices.getText(this,"PolylineCADTool.end")+"]"); |
187 |
setDescription(new String[]{"inter_arc","close_polyline","terminate","cancel"}); |
188 |
addOption(s); |
189 |
} |
190 |
addOption(s:String) |
191 |
[s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.close_polyline")) || s.equals(PluginServices.getText(this,"close_polyline"))] |
192 |
FirstPoint { |
193 |
addOption(s); |
194 |
closeGeometry(); |
195 |
endGeometry(); |
196 |
end(); |
197 |
} |
198 |
addOption(s:String) |
199 |
[(s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.end")) || s.equals(PluginServices.getText(this,"terminate"))) && ctxt.getLinesCount()!=0] |
200 |
FirstPoint { |
201 |
addOption(s); |
202 |
endGeometry(); |
203 |
end(); |
204 |
} |
205 |
addOption(s:String) |
206 |
[!s.equals(PluginServices.getText(this,"cancel"))] |
207 |
NextPointOrLineOrClose { |
208 |
} |
209 |
} |
210 |
|
211 |
Default |
212 |
{ |
213 |
addOption(s:String) |
214 |
[s.equals(PluginServices.getText(this,"cancel"))] |
215 |
FirstPoint{ |
216 |
cancel(); |
217 |
} |
218 |
addOption(s:String) |
219 |
[s.equals("")] |
220 |
FirstPoint{ |
221 |
endGeometry(); |
222 |
} |
223 |
addOption(s:String) |
224 |
FirstPoint{ |
225 |
throwOptionException(PluginServices.getText(this,"incorrect_option"),s); |
226 |
} |
227 |
addValue(d:double) |
228 |
FirstPoint{ |
229 |
throwValueException(PluginServices.getText(this,"incorrect_value"),d); |
230 |
} |
231 |
addPoint(pointX:double,pointY:double,event:InputEvent) |
232 |
FirstPoint{ |
233 |
throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY); |
234 |
} |
235 |
endPoint(pointX:double,pointY:double,event:InputEvent) |
236 |
FirstPoint{ |
237 |
addPoint( pointX,pointY,event); |
238 |
endGeometry(); |
239 |
} |
240 |
|
241 |
} |
242 |
%% |