Statistics
| Revision:

svn-gvsig-desktop / tags / v1_12_0_Build_1414 / extensions / extCAD / sm / SplitGeometryCADTool.sm @ 40078

History | View | Annotate | Download (2.47 KB)

1
%{
2
/**
3
 Finite state machine, generated with fsm tool
4
 (http://smc.sourceforge.net)
5
 @author Alvaro Zabala
6
*/
7
%}
8

    
9
%start SplitGeometry::FirstPoint
10
%class SplitGeometryCADTool
11
%package com.iver.cit.gvsig.gui.cad.tools.smc
12
%import com.iver.cit.gvsig.gui.cad.tools.SplitGeometryCADTool
13
%import java.awt.event.InputEvent
14
%import com.iver.andami.PluginServices
15

    
16

    
17
%map SplitGeometry
18
%%
19

    
20

    
21

    
22
FirstPoint
23

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

    
29
  Exit{}
30

    
31
  {
32
  addPoint( pointX:double,pointY:double,event:InputEvent)
33
      DigitizingLine{
34
        setQuestion(PluginServices.getText(this,"insert_more_points_or_finish"));
35
        setDescription(new String[]{"cancel"});
36
        addPoint( pointX,pointY,event);
37
      }
38
  }
39

    
40

    
41
DigitizingLine{
42
  /**
43
  addPoint( pointX:double,pointY:double,event:InputEvent)
44
  [ctxt.isDigitingFinished()]
45
  FirstPoint{
46
   			finishDigitizedLine();
47
   			splitSelectedGeometryWithDigitizedLine();
48
   			end();
49
   }
50
   */
51

    
52
   addOption(s:String)
53
   [s.equalsIgnoreCase(PluginServices.getText(this,"SplitGeometryCADTool.end")) || s.equalsIgnoreCase(PluginServices.getText(this,"terminate"))]
54
	FirstPoint {
55
		finishDigitizedLine();
56
   		splitSelectedGeometryWithDigitizedLine();
57
   		end();
58
	}
59

    
60

    
61
   addPoint( pointX:double,pointY:double,event:InputEvent)
62
   DigitizingLine{
63
   		setQuestion(
64
				PluginServices.getText(this,"insert_next_point")+
65
				PluginServices.getText(this,"cad.or")+" "+
66
				PluginServices.getText(this,"end")+
67
				"["+PluginServices.getText(this,"SplitGeometryCADTool.end")+"]"
68
		);
69
		setDescription(new String[]{"inter_arc","terminate","cancel"});
70
		addPoint( pointX,pointY,event);
71
   }
72
}
73

    
74
Default{
75

    
76
  addOption(s:String)
77
  [s.equals("")]
78
  FirstPoint{
79
    restorePreviousTool();
80
    setQuestion(PluginServices.getText(this,"insert_first_point"));
81
    setDescription(new String[]{"cancel"});
82
    end();
83
   }
84

    
85
  addOption(s:String)
86
  [s.equals(PluginServices.getText(this,"cancel"))]
87
  FirstPoint{
88
      end();
89
  }
90

    
91
addOption(s:String)
92
	FirstPoint{
93
		throwOptionException(PluginServices.getText(this,"incorrect_option"),s);
94
		}
95

    
96
addValue(d:double)
97
	FirstPoint{
98
		throwValueException(PluginServices.getText(this,"incorrect_value"),d);
99
		}
100

    
101
addPoint(pointX:double,pointY:double,event:InputEvent)
102
	FirstPoint{
103
		throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY);
104
		}
105
}
106
%%