root / trunk / extensions / extCAD / sm / PolylineCADTool.sm @ 4324
History | View | Annotate | Download (2.21 KB)
1 |
// -*- tab-width: 4; -*- |
---|---|
2 |
|
3 |
%{ |
4 |
// |
5 |
// Vicente Caballero Navarro |
6 |
%} |
7 |
|
8 |
%start Polyline::FirstPoint |
9 |
%class PolylineCADTool |
10 |
%package com.iver.cit.gvsig.gui.cad.tools.smc |
11 |
%import com.iver.cit.gvsig.gui.cad.tools.PolylineCADTool |
12 |
%import java.awt.event.InputEvent |
13 |
|
14 |
%map Polyline |
15 |
%% |
16 |
// A task begins life in suspended animation. |
17 |
|
18 |
FirstPoint |
19 |
|
20 |
Entry { |
21 |
setQuestion("POLILINEA" + "\n" + |
22 |
"Insertar primer punto"); |
23 |
setDescription(new String[]{"Cancelar"}); |
24 |
} |
25 |
Exit{ |
26 |
} |
27 |
|
28 |
{ |
29 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
30 |
NextPointOrArcOrClose{ |
31 |
setQuestion("Insertar siguiente punto, Arco[A] o Cerrar[C]"); |
32 |
setDescription(new String[]{"Arco","Cerrar","Cancelar"}); |
33 |
addPoint(pointX,pointY); |
34 |
} |
35 |
} |
36 |
NextPointOrArcOrClose{ |
37 |
|
38 |
addOption(s:String) |
39 |
[s.equals("A") || s.equals("a") || s.equals("Arco")] |
40 |
NextPointOrLineOrClose { |
41 |
setQuestion("Insertar punto siguiente, Linea[N] o Cerrar[C]"); |
42 |
setDescription(new String[]{"Linea","Cerrar","Cancelar"}); |
43 |
addOption(s); |
44 |
} |
45 |
addOption(s:String) |
46 |
[s.equals("C") || s.equals("c") || s.equals("Cerrar")] |
47 |
FirstPoint { |
48 |
addOption(s); |
49 |
closeGeometry(); |
50 |
endGeometry(); |
51 |
end(); |
52 |
} |
53 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
54 |
NextPointOrArcOrClose { |
55 |
setQuestion("Insertar siguiente punto, Arco[A] o Cerrar[C]"); |
56 |
setDescription(new String[]{"Arco","Cerrar","Cancelar"}); |
57 |
addPoint(pointX,pointY); |
58 |
} |
59 |
} |
60 |
NextPointOrLineOrClose{ |
61 |
addPoint( pointX:double,pointY:double,event:InputEvent) |
62 |
NextPointOrLineOrClose { |
63 |
setQuestion("Insertar punto siguiente, Linea[N] o Cerrar[C]"); |
64 |
setDescription(new String[]{"Linea","Cerrar","Cancelar"}); |
65 |
addPoint(pointX,pointY); |
66 |
} |
67 |
addOption(s:String) |
68 |
[s.equals("N") || s.equals("n") || s.equals("Linea")] |
69 |
NextPointOrArcOrClose { |
70 |
setQuestion("Insertar siguiente punto, Arco[A] o Cerrar[C]"); |
71 |
setDescription(new String[]{"Arco","Cerrar","Cancelar"}); |
72 |
addOption(s); |
73 |
} |
74 |
addOption(s:String) |
75 |
[s.equals("C") || s.equals("c") || s.equals("Cerrar")] |
76 |
FirstPoint { |
77 |
addOption(s); |
78 |
closeGeometry(); |
79 |
endGeometry(); |
80 |
end(); |
81 |
} |
82 |
} |
83 |
|
84 |
Default |
85 |
{ |
86 |
addOption(s:String) |
87 |
[s.equals("Cancelar")] |
88 |
FirstPoint{ |
89 |
cancel(); |
90 |
} |
91 |
addOption(s:String) |
92 |
[s.equals("")] |
93 |
FirstPoint{ |
94 |
endGeometry(); |
95 |
} |
96 |
|
97 |
} |
98 |
%% |