Statistics
| Revision:

root / trunk / extensions / extCAD / sm / SelectionCADTool.sm @ 4445

History | View | Annotate | Download (2.55 KB)

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

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

    
8
%start Selection::FirstPoint
9
%class SelectionCADTool
10
%package com.iver.cit.gvsig.gui.cad.tools.smc
11
%import com.iver.cit.gvsig.gui.cad.tools.SelectionCADTool
12
%import com.iver.cit.gvsig.fmap.layers.FBitSet
13
%import java.awt.event.InputEvent
14

    
15

    
16
%map Selection
17
%%
18
// A task begins life in suspended animation.
19

    
20
FirstPoint
21

    
22
	Entry {
23
		setQuestion("SELECCION" + "\n" +
24
		"Precise punto del rect?ngulo de selecci?n");
25
		setDescription(new String[]{"Cancelar"});
26
		}
27
	Exit{
28
		}
29

    
30
	{
31
		addPoint( pointX:double,pointY:double,event:InputEvent)
32
			[ctxt.selectFeatures(pointX,pointY) && ctxt.getNextState().equals("Selection.SecondPoint")]
33
			SecondPoint{
34
				setQuestion("Precise segundo punto del rect?ngulo de seleccion");
35
				setDescription(new String[]{"Cancelar"});
36
				addPoint( pointX,pointY,event);
37
				}
38
		addPoint( pointX:double,pointY:double,event:InputEvent)
39
			[ctxt.getNextState().equals("Selection.WithSelectedFeatures")]
40
			WithSelectedFeatures {
41
				setQuestion("select_handlers");
42
				setDescription(new String[]{"Cancelar"});
43
				addPoint( pointX,pointY,event);
44
				}
45
}
46

    
47
SecondPoint{
48
	addPoint( pointX:double,pointY:double,event:InputEvent)
49
		[ctxt.selectFeatures(pointX,pointY) && ctxt.getNextState().equals("Selection.FirstPoint")]
50
			FirstPoint {
51
				setQuestion("Precise punto del rect?ngulo de selecci?n");
52
				setDescription(new String[]{"Cancelar"});
53

    
54
				}
55
	addPoint( pointX:double,pointY:double,event:InputEvent)
56
			[ctxt.getNextState().equals("Selection.WithSelectedFeatures")]
57
			WithSelectedFeatures {
58
				setQuestion("select_handlers");
59
				setDescription(new String[]{"Cancelar"});
60
				addPoint( pointX,pointY,event);
61
				}
62

    
63

    
64
}
65
WithSelectedFeatures{
66
	addPoint( pointX:double,pointY:double,event:InputEvent)
67
	[ctxt.selectHandlers(pointX,pointY)==0]
68
			FirstPoint {
69
				setQuestion("Precise punto del rect?ngulo de selecci?n");
70
				setDescription(new String[]{"Cancelar"});
71
				addPoint( pointX,pointY,event);
72
				refresh();
73
				}
74
				addPoint( pointX:double,pointY:double,event:InputEvent)
75
	[ctxt.selectHandlers(pointX, pointY)>0]
76
			WithHandlers {
77
				setQuestion("Precise punto destino");
78
				setDescription(new String[]{"Cancelar"});
79
				addPoint( pointX,pointY,event);
80
				refresh();
81
				}
82
}
83

    
84
WithHandlers{
85
	addPoint( pointX:double,pointY:double,event:InputEvent)
86
			WithSelectedFeatures {
87
				setQuestion("select_handlers");
88
				setDescription(new String[]{"Cancelar"});
89
				addPoint( pointX,pointY,event);
90
				refresh();
91
				}
92
}
93

    
94
Default
95
{
96
	addOption(s:String)
97
		[s.equals("Cancelar")]
98
		FirstPoint{
99
			end();
100
			}
101
}
102
%%