Statistics
| Revision:

svn-gvsig-desktop / tags / v1_10_0_Build_1254 / extensions / extCAD / sm / RectangleCADTool.sm @ 42039

History | View | Annotate | Download (1.98 KB)

1 3766 caballero
// -*- tab-width: 4; -*-
2
3
%{
4
//
5
// Vicente Caballero Navarro
6
%}
7
8 3978 caballero
%start Rectangle::FirstPoint
9 3766 caballero
%class RectangleCADTool
10
%package com.iver.cit.gvsig.gui.cad.tools.smc
11
%import com.iver.cit.gvsig.gui.cad.tools.RectangleCADTool
12 4324 caballero
%import java.awt.event.InputEvent
13 4583 caballero
%import com.iver.andami.PluginServices
14 3766 caballero
15 3978 caballero
%map Rectangle
16 3766 caballero
%%
17
// A task begins life in suspended animation.
18
19 3978 caballero
FirstPoint
20 3766 caballero
21
	Entry {
22 4892 caballero
		setQuestion(
23 4583 caballero
		PluginServices.getText(this,"insert_first_point_corner"));
24
		setDescription(new String[]{"cancel"});
25 3766 caballero
		}
26
	Exit{
27
		}
28
29
	{
30
31 4324 caballero
		addPoint( pointX:double,pointY:double,event:InputEvent)
32 3978 caballero
			SecondPointOrSquare {
33 9121 caballero
				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 4583 caballero
				setDescription(new String[]{"square","cancel"});
39 4365 caballero
				addPoint( pointX,pointY,event);
40 3766 caballero
				}
41
42
	}
43 3978 caballero
SecondPointOrSquare{
44 4324 caballero
	addPoint( pointX:double,pointY:double,event:InputEvent)
45 3978 caballero
		FirstPoint {
46 4365 caballero
			addPoint(pointX,pointY,event);
47 3766 caballero
			}
48 3828 caballero
	addOption(s:String)
49 9121 caballero
		[s.equalsIgnoreCase(PluginServices.getText(this,"RectangleCADTool.square")) || s.equals(PluginServices.getText(this,"square"))]
50 3978 caballero
		SecondPointSquare {
51 4583 caballero
			setQuestion(PluginServices.getText(this,"insert_opposited_corner"));
52
			setDescription(new String[]{"cancel"});
53 3828 caballero
			addOption(s);
54 3766 caballero
			}
55
56
}
57 3978 caballero
SecondPointSquare{
58 4324 caballero
	addPoint( pointX:double,pointY:double,event:InputEvent)
59 3978 caballero
		FirstPoint {
60 4365 caballero
			addPoint( pointX,pointY,event);
61 3766 caballero
			}
62
}
63 3978 caballero
64 3766 caballero
Default
65
{
66 3883 caballero
	addOption(s:String)
67 4583 caballero
		[s.equals(PluginServices.getText(this,"cancel"))]
68 3978 caballero
		FirstPoint{
69 3883 caballero
			end();
70
			}
71 5730 caballero
	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 3766 caballero
}
84
%%