svn-gvsig-desktop / tags / v2_0_Build_1215 / extensions / extCAD / sm / BreakCADTool.sm @ 44644
History | View | Annotate | Download (2.33 KB)
1 | 5388 | caballero | // -*- tab-width: 4; -*- |
---|---|---|---|
2 | |||
3 | %{ |
||
4 | // |
||
5 | // Vicente Caballero Navarro |
||
6 | %} |
||
7 | |||
8 | %start Break::FirstPoint |
||
9 | %class BreakCADTool |
||
10 | %package com.iver.cit.gvsig.gui.cad.tools.smc |
||
11 | %import com.iver.cit.gvsig.gui.cad.tools.BreakCADTool |
||
12 | %import java.awt.event.InputEvent |
||
13 | %import com.iver.andami.PluginServices |
||
14 | |||
15 | %map Break |
||
16 | %% |
||
17 | // A task begins life in suspended animation. |
||
18 | |||
19 | FirstPoint |
||
20 | Entry { |
||
21 | selection(); |
||
22 | setQuestion( |
||
23 | PluginServices.getText(this,"insert_first_point")); |
||
24 | setDescription(new String[]{"cancel"}); |
||
25 | |||
26 | } |
||
27 | Exit{ |
||
28 | } |
||
29 | |||
30 | { |
||
31 | addPoint( pointX:double,pointY:double,event:InputEvent) |
||
32 | [ctxt.intersects(pointX,pointY)] |
||
33 | SecondPoint { |
||
34 | setQuestion(PluginServices.getText(this,"insert_second_point")); |
||
35 | setDescription(new String[]{"cancel"}); |
||
36 | addPoint( pointX,pointY,event); |
||
37 | } |
||
38 | addPoint( pointX:double,pointY:double,event:InputEvent) |
||
39 | [!ctxt.intersects(pointX,pointY)] |
||
40 | FirstPoint { |
||
41 | setQuestion(PluginServices.getText(this,"insert_first_point")); |
||
42 | setDescription(new String[]{"cancel"}); |
||
43 | } |
||
44 | addOption(s:String) |
||
45 | FirstPoint { |
||
46 | setQuestion(PluginServices.getText(this,"insert_first_point")); |
||
47 | setDescription(new String[]{"cancel"}); |
||
48 | addOption(s); |
||
49 | } |
||
50 | } |
||
51 | |||
52 | |||
53 | SecondPoint |
||
54 | { |
||
55 | addPoint( pointX:double,pointY:double,event:InputEvent) |
||
56 | [ctxt.intersects(pointX,pointY)] |
||
57 | FirstPoint { |
||
58 | setQuestion(PluginServices.getText(this,"insert_first_point")); |
||
59 | setDescription(new String[]{"cancel"}); |
||
60 | addPoint( pointX,pointY,event); |
||
61 | end(); |
||
62 | } |
||
63 | addPoint( pointX:double,pointY:double,event:InputEvent) |
||
64 | [!ctxt.intersects(pointX,pointY)] |
||
65 | SecondPoint { |
||
66 | setQuestion(PluginServices.getText(this,"insert_second_point")); |
||
67 | setDescription(new String[]{"cancel"}); |
||
68 | } |
||
69 | addOption(s:String) |
||
70 | FirstPoint { |
||
71 | setQuestion(PluginServices.getText(this,"insert_first_point")); |
||
72 | setDescription(new String[]{"cancel"}); |
||
73 | addOption(s); |
||
74 | } |
||
75 | } |
||
76 | Default |
||
77 | { |
||
78 | addOption(s:String) |
||
79 | [s.equals(PluginServices.getText(this,"cancel"))] |
||
80 | FirstPoint{ |
||
81 | end(); |
||
82 | } |
||
83 | 5730 | caballero | addOption(s:String) |
84 | FirstPoint{ |
||
85 | throwOptionException(PluginServices.getText(this,"incorrect_option"),s); |
||
86 | } |
||
87 | addValue(d:double) |
||
88 | FirstPoint{ |
||
89 | throwValueException(PluginServices.getText(this,"incorrect_value"),d); |
||
90 | } |
||
91 | addPoint(pointX:double,pointY:double,event:InputEvent) |
||
92 | FirstPoint{ |
||
93 | throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY); |
||
94 | } |
||
95 | 5388 | caballero | } |
96 | %% |