svn-gvsig-desktop / tags / v1_9_Build_1230 / extensions / extCAD / sm / MultiPointCADTool.sm
History | View | Annotate | Download (1.71 KB)
1 |
// -*- tab-width: 4; -*- |
---|---|
2 |
|
3 |
%{ |
4 |
// |
5 |
// Vicente Caballero Navarro |
6 |
%} |
7 |
|
8 |
%start MultiPoint::InsertPoint |
9 |
%class MultiPointCADTool |
10 |
%package com.iver.cit.gvsig.gui.cad.tools.smc |
11 |
%import com.iver.cit.gvsig.gui.cad.tools.MultiPointCADTool |
12 |
%import java.awt.event.InputEvent |
13 |
%import com.iver.andami.PluginServices |
14 |
|
15 |
|
16 |
%map MultiPoint |
17 |
%% |
18 |
// A task begins life in suspended animation. |
19 |
|
20 |
InsertPoint |
21 |
|
22 |
Entry { |
23 |
setQuestion( |
24 |
PluginServices.getText(this,"insert_point")); |
25 |
setDescription(new String[]{"cancel",}); |
26 |
} |
27 |
Exit { |
28 |
} |
29 |
|
30 |
{ |
31 |
|
32 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
33 |
InsertPoint { |
34 |
setQuestion( |
35 |
PluginServices.getText(this,"insert_point")+" "+ |
36 |
PluginServices.getText(this,"cad.or")+" "+ |
37 |
PluginServices.getText(this,"end")+ |
38 |
"["+PluginServices.getText(this,"MultipointCADTool.end")+"]"); |
39 |
|
40 |
setDescription(new String[]{"cancel","end"}); |
41 |
addPoint( pointX,pointY,event); |
42 |
} |
43 |
addOption( s:String) |
44 |
[s.equalsIgnoreCase(PluginServices.getText(this,"MultipointCADTool.end")) || s.equals(PluginServices.getText(this,"end"))] |
45 |
InsertPoint { |
46 |
setQuestion(PluginServices.getText(this,"insert_point")); |
47 |
setDescription(new String[]{"cancel"}); |
48 |
addOption(s); |
49 |
endGeometry(); |
50 |
} |
51 |
} |
52 |
|
53 |
Default |
54 |
{ |
55 |
addOption(s:String) |
56 |
[s.equals(PluginServices.getText(this,"cancel"))] |
57 |
InsertPoint{ |
58 |
end(); |
59 |
} |
60 |
addOption(s:String) |
61 |
InsertPoint{ |
62 |
throwOptionException(PluginServices.getText(this,"incorrect_option"),s); |
63 |
} |
64 |
addValue(d:double) |
65 |
InsertPoint{ |
66 |
throwValueException(PluginServices.getText(this,"incorrect_value"),d); |
67 |
} |
68 |
addPoint(pointX:double,pointY:double,event:InputEvent) |
69 |
InsertPoint{ |
70 |
throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY); |
71 |
} |
72 |
} |
73 |
%% |