svn-gvsig-desktop / tags / v1_0_2_Build_913 / extensions / extCAD / sm / PolygonCADTool.sm @ 11431
History | View | Annotate | Download (2.58 KB)
1 | 3782 | caballero | // -*- tab-width: 4; -*- |
---|---|---|---|
2 | |||
3 | %{ |
||
4 | // |
||
5 | // Vicente Caballero Navarro |
||
6 | %} |
||
7 | |||
8 | 3978 | caballero | %start Polygon::NumberOrCenterPoint |
9 | 3782 | caballero | %class PolygonCADTool |
10 | %package com.iver.cit.gvsig.gui.cad.tools.smc |
||
11 | %import com.iver.cit.gvsig.gui.cad.tools.PolygonCADTool |
||
12 | 4324 | caballero | %import java.awt.event.InputEvent |
13 | 4583 | caballero | %import com.iver.andami.PluginServices |
14 | 3782 | caballero | |
15 | 3978 | caballero | %map Polygon |
16 | 3782 | caballero | %% |
17 | // A task begins life in suspended animation. |
||
18 | |||
19 | 3978 | caballero | NumberOrCenterPoint |
20 | 3782 | caballero | |
21 | Entry { |
||
22 | 4892 | caballero | setQuestion( |
23 | 4583 | caballero | PluginServices.getText(this,"insert_number_sides")); |
24 | setDescription(new String[]{"cancel"}); |
||
25 | 3782 | caballero | } |
26 | Exit{ |
||
27 | } |
||
28 | |||
29 | { |
||
30 | 3828 | caballero | addValue(d:double) |
31 | 5730 | caballero | [d<3] |
32 | NumberOrCenterPoint{ |
||
33 | throwValueException(PluginServices.getText(this,"num_lados_insuficiente"),d); |
||
34 | } |
||
35 | addValue(d:double) |
||
36 | [d>2] |
||
37 | 3978 | caballero | CenterPoint { |
38 | 4583 | caballero | setQuestion(PluginServices.getText(this,"insert_central_point_polygon")); |
39 | setDescription(new String[]{"cancel"}); |
||
40 | 3828 | caballero | addValue(d); |
41 | 3782 | caballero | } |
42 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
43 | 3978 | caballero | OptionOrRadiusOrPoint { |
44 | 4583 | caballero | setQuestion(PluginServices.getText(this,"into_circle_or_circumscribed")); |
45 | setDescription(new String[]{"into_circle","circumscribed","cancel"}); |
||
46 | 4365 | caballero | addPoint( pointX,pointY,event); |
47 | 3782 | caballero | } |
48 | |||
49 | } |
||
50 | 3978 | caballero | CenterPoint{ |
51 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
52 | 3978 | caballero | OptionOrRadiusOrPoint { |
53 | 4583 | caballero | setQuestion(PluginServices.getText(this,"into_circle_or_circumscribed")); |
54 | setDescription(new String[]{"into_circle","circumscribed","cancel"}); |
||
55 | 4365 | caballero | addPoint( pointX,pointY,event); |
56 | 3782 | caballero | } |
57 | } |
||
58 | 3978 | caballero | OptionOrRadiusOrPoint{ |
59 | 3828 | caballero | addOption(s:String) |
60 | 9251 | caballero | [!s.equals(PluginServices.getText(this,"cancel"))] |
61 | 3978 | caballero | RadiusOrPoint { |
62 | 4583 | caballero | setQuestion(PluginServices.getText(this,"insert_radius")); |
63 | setDescription(new String[]{"cancel"}); |
||
64 | 3828 | caballero | addOption(s); |
65 | 3782 | caballero | } |
66 | 3828 | caballero | addValue(d:double) |
67 | 3978 | caballero | NumberOrCenterPoint{ |
68 | 3828 | caballero | addValue(d); |
69 | 3782 | caballero | end(); |
70 | } |
||
71 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
72 | 3978 | caballero | NumberOrCenterPoint { |
73 | 4365 | caballero | addPoint( pointX,pointY,event); |
74 | 3782 | caballero | end(); |
75 | } |
||
76 | } |
||
77 | 3978 | caballero | RadiusOrPoint{ |
78 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
79 | 3978 | caballero | NumberOrCenterPoint { |
80 | 4365 | caballero | addPoint( pointX,pointY,event); |
81 | 3782 | caballero | end(); |
82 | } |
||
83 | 3828 | caballero | addValue(d:double) |
84 | 3978 | caballero | NumberOrCenterPoint{ |
85 | 3828 | caballero | addValue(d); |
86 | 3782 | caballero | end(); |
87 | } |
||
88 | } |
||
89 | 3978 | caballero | |
90 | 3782 | caballero | Default |
91 | { |
||
92 | 3883 | caballero | addOption(s:String) |
93 | 4583 | caballero | [s.equals(PluginServices.getText(this,"cancel"))] |
94 | 3978 | caballero | NumberOrCenterPoint{ |
95 | 3883 | caballero | end(); |
96 | } |
||
97 | 5730 | caballero | addOption(s:String) |
98 | NumberOrCenterPoint{ |
||
99 | throwOptionException(PluginServices.getText(this,"incorrect_option"),s); |
||
100 | } |
||
101 | addValue(d:double) |
||
102 | NumberOrCenterPoint{ |
||
103 | throwValueException(PluginServices.getText(this,"incorrect_value"),d); |
||
104 | } |
||
105 | addPoint(pointX:double,pointY:double,event:InputEvent) |
||
106 | NumberOrCenterPoint{ |
||
107 | throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY); |
||
108 | } |
||
109 | 3782 | caballero | } |
110 | %% |