root / trunk / extensions / extCAD / sm / PolylineCADTool.sm @ 11445
History | View | Annotate | Download (5.49 KB)
1 | 3766 | caballero | // -*- tab-width: 4; -*- |
---|---|---|---|
2 | |||
3 | %{ |
||
4 | // |
||
5 | // Vicente Caballero Navarro |
||
6 | %} |
||
7 | |||
8 | 3978 | caballero | %start Polyline::FirstPoint |
9 | 3766 | caballero | %class PolylineCADTool |
10 | %package com.iver.cit.gvsig.gui.cad.tools.smc |
||
11 | %import com.iver.cit.gvsig.gui.cad.tools.PolylineCADTool |
||
12 | 4324 | caballero | %import java.awt.event.InputEvent |
13 | 4583 | caballero | %import com.iver.andami.PluginServices |
14 | 3766 | caballero | |
15 | 3978 | caballero | %map Polyline |
16 | 3766 | caballero | %% |
17 | // A task begins life in suspended animation. |
||
18 | |||
19 | 3978 | caballero | FirstPoint |
20 | 3766 | caballero | |
21 | Entry { |
||
22 | 4892 | caballero | setQuestion( |
23 | 4583 | caballero | PluginServices.getText(this,"insert_first_point")); |
24 | setDescription(new String[]{"cancel"}); |
||
25 | 3766 | caballero | } |
26 | Exit{ |
||
27 | } |
||
28 | |||
29 | { |
||
30 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
31 | 3978 | caballero | NextPointOrArcOrClose{ |
32 | 9121 | caballero | 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 | 5395 | caballero | setDescription(new String[]{"inter_arc","close_polyline","terminate","cancel"}); |
42 | 4365 | caballero | addPoint( pointX,pointY,event); |
43 | 3766 | caballero | } |
44 | } |
||
45 | 3978 | caballero | NextPointOrArcOrClose{ |
46 | 3766 | caballero | |
47 | 3828 | caballero | addOption(s:String) |
48 | 9121 | caballero | [s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.arc")) || s.equals(PluginServices.getText(this,"inter_arc"))] |
49 | 3978 | caballero | NextPointOrLineOrClose { |
50 | 9121 | caballero | 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 | 5395 | caballero | setDescription(new String[]{"inter_line","close_polyline","terminate","cancel"}); |
60 | 3828 | caballero | addOption(s); |
61 | 3766 | caballero | } |
62 | 3828 | caballero | addOption(s:String) |
63 | 9121 | caballero | [s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.close_polyline")) || s.equals(PluginServices.getText(this,"close_polyline"))] |
64 | 3978 | caballero | FirstPoint { |
65 | 3828 | caballero | addOption(s); |
66 | 3883 | caballero | closeGeometry(); |
67 | endGeometry(); |
||
68 | 3766 | caballero | end(); |
69 | } |
||
70 | 5395 | caballero | addOption(s:String) |
71 | 9121 | caballero | [s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.end")) || s.equals(PluginServices.getText(this,"terminate"))] |
72 | 5395 | caballero | FirstPoint { |
73 | addOption(s); |
||
74 | endGeometry(); |
||
75 | end(); |
||
76 | } |
||
77 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
78 | 3978 | caballero | NextPointOrArcOrClose { |
79 | 9121 | caballero | setQuestion( |
80 | PluginServices.getText(this,"insert_next_point")+", "+ |
||
81 | PluginServices.getText(this,"arc")+ |
||
82 | "["+PluginServices.getText(this,"PolylineCADTool.arc")+"], "+ |
||
83 | PluginServices.getText(this,"close_polyline")+ |
||
84 | "["+PluginServices.getText(this,"PolylineCADTool.close_polyline")+"], "+ |
||
85 | PluginServices.getText(this,"cad.or")+" "+ |
||
86 | PluginServices.getText(this,"end")+ |
||
87 | "["+PluginServices.getText(this,"PolylineCADTool.end")+"]"); |
||
88 | 5395 | caballero | setDescription(new String[]{"inter_arc","close_polyline","terminate","cancel"}); |
89 | 4365 | caballero | addPoint( pointX,pointY,event); |
90 | 3766 | caballero | } |
91 | } |
||
92 | 3978 | caballero | NextPointOrLineOrClose{ |
93 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
94 | 3978 | caballero | NextPointOrLineOrClose { |
95 | 9121 | caballero | setQuestion( |
96 | PluginServices.getText(this,"insert_next_point")+", "+ |
||
97 | PluginServices.getText(this,"line")+ |
||
98 | "["+PluginServices.getText(this,"PolylineCADTool.line")+"], "+ |
||
99 | PluginServices.getText(this,"close_polyline")+ |
||
100 | "["+PluginServices.getText(this,"PolylineCADTool.close_polyline")+"], "+ |
||
101 | PluginServices.getText(this,"cad.or")+" "+ |
||
102 | PluginServices.getText(this,"end")+ |
||
103 | "["+PluginServices.getText(this,"PolylineCADTool.end")+"]"); |
||
104 | 5395 | caballero | setDescription(new String[]{"inter_line","close_polyline","terminate","cancel"}); |
105 | 4365 | caballero | addPoint( pointX,pointY,event); |
106 | 3766 | caballero | } |
107 | 3828 | caballero | addOption(s:String) |
108 | 9121 | caballero | [s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.line")) || s.equals(PluginServices.getText(this,"inter_line"))] |
109 | 3978 | caballero | NextPointOrArcOrClose { |
110 | 9121 | caballero | setQuestion( |
111 | PluginServices.getText(this,"insert_next_point")+", "+ |
||
112 | PluginServices.getText(this,"arc")+ |
||
113 | "["+PluginServices.getText(this,"PolylineCADTool.arc")+"], "+ |
||
114 | PluginServices.getText(this,"close_polyline")+ |
||
115 | "["+PluginServices.getText(this,"PolylineCADTool.close_polyline")+"], "+ |
||
116 | PluginServices.getText(this,"cad.or")+" "+ |
||
117 | PluginServices.getText(this,"end")+ |
||
118 | "["+PluginServices.getText(this,"PolylineCADTool.end")+"]"); |
||
119 | 5395 | caballero | setDescription(new String[]{"inter_arc","close_polyline","terminate","cancel"}); |
120 | 3828 | caballero | addOption(s); |
121 | 3766 | caballero | } |
122 | 3828 | caballero | addOption(s:String) |
123 | 9121 | caballero | [s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.close_polyline")) || s.equals(PluginServices.getText(this,"close_polyline"))] |
124 | 3978 | caballero | FirstPoint { |
125 | 3828 | caballero | addOption(s); |
126 | 3883 | caballero | closeGeometry(); |
127 | endGeometry(); |
||
128 | 3766 | caballero | end(); |
129 | } |
||
130 | 5395 | caballero | addOption(s:String) |
131 | 9121 | caballero | [s.equalsIgnoreCase(PluginServices.getText(this,"PolylineCADTool.end")) || s.equals(PluginServices.getText(this,"terminate"))] |
132 | 5395 | caballero | FirstPoint { |
133 | addOption(s); |
||
134 | endGeometry(); |
||
135 | end(); |
||
136 | } |
||
137 | |||
138 | 3883 | caballero | } |
139 | 3978 | caballero | |
140 | 3766 | caballero | Default |
141 | { |
||
142 | 3883 | caballero | addOption(s:String) |
143 | 4583 | caballero | [s.equals(PluginServices.getText(this,"cancel"))] |
144 | 3978 | caballero | FirstPoint{ |
145 | 3883 | caballero | cancel(); |
146 | } |
||
147 | 4002 | fjp | addOption(s:String) |
148 | [s.equals("")] |
||
149 | FirstPoint{ |
||
150 | endGeometry(); |
||
151 | } |
||
152 | 5730 | caballero | addOption(s:String) |
153 | FirstPoint{ |
||
154 | throwOptionException(PluginServices.getText(this,"incorrect_option"),s); |
||
155 | } |
||
156 | addValue(d:double) |
||
157 | FirstPoint{ |
||
158 | throwValueException(PluginServices.getText(this,"incorrect_value"),d); |
||
159 | } |
||
160 | addPoint(pointX:double,pointY:double,event:InputEvent) |
||
161 | FirstPoint{ |
||
162 | throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY); |
||
163 | } |
||
164 | 4324 | caballero | |
165 | 3766 | caballero | } |
166 | %% |