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