Statistics
| Revision:

svn-gvsig-desktop / tags / v1_0_2_Build_895 / extensions / extCAD / sm / PolygonCADTool.sm @ 10328

History | View | Annotate | Download (2.58 KB)

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

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

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

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

    
19
NumberOrCenterPoint
20

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

    
29
	{
30
		addValue(d:double)
31
			[d<3]
32
			NumberOrCenterPoint{
33
				throwValueException(PluginServices.getText(this,"num_lados_insuficiente"),d);
34
			}
35
		addValue(d:double)
36
			[d>2]
37
			CenterPoint {
38
				setQuestion(PluginServices.getText(this,"insert_central_point_polygon"));
39
				setDescription(new String[]{"cancel"});
40
				addValue(d);
41
				}
42
		addPoint( pointX:double,pointY:double,event:InputEvent)
43
			OptionOrRadiusOrPoint {
44
				setQuestion(PluginServices.getText(this,"into_circle_or_circumscribed"));
45
				setDescription(new String[]{"into_circle","circumscribed","cancel"});
46
				addPoint( pointX,pointY,event);
47
				}
48

    
49
	}
50
CenterPoint{
51
	addPoint( pointX:double,pointY:double,event:InputEvent)
52
		OptionOrRadiusOrPoint {
53
			setQuestion(PluginServices.getText(this,"into_circle_or_circumscribed"));
54
			setDescription(new String[]{"into_circle","circumscribed","cancel"});
55
			addPoint( pointX,pointY,event);
56
			}
57
}
58
OptionOrRadiusOrPoint{
59
	addOption(s:String)
60
		[!s.equals(PluginServices.getText(this,"cancel"))]
61
		RadiusOrPoint {
62
			setQuestion(PluginServices.getText(this,"insert_radius"));
63
			setDescription(new String[]{"cancel"});
64
			addOption(s);
65
			}
66
	addValue(d:double)
67
		NumberOrCenterPoint{
68
			addValue(d);
69
			end();
70
			}
71
	addPoint( pointX:double,pointY:double,event:InputEvent)
72
		NumberOrCenterPoint {
73
			addPoint( pointX,pointY,event);
74
			end();
75
			}
76
}
77
RadiusOrPoint{
78
	addPoint( pointX:double,pointY:double,event:InputEvent)
79
		NumberOrCenterPoint {
80
			addPoint( pointX,pointY,event);
81
			end();
82
			}
83
	addValue(d:double)
84
		NumberOrCenterPoint{
85
			addValue(d);
86
			end();
87
			}
88
}
89

    
90
Default
91
{
92
	addOption(s:String)
93
		[s.equals(PluginServices.getText(this,"cancel"))]
94
		NumberOrCenterPoint{
95
			end();
96
			}
97
	addOption(s:String)
98
		NumberOrCenterPoint{
99
			throwOptionException(PluginServices.getText(this,"incorrect_option"),s);
100
			}
101
	addValue(d:double)
102
		NumberOrCenterPoint{
103
			throwValueException(PluginServices.getText(this,"incorrect_value"),d);
104
			}
105
	addPoint(pointX:double,pointY:double,event:InputEvent)
106
		NumberOrCenterPoint{
107
			throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY);
108
			}
109
}
110
%%