Statistics
| Revision:

root / trunk / extensions / extCAD / sm / CircleCADTool.sm @ 11445

History | View | Annotate | Download (2.38 KB)

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

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

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

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

    
19
CenterPointOr3p
20

    
21
	Entry {
22
		setQuestion(
23
		PluginServices.getText(this,"insert_central_point_or_3p")+
24
		"["+PluginServices.getText(this,"CircleCADTool.3p")+"]");
25
		setDescription(new String[]{"cancel","3P"});
26
		}
27
	Exit{
28
		}
29

    
30
	{
31
	addPoint( pointX:double,pointY:double,event:InputEvent)
32
			PointOrRadius {
33
				setQuestion(PluginServices.getText(this,"insert_radius_or_second_point"));
34
				setDescription(new String[]{"cancel"});
35
				addPoint( pointX,pointY,event);
36
				}
37
	addOption( s:String)
38
		[s.equalsIgnoreCase(PluginServices.getText(this,"CircleCADTool.3p"))]
39
			FirstPoint{
40
				setQuestion(PluginServices.getText(this,"insert_first_point"));
41
				setDescription(new String[]{"cancel"});
42
				addOption( s);
43
			}
44
}
45
PointOrRadius{
46
	addPoint( pointX:double,pointY:double,event:InputEvent)
47
		CenterPointOr3p {
48
			addPoint( pointX,pointY,event);
49
			end();
50
			}
51
	addValue( d:double)
52
		CenterPointOr3p {
53
			addValue( d);
54
			end();
55
			}
56
}
57
SecondPoint{
58
	addPoint( pointX:double,pointY:double,event:InputEvent)
59
		ThirdPoint {
60
			setQuestion(PluginServices.getText(this,"insert_third_point"));
61
			setDescription(new String[]{"cancel"});
62
			addPoint( pointX,pointY,event);
63
			}
64
}
65
ThirdPoint{
66
	addPoint( pointX:double,pointY:double,event:InputEvent)
67
		CenterPointOr3p {
68
			addPoint( pointX,pointY,event);
69
			end();
70
			}
71
}
72

    
73
FirstPoint{
74
	addPoint( pointX:double,pointY:double,event:InputEvent)
75
		SecondPoint {
76
			setQuestion(PluginServices.getText(this,"insert_second_point"));
77
			setDescription(new String[]{"cancel"});
78
			addPoint( pointX,pointY,event);
79
			}
80
}
81

    
82
Default
83
{
84
	addOption(s:String)
85
		[s.equals(PluginServices.getText(this,"cancel"))]
86
		CenterPointOr3p{
87
			end();
88
			}
89
	addOption(s:String)
90
		CenterPointOr3p{
91
			throwOptionException(PluginServices.getText(this,"incorrect_option"),s);
92
			}
93
	addValue(d:double)
94
		CenterPointOr3p{
95
			throwValueException(PluginServices.getText(this,"incorrect_value"),d);
96
			}
97
	addPoint(pointX:double,pointY:double,event:InputEvent)
98
		CenterPointOr3p{
99
			throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY);
100
			}
101
}
102
%%