Statistics
| Revision:

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

History | View | Annotate | Download (2.14 KB)

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

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

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

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

    
19
FirstPoint
20

    
21
	Entry {
22
		setQuestion(
23
		PluginServices.getText(this,"insert_first_point"));
24
		setDescription(new String[]{"cancel"});
25
		}
26
	Exit{
27
		}
28

    
29
	{
30

    
31
		addPoint( pointX:double,pointY:double,event:InputEvent)
32
			SecondPointOrAngle {
33
				setQuestion(PluginServices.getText(this,"insert_second_point_angle"));
34
				setDescription(new String[]{"cancel"});
35
				addPoint( pointX,pointY,event);
36
				}
37

    
38
	}
39
SecondPointOrAngle{
40
	addPoint( pointX:double,pointY:double,event:InputEvent)
41
		SecondPointOrAngle {
42
			setQuestion(PluginServices.getText(this,"insert_second_point_angle"));
43
			setDescription(new String[]{"cancel"});
44
			addPoint( pointX,pointY,event);
45
			}
46
	addValue( d:double)
47
		LenghtOrPoint {
48
			setQuestion(PluginServices.getText(this,"insert_length_or_point"));
49
			setDescription(new String[]{"cancel"});
50
			addValue( d);
51
			}
52

    
53
}
54
LenghtOrPoint{
55
	addPoint( pointX:double,pointY:double,event:InputEvent)
56
		SecondPointOrAngle {
57
			setQuestion(PluginServices.getText(this,"insert_second_point_angle"));
58
			setDescription(new String[]{"cancel"});
59
			addPoint( pointX,pointY,event);
60
			}
61
	addValue( d:double)
62
		SecondPointOrAngle {
63
			setQuestion(PluginServices.getText(this,"insert_second_point_angle"));
64
			setDescription(new String[]{"cancel"});
65
			addValue( d);
66
			}
67
	}
68
Default
69
{
70
	addOption(s:String)
71
		[s.equals(PluginServices.getText(this,"cancel"))]
72
		FirstPoint{
73
			end();
74
			}
75
	addOption(s:String)
76
		[s.equals("")]
77
		FirstPoint{
78
			end();
79
			}
80
	addOption(s:String)
81
		FirstPoint{
82
			throwOptionException(PluginServices.getText(this,"incorrect_option"),s);
83
			}
84
	addValue(d:double)
85
		FirstPoint{
86
			throwValueException(PluginServices.getText(this,"incorrect_value"),d);
87
			}
88
	addPoint(pointX:double,pointY:double,event:InputEvent)
89
		FirstPoint{
90
			throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY);
91
			}
92

    
93
}
94
%%