Statistics
| Revision:

svn-gvsig-desktop / tags / v1_1_2_Build_1045 / extensions / extCAD / sm / RectangleCADTool.sm @ 41712

History | View | Annotate | Download (1.8 KB)

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

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

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

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

    
19
FirstPoint
20

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

    
29
	{
30

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

    
38
	}
39
SecondPointOrSquare{
40
	addPoint( pointX:double,pointY:double,event:InputEvent)
41
		FirstPoint {
42
			addPoint(pointX,pointY,event);
43
			end();
44
			}
45
	addOption(s:String)
46
		[s.equals("c") || s.equals("C") || s.equals(PluginServices.getText(this,"square"))]
47
		SecondPointSquare {
48
			setQuestion(PluginServices.getText(this,"insert_opposited_corner"));
49
			setDescription(new String[]{"cancel"});
50
			addOption(s);
51
			}
52

    
53
}
54
SecondPointSquare{
55
	addPoint( pointX:double,pointY:double,event:InputEvent)
56
		FirstPoint {
57
			addPoint( pointX,pointY,event);
58
			end();
59
			}
60
}
61

    
62
Default
63
{
64
	addOption(s:String)
65
		[s.equals(PluginServices.getText(this,"cancel"))]
66
		FirstPoint{
67
			end();
68
			}
69
	addOption(s:String)
70
		FirstPoint{
71
			throwOptionException(PluginServices.getText(this,"incorrect_option"),s);
72
			}
73
	addValue(d:double)
74
		FirstPoint{
75
			throwValueException(PluginServices.getText(this,"incorrect_value"),d);
76
			}
77
	addPoint(pointX:double,pointY:double,event:InputEvent)
78
		FirstPoint{
79
			throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY);
80
			}
81
}
82
%%