Statistics
| Revision:

root / tags / v10_RC3 / extensions / extCAD / sm / PolygonCADTool.sm @ 34606

History | View | Annotate | Download (2.53 KB)

1 3782 caballero
// -*- tab-width: 4; -*-
2
3
%{
4
//
5
// Vicente Caballero Navarro
6
%}
7
8 3978 caballero
%start Polygon::NumberOrCenterPoint
9 3782 caballero
%class PolygonCADTool
10
%package com.iver.cit.gvsig.gui.cad.tools.smc
11
%import com.iver.cit.gvsig.gui.cad.tools.PolygonCADTool
12 4324 caballero
%import java.awt.event.InputEvent
13 4583 caballero
%import com.iver.andami.PluginServices
14 3782 caballero
15 3978 caballero
%map Polygon
16 3782 caballero
%%
17
// A task begins life in suspended animation.
18
19 3978 caballero
NumberOrCenterPoint
20 3782 caballero
21
	Entry {
22 4892 caballero
		setQuestion(
23 4583 caballero
		PluginServices.getText(this,"insert_number_sides"));
24
		setDescription(new String[]{"cancel"});
25 3782 caballero
		}
26
	Exit{
27
		}
28
29
	{
30 3828 caballero
		addValue(d:double)
31 5730 caballero
			[d<3]
32
			NumberOrCenterPoint{
33
				throwValueException(PluginServices.getText(this,"num_lados_insuficiente"),d);
34
			}
35
		addValue(d:double)
36
			[d>2]
37 3978 caballero
			CenterPoint {
38 4583 caballero
				setQuestion(PluginServices.getText(this,"insert_central_point_polygon"));
39
				setDescription(new String[]{"cancel"});
40 3828 caballero
				addValue(d);
41 3782 caballero
				}
42 4324 caballero
		addPoint( pointX:double,pointY:double,event:InputEvent)
43 3978 caballero
			OptionOrRadiusOrPoint {
44 4583 caballero
				setQuestion(PluginServices.getText(this,"into_circle_or_circumscribed"));
45
				setDescription(new String[]{"into_circle","circumscribed","cancel"});
46 4365 caballero
				addPoint( pointX,pointY,event);
47 3782 caballero
				}
48
49
	}
50 3978 caballero
CenterPoint{
51 4324 caballero
	addPoint( pointX:double,pointY:double,event:InputEvent)
52 3978 caballero
		OptionOrRadiusOrPoint {
53 4583 caballero
			setQuestion(PluginServices.getText(this,"into_circle_or_circumscribed"));
54
			setDescription(new String[]{"into_circle","circumscribed","cancel"});
55 4365 caballero
			addPoint( pointX,pointY,event);
56 3782 caballero
			}
57
}
58 3978 caballero
OptionOrRadiusOrPoint{
59 3828 caballero
	addOption(s:String)
60 3978 caballero
		RadiusOrPoint {
61 4583 caballero
			setQuestion(PluginServices.getText(this,"insert_radius"));
62
			setDescription(new String[]{"cancel"});
63 3828 caballero
			addOption(s);
64 3782 caballero
			}
65 3828 caballero
	addValue(d:double)
66 3978 caballero
		NumberOrCenterPoint{
67 3828 caballero
			addValue(d);
68 3782 caballero
			end();
69
			}
70 4324 caballero
	addPoint( pointX:double,pointY:double,event:InputEvent)
71 3978 caballero
		NumberOrCenterPoint {
72 4365 caballero
			addPoint( pointX,pointY,event);
73 3782 caballero
			end();
74
			}
75
}
76 3978 caballero
RadiusOrPoint{
77 4324 caballero
	addPoint( pointX:double,pointY:double,event:InputEvent)
78 3978 caballero
		NumberOrCenterPoint {
79 4365 caballero
			addPoint( pointX,pointY,event);
80 3782 caballero
			end();
81
			}
82 3828 caballero
	addValue(d:double)
83 3978 caballero
		NumberOrCenterPoint{
84 3828 caballero
			addValue(d);
85 3782 caballero
			end();
86
			}
87
}
88 3978 caballero
89 3782 caballero
Default
90
{
91 3883 caballero
	addOption(s:String)
92 4583 caballero
		[s.equals(PluginServices.getText(this,"cancel"))]
93 3978 caballero
		NumberOrCenterPoint{
94 3883 caballero
			end();
95
			}
96 5730 caballero
	addOption(s:String)
97
		NumberOrCenterPoint{
98
			throwOptionException(PluginServices.getText(this,"incorrect_option"),s);
99
			}
100
	addValue(d:double)
101
		NumberOrCenterPoint{
102
			throwValueException(PluginServices.getText(this,"incorrect_value"),d);
103
			}
104
	addPoint(pointX:double,pointY:double,event:InputEvent)
105
		NumberOrCenterPoint{
106
			throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY);
107
			}
108 3782 caballero
}
109
%%