svn-gvsig-desktop / trunk / extensions / extCAD / sm / PolylineCADTool.sm @ 4892
History | View | Annotate | Download (2.45 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(PluginServices.getText(this,"insert_next_point_arc_or_close")); |
33 |
setDescription(new String[]{"arc","close","cancel"}); |
34 |
addPoint( pointX,pointY,event); |
35 |
} |
36 |
} |
37 |
NextPointOrArcOrClose{ |
38 |
|
39 |
addOption(s:String) |
40 |
[s.equals("A") || s.equals("a") || s.equals(PluginServices.getText(this,"arc"))] |
41 |
NextPointOrLineOrClose { |
42 |
setQuestion(PluginServices.getText(this,"insert_next_point_line_or_close")); |
43 |
setDescription(new String[]{"line","close","cancel"}); |
44 |
addOption(s); |
45 |
} |
46 |
addOption(s:String) |
47 |
[s.equals("C") || s.equals("c") || s.equals(PluginServices.getText(this,"close"))] |
48 |
FirstPoint { |
49 |
addOption(s); |
50 |
closeGeometry(); |
51 |
endGeometry(); |
52 |
end(); |
53 |
} |
54 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
55 |
NextPointOrArcOrClose { |
56 |
setQuestion(PluginServices.getText(this,"insert_next_point_arc_or_close")); |
57 |
setDescription(new String[]{"arc","close","cancel"}); |
58 |
addPoint( pointX,pointY,event); |
59 |
} |
60 |
} |
61 |
NextPointOrLineOrClose{ |
62 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
63 |
NextPointOrLineOrClose { |
64 |
setQuestion(PluginServices.getText(this,"insert_next_point_line_or_close")); |
65 |
setDescription(new String[]{"line","close","cancel"}); |
66 |
addPoint( pointX,pointY,event); |
67 |
} |
68 |
addOption(s:String) |
69 |
[s.equals("N") || s.equals("n") || s.equals(PluginServices.getText(this,"line"))] |
70 |
NextPointOrArcOrClose { |
71 |
setQuestion(PluginServices.getText(this,"insert_next_point_arc_or_close")); |
72 |
setDescription(new String[]{"arc","close","cancel"}); |
73 |
addOption(s); |
74 |
} |
75 |
addOption(s:String) |
76 |
[s.equals("C") || s.equals("c") || s.equals(PluginServices.getText(this,"close"))] |
77 |
FirstPoint { |
78 |
addOption(s); |
79 |
closeGeometry(); |
80 |
endGeometry(); |
81 |
end(); |
82 |
} |
83 |
} |
84 |
|
85 |
Default |
86 |
{ |
87 |
addOption(s:String) |
88 |
[s.equals(PluginServices.getText(this,"cancel"))] |
89 |
FirstPoint{ |
90 |
cancel(); |
91 |
} |
92 |
addOption(s:String) |
93 |
[s.equals("")] |
94 |
FirstPoint{ |
95 |
endGeometry(); |
96 |
} |
97 |
|
98 |
} |
99 |
%% |