svn-gvsig-desktop / trunk / extensions / extCAD / sm / PolylineCADTool.sm @ 13561
History | View | Annotate | Download (5.75 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( |
33 |
PluginServices.getText(this,"insert_next_point")+", "+ |
34 |
PluginServices.getText(this,"arc")+ |
35 |
"["+PluginServices.getText(this,"PolylineCADTool.arc")+"], "+ |
36 |
PluginServices.getText(this,"close_polyline")+ |
37 |
"["+PluginServices.getText(this,"PolylineCADTool.close_polyline")+"], "+ |
38 |
PluginServices.getText(this,"cad.or")+" "+ |
39 |
PluginServices.getText(this,"end")+ |
40 |
"["+PluginServices.getText(this,"PolylineCADTool.end")+"]"); |
41 |
setDescription(new String[]{"inter_arc","close_polyline","terminate","cancel"}); |
42 |
addPoint( pointX,pointY,event); |
43 |
} |
44 |
} |
45 |
NextPointOrArcOrClose{ |
46 |
|
47 |
addOption(s:String) |
48 |
[s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.arc")) || s.equals(PluginServices.getText(this,"inter_arc"))] |
49 |
NextPointOrLineOrClose { |
50 |
setQuestion( |
51 |
PluginServices.getText(this,"insert_next_point")+", "+ |
52 |
PluginServices.getText(this,"line")+ |
53 |
"["+PluginServices.getText(this,"PolylineCADTool.line")+"], "+ |
54 |
PluginServices.getText(this,"close_polyline")+ |
55 |
"["+PluginServices.getText(this,"PolylineCADTool.close_polyline")+"], "+ |
56 |
PluginServices.getText(this,"cad.or")+" "+ |
57 |
PluginServices.getText(this,"end")+ |
58 |
"["+PluginServices.getText(this,"PolylineCADTool.end")+"]"); |
59 |
setDescription(new String[]{"inter_line","close_polyline","terminate","cancel"}); |
60 |
addOption(s); |
61 |
} |
62 |
addOption(s:String) |
63 |
[s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.close_polyline")) || s.equals(PluginServices.getText(this,"close_polyline"))] |
64 |
FirstPoint { |
65 |
addOption(s); |
66 |
closeGeometry(); |
67 |
endGeometry(); |
68 |
end(); |
69 |
} |
70 |
addOption(s:String) |
71 |
[(s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.end")) || s.equals(PluginServices.getText(this,"terminate"))) && ctxt.getLinesCount()!=0 ] |
72 |
FirstPoint { |
73 |
addOption(s); |
74 |
endGeometry(); |
75 |
end(); |
76 |
} |
77 |
addOption(s:String) |
78 |
[!s.equals(PluginServices.getText(this,"cancel"))] |
79 |
NextPointOrArcOrClose { |
80 |
} |
81 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
82 |
NextPointOrArcOrClose { |
83 |
setQuestion( |
84 |
PluginServices.getText(this,"insert_next_point")+", "+ |
85 |
PluginServices.getText(this,"arc")+ |
86 |
"["+PluginServices.getText(this,"PolylineCADTool.arc")+"], "+ |
87 |
PluginServices.getText(this,"close_polyline")+ |
88 |
"["+PluginServices.getText(this,"PolylineCADTool.close_polyline")+"], "+ |
89 |
PluginServices.getText(this,"cad.or")+" "+ |
90 |
PluginServices.getText(this,"end")+ |
91 |
"["+PluginServices.getText(this,"PolylineCADTool.end")+"]"); |
92 |
setDescription(new String[]{"inter_arc","close_polyline","terminate","cancel"}); |
93 |
addPoint( pointX,pointY,event); |
94 |
} |
95 |
} |
96 |
NextPointOrLineOrClose{ |
97 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
98 |
NextPointOrLineOrClose { |
99 |
setQuestion( |
100 |
PluginServices.getText(this,"insert_next_point")+", "+ |
101 |
PluginServices.getText(this,"line")+ |
102 |
"["+PluginServices.getText(this,"PolylineCADTool.line")+"], "+ |
103 |
PluginServices.getText(this,"close_polyline")+ |
104 |
"["+PluginServices.getText(this,"PolylineCADTool.close_polyline")+"], "+ |
105 |
PluginServices.getText(this,"cad.or")+" "+ |
106 |
PluginServices.getText(this,"end")+ |
107 |
"["+PluginServices.getText(this,"PolylineCADTool.end")+"]"); |
108 |
setDescription(new String[]{"inter_line","close_polyline","terminate","cancel"}); |
109 |
addPoint( pointX,pointY,event); |
110 |
} |
111 |
addOption(s:String) |
112 |
[s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.line")) || s.equals(PluginServices.getText(this,"inter_line"))] |
113 |
NextPointOrArcOrClose { |
114 |
setQuestion( |
115 |
PluginServices.getText(this,"insert_next_point")+", "+ |
116 |
PluginServices.getText(this,"arc")+ |
117 |
"["+PluginServices.getText(this,"PolylineCADTool.arc")+"], "+ |
118 |
PluginServices.getText(this,"close_polyline")+ |
119 |
"["+PluginServices.getText(this,"PolylineCADTool.close_polyline")+"], "+ |
120 |
PluginServices.getText(this,"cad.or")+" "+ |
121 |
PluginServices.getText(this,"end")+ |
122 |
"["+PluginServices.getText(this,"PolylineCADTool.end")+"]"); |
123 |
setDescription(new String[]{"inter_arc","close_polyline","terminate","cancel"}); |
124 |
addOption(s); |
125 |
} |
126 |
addOption(s:String) |
127 |
[s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.close_polyline")) || s.equals(PluginServices.getText(this,"close_polyline"))] |
128 |
FirstPoint { |
129 |
addOption(s); |
130 |
closeGeometry(); |
131 |
endGeometry(); |
132 |
end(); |
133 |
} |
134 |
addOption(s:String) |
135 |
[(s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.end")) || s.equals(PluginServices.getText(this,"terminate"))) && ctxt.getLinesCount()!=0] |
136 |
FirstPoint { |
137 |
addOption(s); |
138 |
endGeometry(); |
139 |
end(); |
140 |
} |
141 |
addOption(s:String) |
142 |
[!s.equals(PluginServices.getText(this,"cancel"))] |
143 |
NextPointOrLineOrClose { |
144 |
} |
145 |
} |
146 |
|
147 |
Default |
148 |
{ |
149 |
addOption(s:String) |
150 |
[s.equals(PluginServices.getText(this,"cancel"))] |
151 |
FirstPoint{ |
152 |
cancel(); |
153 |
} |
154 |
addOption(s:String) |
155 |
[s.equals("")] |
156 |
FirstPoint{ |
157 |
endGeometry(); |
158 |
} |
159 |
addOption(s:String) |
160 |
FirstPoint{ |
161 |
throwOptionException(PluginServices.getText(this,"incorrect_option"),s); |
162 |
} |
163 |
addValue(d:double) |
164 |
FirstPoint{ |
165 |
throwValueException(PluginServices.getText(this,"incorrect_value"),d); |
166 |
} |
167 |
addPoint(pointX:double,pointY:double,event:InputEvent) |
168 |
FirstPoint{ |
169 |
throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY); |
170 |
} |
171 |
|
172 |
} |
173 |
%% |