svn-gvsig-desktop / tags / v1_1_Build_1000 / extensions / extCAD / sm / PolylineCADTool.sm @ 40339
History | View | Annotate | Download (3.34 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 | 4583 | caballero | setQuestion(PluginServices.getText(this,"insert_next_point_arc_or_close")); |
33 | 5395 | caballero | setDescription(new String[]{"inter_arc","close_polyline","terminate","cancel"}); |
34 | 4365 | caballero | addPoint( pointX,pointY,event); |
35 | 3766 | caballero | } |
36 | } |
||
37 | 3978 | caballero | NextPointOrArcOrClose{ |
38 | 3766 | caballero | |
39 | 3828 | caballero | addOption(s:String) |
40 | 5163 | caballero | [s.equals("A") || s.equals("a") || s.equals(PluginServices.getText(this,"inter_arc"))] |
41 | 3978 | caballero | NextPointOrLineOrClose { |
42 | 4583 | caballero | setQuestion(PluginServices.getText(this,"insert_next_point_line_or_close")); |
43 | 5395 | caballero | setDescription(new String[]{"inter_line","close_polyline","terminate","cancel"}); |
44 | 3828 | caballero | addOption(s); |
45 | 3766 | caballero | } |
46 | 3828 | caballero | addOption(s:String) |
47 | 5395 | caballero | [s.equals("C") || s.equals("c") || s.equals(PluginServices.getText(this,"close_polyline"))] |
48 | 3978 | caballero | FirstPoint { |
49 | 3828 | caballero | addOption(s); |
50 | 3883 | caballero | closeGeometry(); |
51 | endGeometry(); |
||
52 | 3766 | caballero | end(); |
53 | } |
||
54 | 5395 | caballero | 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 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
62 | 3978 | caballero | NextPointOrArcOrClose { |
63 | 4583 | caballero | setQuestion(PluginServices.getText(this,"insert_next_point_arc_or_close")); |
64 | 5395 | caballero | setDescription(new String[]{"inter_arc","close_polyline","terminate","cancel"}); |
65 | 4365 | caballero | addPoint( pointX,pointY,event); |
66 | 3766 | caballero | } |
67 | } |
||
68 | 3978 | caballero | NextPointOrLineOrClose{ |
69 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
70 | 3978 | caballero | NextPointOrLineOrClose { |
71 | 4583 | caballero | setQuestion(PluginServices.getText(this,"insert_next_point_line_or_close")); |
72 | 5395 | caballero | setDescription(new String[]{"inter_line","close_polyline","terminate","cancel"}); |
73 | 4365 | caballero | addPoint( pointX,pointY,event); |
74 | 3766 | caballero | } |
75 | 3828 | caballero | addOption(s:String) |
76 | 5163 | caballero | [s.equals("N") || s.equals("n") || s.equals(PluginServices.getText(this,"inter_line"))] |
77 | 3978 | caballero | NextPointOrArcOrClose { |
78 | 4583 | caballero | setQuestion(PluginServices.getText(this,"insert_next_point_arc_or_close")); |
79 | 5395 | caballero | setDescription(new String[]{"inter_arc","close_polyline","terminate","cancel"}); |
80 | 3828 | caballero | addOption(s); |
81 | 3766 | caballero | } |
82 | 3828 | caballero | addOption(s:String) |
83 | 5395 | caballero | [s.equals("C") || s.equals("c") || s.equals(PluginServices.getText(this,"close_polyline"))] |
84 | 3978 | caballero | FirstPoint { |
85 | 3828 | caballero | addOption(s); |
86 | 3883 | caballero | closeGeometry(); |
87 | endGeometry(); |
||
88 | 3766 | caballero | end(); |
89 | } |
||
90 | 5395 | caballero | 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 | 3883 | caballero | } |
99 | 3978 | caballero | |
100 | 3766 | caballero | Default |
101 | { |
||
102 | 3883 | caballero | addOption(s:String) |
103 | 4583 | caballero | [s.equals(PluginServices.getText(this,"cancel"))] |
104 | 3978 | caballero | FirstPoint{ |
105 | 3883 | caballero | cancel(); |
106 | } |
||
107 | 4002 | fjp | addOption(s:String) |
108 | [s.equals("")] |
||
109 | FirstPoint{ |
||
110 | endGeometry(); |
||
111 | } |
||
112 | 5730 | caballero | 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 | 4324 | caballero | |
125 | 3766 | caballero | } |
126 | %% |