svn-gvsig-desktop / branches / v2_0_0_prep / extensions / extEditing / sm / ScaleCADTool.sm @ 39127
History | View | Annotate | Download (3.58 KB)
1 | 3883 | caballero | // -*- tab-width: 4; -*- |
---|---|---|---|
2 | |||
3 | %{ |
||
4 | // |
||
5 | // Vicente Caballero Navarro |
||
6 | %} |
||
7 | |||
8 | 3978 | caballero | %start Scale::PointMain |
9 | 3883 | caballero | %class ScaleCADTool |
10 | %package com.iver.cit.gvsig.gui.cad.tools.smc |
||
11 | %import com.iver.cit.gvsig.gui.cad.tools.ScaleCADTool |
||
12 | 4324 | caballero | %import java.awt.event.InputEvent |
13 | 4583 | caballero | %import com.iver.andami.PluginServices |
14 | 3883 | caballero | |
15 | 3978 | caballero | %map Scale |
16 | 3883 | caballero | %% |
17 | // A task begins life in suspended animation. |
||
18 | |||
19 | 3978 | caballero | PointMain |
20 | 3883 | caballero | Entry { |
21 | selection(); |
||
22 | 4892 | caballero | setQuestion( |
23 | 4583 | caballero | PluginServices.getText(this,"insert_basis_point")); |
24 | setDescription(new String[]{"cancel"}); |
||
25 | 3883 | caballero | |
26 | } |
||
27 | Exit{ |
||
28 | } |
||
29 | |||
30 | { |
||
31 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
32 | 3978 | caballero | ScaleFactorOrReference { |
33 | 9121 | caballero | setQuestion( |
34 | PluginServices.getText(this,"insert_factor")+ " "+ |
||
35 | PluginServices.getText(this,"cad.or")+" "+ |
||
36 | PluginServices.getText(this,"reference")+ |
||
37 | PluginServices.getText(this,"ScaleCADTool.reference")); |
||
38 | 4583 | caballero | setDescription(new String[]{"reference","cancel"}); |
39 | 4365 | caballero | addPoint( pointX,pointY,event); |
40 | 3883 | caballero | } |
41 | } |
||
42 | 3978 | caballero | ScaleFactorOrReference{ |
43 | 3883 | caballero | addValue(d:double) |
44 | 3978 | caballero | PointMain{ |
45 | 3883 | caballero | addValue(d); |
46 | end(); |
||
47 | refresh(); |
||
48 | } |
||
49 | addOption(s:String) |
||
50 | [s.equals(null) || s.equals("")] |
||
51 | 3978 | caballero | PointMain{ |
52 | 3883 | caballero | addOption(s); |
53 | end(); |
||
54 | refresh(); |
||
55 | } |
||
56 | addOption(s:String) |
||
57 | 9121 | caballero | [s.equalsIgnoreCase(PluginServices.getText(this,"ScaleCADTool.reference")) || s.equals(PluginServices.getText(this,"reference"))] |
58 | 3978 | caballero | PointOriginOrScaleFactor{ |
59 | 9121 | caballero | setQuestion( |
60 | PluginServices.getText(this,"insert_reference_point")+ " "+ |
||
61 | PluginServices.getText(this,"cad.or")+" "+ |
||
62 | PluginServices.getText(this,"factor")+ |
||
63 | "["+PluginServices.getText(this,"ScaleCADTool.factor")+"]"); |
||
64 | 4583 | caballero | setDescription(new String[]{"factor","cancel"}); |
65 | 4637 | caballero | //addOption(s); |
66 | 3883 | caballero | } |
67 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
68 | 3978 | caballero | PointMain { |
69 | 4365 | caballero | addPoint( pointX,pointY,event); |
70 | 3883 | caballero | end(); |
71 | refresh(); |
||
72 | } |
||
73 | } |
||
74 | 3978 | caballero | PointOriginOrScaleFactor{ |
75 | 3883 | caballero | addOption(s:String) |
76 | 9121 | caballero | [s.equalsIgnoreCase(PluginServices.getText(this,"ScaleCADTool.factor")) || s.equals(PluginServices.getText(this,"factor"))] |
77 | 3978 | caballero | PointMain{ |
78 | 9121 | caballero | setQuestion( |
79 | PluginServices.getText(this,"insert_factor")+ " "+ |
||
80 | PluginServices.getText(this,"cad.or")+" "+ |
||
81 | PluginServices.getText(this,"reference")+ |
||
82 | "["+PluginServices.getText(this,"ScaleCADTool.reference")+"]"); |
||
83 | 4583 | caballero | setDescription(new String[]{"reference","cancel"}); |
84 | 3883 | caballero | addOption(s); |
85 | } |
||
86 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
87 | 3978 | caballero | EndPointReference { |
88 | 4583 | caballero | setQuestion(PluginServices.getText(this,"insert_last_point_reference")); |
89 | setDescription(new String[]{"cancel"}); |
||
90 | 4365 | caballero | addPoint( pointX,pointY,event); |
91 | 3883 | caballero | } |
92 | } |
||
93 | 3978 | caballero | EndPointReference{ |
94 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
95 | 3978 | caballero | OriginPointScale { |
96 | 4583 | caballero | setQuestion(PluginServices.getText(this,"insert_first_point_scale")); |
97 | setDescription(new String[]{"cancel"}); |
||
98 | 4365 | caballero | addPoint( pointX,pointY,event); |
99 | 3883 | caballero | } |
100 | } |
||
101 | 3978 | caballero | OriginPointScale{ |
102 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
103 | 3978 | caballero | EndPointScale { |
104 | 4583 | caballero | setQuestion(PluginServices.getText(this,"insert_last_point_scale")); |
105 | setDescription(new String[]{"cancel"}); |
||
106 | 4365 | caballero | addPoint( pointX,pointY,event); |
107 | 3883 | caballero | } |
108 | } |
||
109 | 3978 | caballero | EndPointScale{ |
110 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
111 | 3978 | caballero | PointMain { |
112 | 4365 | caballero | addPoint( pointX,pointY,event); |
113 | 3883 | caballero | end(); |
114 | refresh(); |
||
115 | } |
||
116 | } |
||
117 | 3978 | caballero | |
118 | 3883 | caballero | Default |
119 | { |
||
120 | addOption(s:String) |
||
121 | 4583 | caballero | [s.equals(PluginServices.getText(this,"cancel"))] |
122 | 3978 | caballero | PointMain{ |
123 | 3883 | caballero | end(); |
124 | } |
||
125 | 5730 | caballero | addOption(s:String) |
126 | PointMain{ |
||
127 | throwOptionException(PluginServices.getText(this,"incorrect_option"),s); |
||
128 | } |
||
129 | addValue(d:double) |
||
130 | PointMain{ |
||
131 | throwValueException(PluginServices.getText(this,"incorrect_value"),d); |
||
132 | } |
||
133 | addPoint(pointX:double,pointY:double,event:InputEvent) |
||
134 | PointMain{ |
||
135 | throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY); |
||
136 | } |
||
137 | 3883 | caballero | } |
138 | %% |