Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / extensions / extEditing / sm / ScaleCADTool.sm @ 25779

History | View | Annotate | Download (3.58 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(
34
					PluginServices.getText(this,"insert_factor")+ " "+
35
					PluginServices.getText(this,"cad.or")+" "+
36
					PluginServices.getText(this,"reference")+
37
					PluginServices.getText(this,"ScaleCADTool.reference"));
38
				setDescription(new String[]{"reference","cancel"});
39
				addPoint( pointX,pointY,event);
40
				}
41
	}
42
ScaleFactorOrReference{
43
	addValue(d:double)
44
		PointMain{
45
			addValue(d);
46
			end();
47
			refresh();
48
			}
49
	addOption(s:String)
50
		[s.equals(null) || s.equals("")]
51
		PointMain{
52
			addOption(s);
53
			end();
54
			refresh();
55
			}
56
	addOption(s:String)
57
		[s.equalsIgnoreCase(PluginServices.getText(this,"ScaleCADTool.reference")) || s.equals(PluginServices.getText(this,"reference"))]
58
		PointOriginOrScaleFactor{
59
			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
			setDescription(new String[]{"factor","cancel"});
65
			//addOption(s);
66
			}
67
	addPoint( pointX:double,pointY:double,event:InputEvent)
68
		PointMain {
69
			addPoint( pointX,pointY,event);
70
			end();
71
			refresh();
72
			}
73
}
74
PointOriginOrScaleFactor{
75
	addOption(s:String)
76
		[s.equalsIgnoreCase(PluginServices.getText(this,"ScaleCADTool.factor")) || s.equals(PluginServices.getText(this,"factor"))]
77
		PointMain{
78
			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
			setDescription(new String[]{"reference","cancel"});
84
			addOption(s);
85
			}
86
	addPoint( pointX:double,pointY:double,event:InputEvent)
87
		EndPointReference {
88
			setQuestion(PluginServices.getText(this,"insert_last_point_reference"));
89
			setDescription(new String[]{"cancel"});
90
			addPoint( pointX,pointY,event);
91
			}
92
}
93
EndPointReference{
94
	addPoint( pointX:double,pointY:double,event:InputEvent)
95
		OriginPointScale {
96
			setQuestion(PluginServices.getText(this,"insert_first_point_scale"));
97
			setDescription(new String[]{"cancel"});
98
			addPoint( pointX,pointY,event);
99
			}
100
}
101
OriginPointScale{
102
	addPoint( pointX:double,pointY:double,event:InputEvent)
103
		EndPointScale {
104
			setQuestion(PluginServices.getText(this,"insert_last_point_scale"));
105
			setDescription(new String[]{"cancel"});
106
			addPoint( pointX,pointY,event);
107
			}
108
}
109
EndPointScale{
110
	addPoint( pointX:double,pointY:double,event:InputEvent)
111
		PointMain {
112
			addPoint( pointX,pointY,event);
113
			end();
114
			refresh();
115
			}
116
}
117

    
118
Default
119
{
120
	addOption(s:String)
121
		[s.equals(PluginServices.getText(this,"cancel"))]
122
		PointMain{
123
			end();
124
			}
125
	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
}
138
%%