svn-gvsig-desktop / tags / v1_9_RC1 / extensions / extCAD / sm / SplineCADTool.sm @ 43233
History | View | Annotate | Download (2.65 KB)
1 | 8928 | caballero | // -*- tab-width: 4; -*- |
---|---|---|---|
2 | |||
3 | %{ |
||
4 | // |
||
5 | // Vicente Caballero Navarro |
||
6 | %} |
||
7 | |||
8 | %start Spline::FirstPoint |
||
9 | %class SplineCADTool |
||
10 | %package com.iver.cit.gvsig.gui.cad.tools.smc |
||
11 | %import com.iver.cit.gvsig.gui.cad.tools.SplineCADTool |
||
12 | %import java.awt.event.InputEvent |
||
13 | %import com.iver.andami.PluginServices |
||
14 | |||
15 | %map Spline |
||
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 | NextPoint{ |
||
32 | 9121 | caballero | setQuestion( |
33 | PluginServices.getText(this,"insert_next_point")+", "+ |
||
34 | PluginServices.getText(this,"close")+" "+ |
||
35 | "["+PluginServices.getText(this,"SplineCADTool.close")+"] "+ |
||
36 | PluginServices.getText(this,"cad.or")+" "+ |
||
37 | PluginServices.getText(this,"end")+" "+ |
||
38 | "["+PluginServices.getText(this,"SplineCADTool.end")+"]"); |
||
39 | setDescription(new String[]{"close","terminate","cancel"}); |
||
40 | 8928 | caballero | addPoint( pointX,pointY,event); |
41 | } |
||
42 | } |
||
43 | NextPoint{ |
||
44 | |||
45 | addOption(s:String) |
||
46 | 9121 | caballero | [s.equalsIgnoreCase(PluginServices.getText(this,"SplineCADTool.close")) || s.equals(PluginServices.getText(this,"close"))] |
47 | 8928 | caballero | FirstPoint { |
48 | addOption(s); |
||
49 | closeGeometry(); |
||
50 | endGeometry(); |
||
51 | end(); |
||
52 | } |
||
53 | addOption(s:String) |
||
54 | 9121 | caballero | [s.equalsIgnoreCase(PluginServices.getText(this,"SplineCADTool.end")) || s.equals(PluginServices.getText(this,"terminate"))] |
55 | 8928 | caballero | FirstPoint { |
56 | addOption(s); |
||
57 | endGeometry(); |
||
58 | end(); |
||
59 | } |
||
60 | addPoint( pointX:double,pointY:double,event:InputEvent) |
||
61 | NextPoint { |
||
62 | 9121 | caballero | setQuestion( |
63 | PluginServices.getText(this,"insert_next_point")+", "+ |
||
64 | PluginServices.getText(this,"close")+" "+ |
||
65 | "["+PluginServices.getText(this,"SplineCADTool.close")+"] "+ |
||
66 | PluginServices.getText(this,"cad.or")+" "+ |
||
67 | PluginServices.getText(this,"end")+" "+ |
||
68 | "["+PluginServices.getText(this,"SplineCADTool.end")+"]"); |
||
69 | setDescription(new String[]{"close","terminate","cancel"}); |
||
70 | 8928 | caballero | addPoint( pointX,pointY,event); |
71 | } |
||
72 | } |
||
73 | |||
74 | Default |
||
75 | { |
||
76 | addOption(s:String) |
||
77 | [s.equals(PluginServices.getText(this,"cancel"))] |
||
78 | FirstPoint{ |
||
79 | cancel(); |
||
80 | } |
||
81 | addOption(s:String) |
||
82 | [s.equals("")] |
||
83 | FirstPoint{ |
||
84 | endGeometry(); |
||
85 | } |
||
86 | addOption(s:String) |
||
87 | FirstPoint{ |
||
88 | throwOptionException(PluginServices.getText(this,"incorrect_option"),s); |
||
89 | } |
||
90 | addValue(d:double) |
||
91 | FirstPoint{ |
||
92 | throwValueException(PluginServices.getText(this,"incorrect_value"),d); |
||
93 | } |
||
94 | addPoint(pointX:double,pointY:double,event:InputEvent) |
||
95 | FirstPoint{ |
||
96 | throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY); |
||
97 | } |
||
98 | 17984 | vcaballero | endPoint(pointX:double,pointY:double,event:InputEvent) |
99 | FirstPoint{ |
||
100 | addPoint( pointX,pointY,event); |
||
101 | endGeometry(); |
||
102 | } |
||
103 | 8928 | caballero | |
104 | } |
||
105 | %% |