svn-gvsig-desktop / trunk / extensions / extCAD / sm / PolygonCADTool.sm @ 18368
History | View | Annotate | Download (3.02 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 | 9121 | caballero | setQuestion( |
45 | PluginServices.getText(this,"into_circle")+" "+ |
||
46 | "["+PluginServices.getText(this,"PolygonCADTool.into_circle")+"]"+ |
||
47 | PluginServices.getText(this,"cad.or")+" "+ |
||
48 | PluginServices.getText(this,"circumscribed")+ |
||
49 | "["+PluginServices.getText(this,"PolygonCADTool.circumscribed")+"]"); |
||
50 | 4583 | caballero | setDescription(new String[]{"into_circle","circumscribed","cancel"}); |
51 | 4365 | caballero | addPoint( pointX,pointY,event); |
52 | 3782 | caballero | } |
53 | |||
54 | } |
||
55 | 3978 | caballero | CenterPoint{ |
56 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
57 | 3978 | caballero | OptionOrRadiusOrPoint { |
58 | 9121 | caballero | setQuestion( |
59 | PluginServices.getText(this,"into_circle")+" "+ |
||
60 | "["+PluginServices.getText(this,"PolygonCADTool.into_circle")+"]"+ |
||
61 | PluginServices.getText(this,"cad.or")+" "+ |
||
62 | PluginServices.getText(this,"circumscribed")+ |
||
63 | "["+PluginServices.getText(this,"PolygonCADTool.circumscribed")+"]"); |
||
64 | 4583 | caballero | setDescription(new String[]{"into_circle","circumscribed","cancel"}); |
65 | 4365 | caballero | addPoint( pointX,pointY,event); |
66 | 3782 | caballero | } |
67 | } |
||
68 | 3978 | caballero | OptionOrRadiusOrPoint{ |
69 | 3828 | caballero | addOption(s:String) |
70 | 9249 | caballero | [!s.equals(PluginServices.getText(this,"cancel"))] |
71 | 3978 | caballero | RadiusOrPoint { |
72 | 4583 | caballero | setQuestion(PluginServices.getText(this,"insert_radius")); |
73 | setDescription(new String[]{"cancel"}); |
||
74 | 3828 | caballero | addOption(s); |
75 | 3782 | caballero | } |
76 | 3828 | caballero | addValue(d:double) |
77 | 3978 | caballero | NumberOrCenterPoint{ |
78 | 3828 | caballero | addValue(d); |
79 | 3782 | caballero | } |
80 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
81 | 3978 | caballero | NumberOrCenterPoint { |
82 | 4365 | caballero | addPoint( pointX,pointY,event); |
83 | 3782 | caballero | } |
84 | } |
||
85 | 3978 | caballero | RadiusOrPoint{ |
86 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
87 | 3978 | caballero | NumberOrCenterPoint { |
88 | 4365 | caballero | addPoint( pointX,pointY,event); |
89 | 3782 | caballero | } |
90 | 3828 | caballero | addValue(d:double) |
91 | 3978 | caballero | NumberOrCenterPoint{ |
92 | 3828 | caballero | addValue(d); |
93 | 3782 | caballero | } |
94 | } |
||
95 | 3978 | caballero | |
96 | 3782 | caballero | Default |
97 | { |
||
98 | 3883 | caballero | addOption(s:String) |
99 | 4583 | caballero | [s.equals(PluginServices.getText(this,"cancel"))] |
100 | 3978 | caballero | NumberOrCenterPoint{ |
101 | 3883 | caballero | end(); |
102 | } |
||
103 | 5730 | caballero | addOption(s:String) |
104 | NumberOrCenterPoint{ |
||
105 | throwOptionException(PluginServices.getText(this,"incorrect_option"),s); |
||
106 | } |
||
107 | addValue(d:double) |
||
108 | NumberOrCenterPoint{ |
||
109 | throwValueException(PluginServices.getText(this,"incorrect_value"),d); |
||
110 | } |
||
111 | addPoint(pointX:double,pointY:double,event:InputEvent) |
||
112 | NumberOrCenterPoint{ |
||
113 | throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY); |
||
114 | } |
||
115 | 3782 | caballero | } |
116 | %% |