Statistics
| Revision:

root / trunk / extensions / extCAD / sm / ScaleCADTool.sm @ 5730

History | View | Annotate | Download (3.05 KB)

1
// -*- tab-width: 4; -*-
2

    
3
%{
4
//
5
// Vicente Caballero Navarro
6
%}
7

    
8
%start Scale::PointMain
9
%class ScaleCADTool
10
%package com.iver.cit.gvsig.gui.cad.tools.smc
11
%import com.iver.cit.gvsig.gui.cad.tools.ScaleCADTool
12
%import java.awt.event.InputEvent
13
%import com.iver.andami.PluginServices
14

    
15
%map Scale
16
%%
17
// A task begins life in suspended animation.
18

    
19
PointMain
20
	Entry {
21
		selection();
22
		setQuestion(
23
		PluginServices.getText(this,"insert_basis_point"));
24
		setDescription(new String[]{"cancel"});
25

    
26
		}
27
	Exit{
28
		}
29

    
30
	{
31
		addPoint( pointX:double,pointY:double,event:InputEvent)
32
			ScaleFactorOrReference {
33
				setQuestion(PluginServices.getText(this,"insert_factor_or_reference"));
34
				setDescription(new String[]{"reference","cancel"});
35
				addPoint( pointX,pointY,event);
36
				}
37
	}
38
ScaleFactorOrReference{
39
	addValue(d:double)
40
		PointMain{
41
			addValue(d);
42
			end();
43
			refresh();
44
			}
45
	addOption(s:String)
46
		[s.equals(null) || s.equals("")]
47
		PointMain{
48
			addOption(s);
49
			end();
50
			refresh();
51
			}
52
	addOption(s:String)
53
		[s.equals("R") || s.equals("r") || s.equals(PluginServices.getText(this,"reference"))]
54
		PointOriginOrScaleFactor{
55
			setQuestion(PluginServices.getText(this,"insert_reference_point_or_factor"));
56
			setDescription(new String[]{"factor","cancel"});
57
			//addOption(s);
58
			}
59
	addPoint( pointX:double,pointY:double,event:InputEvent)
60
		PointMain {
61
			addPoint( pointX,pointY,event);
62
			end();
63
			refresh();
64
			}
65
}
66
PointOriginOrScaleFactor{
67
	addOption(s:String)
68
		[s.equals("F") || s.equals("f") || s.equals(PluginServices.getText(this,"factor"))]
69
		PointMain{
70
			setQuestion(PluginServices.getText(this,"insert_factor_or_reference"));
71
			setDescription(new String[]{"reference","cancel"});
72
			addOption(s);
73
			}
74
	addPoint( pointX:double,pointY:double,event:InputEvent)
75
		EndPointReference {
76
			setQuestion(PluginServices.getText(this,"insert_last_point_reference"));
77
			setDescription(new String[]{"cancel"});
78
			addPoint( pointX,pointY,event);
79
			}
80
}
81
EndPointReference{
82
	addPoint( pointX:double,pointY:double,event:InputEvent)
83
		OriginPointScale {
84
			setQuestion(PluginServices.getText(this,"insert_first_point_scale"));
85
			setDescription(new String[]{"cancel"});
86
			addPoint( pointX,pointY,event);
87
			}
88
}
89
OriginPointScale{
90
	addPoint( pointX:double,pointY:double,event:InputEvent)
91
		EndPointScale {
92
			setQuestion(PluginServices.getText(this,"insert_last_point_scale"));
93
			setDescription(new String[]{"cancel"});
94
			addPoint( pointX,pointY,event);
95
			}
96
}
97
EndPointScale{
98
	addPoint( pointX:double,pointY:double,event:InputEvent)
99
		PointMain {
100
			addPoint( pointX,pointY,event);
101
			end();
102
			refresh();
103
			}
104
}
105

    
106
Default
107
{
108
	addOption(s:String)
109
		[s.equals(PluginServices.getText(this,"cancel"))]
110
		PointMain{
111
			end();
112
			}
113
	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
}
126
%%