Statistics
| Revision:

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

History | View | Annotate | Download (3.06 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 9121 caballero
				setQuestion(
45
					PluginServices.getText(this,"into_circle")+" "+
46
					"["+PluginServices.getText(this,"PolygonCADTool.into_circle")+"]"+
47
	    			PluginServices.getText(this,"cad.or")+" "+
48
	    			PluginServices.getText(this,"circumscribed")+
49
	   				"["+PluginServices.getText(this,"PolygonCADTool.circumscribed")+"]");
50 4583 caballero
				setDescription(new String[]{"into_circle","circumscribed","cancel"});
51 4365 caballero
				addPoint( pointX,pointY,event);
52 3782 caballero
				}
53
54
	}
55 3978 caballero
CenterPoint{
56 4324 caballero
	addPoint( pointX:double,pointY:double,event:InputEvent)
57 3978 caballero
		OptionOrRadiusOrPoint {
58 9121 caballero
			setQuestion(
59
				PluginServices.getText(this,"into_circle")+" "+
60
				"["+PluginServices.getText(this,"PolygonCADTool.into_circle")+"]"+
61
	    		PluginServices.getText(this,"cad.or")+" "+
62
	    		PluginServices.getText(this,"circumscribed")+
63
	   			"["+PluginServices.getText(this,"PolygonCADTool.circumscribed")+"]");
64 4583 caballero
			setDescription(new String[]{"into_circle","circumscribed","cancel"});
65 4365 caballero
			addPoint( pointX,pointY,event);
66 3782 caballero
			}
67
}
68 3978 caballero
OptionOrRadiusOrPoint{
69 3828 caballero
	addOption(s:String)
70 9249 caballero
		[!s.equals(PluginServices.getText(this,"cancel"))]
71 3978 caballero
		RadiusOrPoint {
72 4583 caballero
			setQuestion(PluginServices.getText(this,"insert_radius"));
73
			setDescription(new String[]{"cancel"});
74 3828 caballero
			addOption(s);
75 3782 caballero
			}
76 3828 caballero
	addValue(d:double)
77 3978 caballero
		NumberOrCenterPoint{
78 3828 caballero
			addValue(d);
79 3782 caballero
			end();
80
			}
81 4324 caballero
	addPoint( pointX:double,pointY:double,event:InputEvent)
82 3978 caballero
		NumberOrCenterPoint {
83 4365 caballero
			addPoint( pointX,pointY,event);
84 3782 caballero
			end();
85
			}
86
}
87 3978 caballero
RadiusOrPoint{
88 4324 caballero
	addPoint( pointX:double,pointY:double,event:InputEvent)
89 3978 caballero
		NumberOrCenterPoint {
90 4365 caballero
			addPoint( pointX,pointY,event);
91 3782 caballero
			end();
92
			}
93 3828 caballero
	addValue(d:double)
94 3978 caballero
		NumberOrCenterPoint{
95 3828 caballero
			addValue(d);
96 3782 caballero
			end();
97
			}
98
}
99 3978 caballero
100 3782 caballero
Default
101
{
102 3883 caballero
	addOption(s:String)
103 4583 caballero
		[s.equals(PluginServices.getText(this,"cancel"))]
104 3978 caballero
		NumberOrCenterPoint{
105 3883 caballero
			end();
106
			}
107 5730 caballero
	addOption(s:String)
108
		NumberOrCenterPoint{
109
			throwOptionException(PluginServices.getText(this,"incorrect_option"),s);
110
			}
111
	addValue(d:double)
112
		NumberOrCenterPoint{
113
			throwValueException(PluginServices.getText(this,"incorrect_value"),d);
114
			}
115
	addPoint(pointX:double,pointY:double,event:InputEvent)
116
		NumberOrCenterPoint{
117
			throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY);
118
			}
119 3782 caballero
}
120
%%