Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extCAD / sm / RectangleCADTool.sm @ 28605

History | View | Annotate | Download (1.98 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(
34
					PluginServices.getText(this,"insert_point_corner")+" "+
35
					PluginServices.getText(this,"cad.or")+" "+
36
					PluginServices.getText(this,"square")+" "+
37
					"["+PluginServices.getText(this,"RectangleCADTool.square")+"]");
38
				setDescription(new String[]{"square","cancel"});
39
				addPoint( pointX,pointY,event);
40
				}
41

    
42
	}
43
SecondPointOrSquare{
44
	addPoint( pointX:double,pointY:double,event:InputEvent)
45
		FirstPoint {
46
			addPoint(pointX,pointY,event);
47
			}
48
	addOption(s:String)
49
		[s.equalsIgnoreCase(PluginServices.getText(this,"RectangleCADTool.square")) || s.equals(PluginServices.getText(this,"square"))]
50
		SecondPointSquare {
51
			setQuestion(PluginServices.getText(this,"insert_opposited_corner"));
52
			setDescription(new String[]{"cancel"});
53
			addOption(s);
54
			}
55

    
56
}
57
SecondPointSquare{
58
	addPoint( pointX:double,pointY:double,event:InputEvent)
59
		FirstPoint {
60
			addPoint( pointX,pointY,event);
61
			}
62
}
63

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