Statistics
| Revision:

svn-gvsig-desktop / tags / v1_0_2_Build_909 / extensions / extCAD / sm / ScaleCADTool.sm @ 40774

History | View | Annotate | Download (3.05 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 4583 caballero
				setQuestion(PluginServices.getText(this,"insert_factor_or_reference"));
34
				setDescription(new String[]{"reference","cancel"});
35 4365 caballero
				addPoint( pointX,pointY,event);
36 3883 caballero
				}
37
	}
38 3978 caballero
ScaleFactorOrReference{
39 3883 caballero
	addValue(d:double)
40 3978 caballero
		PointMain{
41 3883 caballero
			addValue(d);
42
			end();
43
			refresh();
44
			}
45
	addOption(s:String)
46
		[s.equals(null) || s.equals("")]
47 3978 caballero
		PointMain{
48 3883 caballero
			addOption(s);
49
			end();
50
			refresh();
51
			}
52
	addOption(s:String)
53 4583 caballero
		[s.equals("R") || s.equals("r") || s.equals(PluginServices.getText(this,"reference"))]
54 3978 caballero
		PointOriginOrScaleFactor{
55 4583 caballero
			setQuestion(PluginServices.getText(this,"insert_reference_point_or_factor"));
56
			setDescription(new String[]{"factor","cancel"});
57 4637 caballero
			//addOption(s);
58 3883 caballero
			}
59 4324 caballero
	addPoint( pointX:double,pointY:double,event:InputEvent)
60 3978 caballero
		PointMain {
61 4365 caballero
			addPoint( pointX,pointY,event);
62 3883 caballero
			end();
63
			refresh();
64
			}
65
}
66 3978 caballero
PointOriginOrScaleFactor{
67 3883 caballero
	addOption(s:String)
68 4583 caballero
		[s.equals("F") || s.equals("f") || s.equals(PluginServices.getText(this,"factor"))]
69 3978 caballero
		PointMain{
70 4583 caballero
			setQuestion(PluginServices.getText(this,"insert_factor_or_reference"));
71
			setDescription(new String[]{"reference","cancel"});
72 3883 caballero
			addOption(s);
73
			}
74 4324 caballero
	addPoint( pointX:double,pointY:double,event:InputEvent)
75 3978 caballero
		EndPointReference {
76 4583 caballero
			setQuestion(PluginServices.getText(this,"insert_last_point_reference"));
77
			setDescription(new String[]{"cancel"});
78 4365 caballero
			addPoint( pointX,pointY,event);
79 3883 caballero
			}
80
}
81 3978 caballero
EndPointReference{
82 4324 caballero
	addPoint( pointX:double,pointY:double,event:InputEvent)
83 3978 caballero
		OriginPointScale {
84 4583 caballero
			setQuestion(PluginServices.getText(this,"insert_first_point_scale"));
85
			setDescription(new String[]{"cancel"});
86 4365 caballero
			addPoint( pointX,pointY,event);
87 3883 caballero
			}
88
}
89 3978 caballero
OriginPointScale{
90 4324 caballero
	addPoint( pointX:double,pointY:double,event:InputEvent)
91 3978 caballero
		EndPointScale {
92 4583 caballero
			setQuestion(PluginServices.getText(this,"insert_last_point_scale"));
93
			setDescription(new String[]{"cancel"});
94 4365 caballero
			addPoint( pointX,pointY,event);
95 3883 caballero
			}
96
}
97 3978 caballero
EndPointScale{
98 4324 caballero
	addPoint( pointX:double,pointY:double,event:InputEvent)
99 3978 caballero
		PointMain {
100 4365 caballero
			addPoint( pointX,pointY,event);
101 3883 caballero
			end();
102
			refresh();
103
			}
104
}
105 3978 caballero
106 3883 caballero
Default
107
{
108
	addOption(s:String)
109 4583 caballero
		[s.equals(PluginServices.getText(this,"cancel"))]
110 3978 caballero
		PointMain{
111 3883 caballero
			end();
112
			}
113 5730 caballero
	addOption(s:String)
114
		PointMain{
115
			throwOptionException(PluginServices.getText(this,"incorrect_option"),s);
116
			}
117
	addValue(d:double)
118
		PointMain{
119
			throwValueException(PluginServices.getText(this,"incorrect_value"),d);
120
			}
121
	addPoint(pointX:double,pointY:double,event:InputEvent)
122
		PointMain{
123
			throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY);
124
			}
125 3883 caballero
}
126
%%