svn-gvsig-desktop / tags / v1_1_2_Build_1045 / extensions / extCAD / sm / RectangleCADTool.sm @ 41712
History | View | Annotate | Download (1.8 KB)
1 | 3766 | caballero | // -*- tab-width: 4; -*- |
---|---|---|---|
2 | |||
3 | %{ |
||
4 | // |
||
5 | // Vicente Caballero Navarro |
||
6 | %} |
||
7 | |||
8 | 3978 | caballero | %start Rectangle::FirstPoint |
9 | 3766 | caballero | %class RectangleCADTool |
10 | %package com.iver.cit.gvsig.gui.cad.tools.smc |
||
11 | %import com.iver.cit.gvsig.gui.cad.tools.RectangleCADTool |
||
12 | 4324 | caballero | %import java.awt.event.InputEvent |
13 | 4583 | caballero | %import com.iver.andami.PluginServices |
14 | 3766 | caballero | |
15 | 3978 | caballero | %map Rectangle |
16 | 3766 | caballero | %% |
17 | // A task begins life in suspended animation. |
||
18 | |||
19 | 3978 | caballero | FirstPoint |
20 | 3766 | caballero | |
21 | Entry { |
||
22 | 4892 | caballero | setQuestion( |
23 | 4583 | caballero | PluginServices.getText(this,"insert_first_point_corner")); |
24 | setDescription(new String[]{"cancel"}); |
||
25 | 3766 | caballero | } |
26 | Exit{ |
||
27 | } |
||
28 | |||
29 | { |
||
30 | |||
31 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
32 | 3978 | caballero | SecondPointOrSquare { |
33 | 4583 | caballero | setQuestion(PluginServices.getText(this,"insert_point_corner_or_square")); |
34 | setDescription(new String[]{"square","cancel"}); |
||
35 | 4365 | caballero | addPoint( pointX,pointY,event); |
36 | 3766 | caballero | } |
37 | |||
38 | } |
||
39 | 3978 | caballero | SecondPointOrSquare{ |
40 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
41 | 3978 | caballero | FirstPoint { |
42 | 4365 | caballero | addPoint(pointX,pointY,event); |
43 | 3766 | caballero | end(); |
44 | } |
||
45 | 3828 | caballero | addOption(s:String) |
46 | 4583 | caballero | [s.equals("c") || s.equals("C") || s.equals(PluginServices.getText(this,"square"))] |
47 | 3978 | caballero | SecondPointSquare { |
48 | 4583 | caballero | setQuestion(PluginServices.getText(this,"insert_opposited_corner")); |
49 | setDescription(new String[]{"cancel"}); |
||
50 | 3828 | caballero | addOption(s); |
51 | 3766 | caballero | } |
52 | |||
53 | } |
||
54 | 3978 | caballero | SecondPointSquare{ |
55 | 4324 | caballero | addPoint( pointX:double,pointY:double,event:InputEvent) |
56 | 3978 | caballero | FirstPoint { |
57 | 4365 | caballero | addPoint( pointX,pointY,event); |
58 | 3766 | caballero | end(); |
59 | } |
||
60 | } |
||
61 | 3978 | caballero | |
62 | 3766 | caballero | Default |
63 | { |
||
64 | 3883 | caballero | addOption(s:String) |
65 | 4583 | caballero | [s.equals(PluginServices.getText(this,"cancel"))] |
66 | 3978 | caballero | FirstPoint{ |
67 | 3883 | caballero | end(); |
68 | } |
||
69 | 5730 | caballero | addOption(s:String) |
70 | FirstPoint{ |
||
71 | throwOptionException(PluginServices.getText(this,"incorrect_option"),s); |
||
72 | } |
||
73 | addValue(d:double) |
||
74 | FirstPoint{ |
||
75 | throwValueException(PluginServices.getText(this,"incorrect_value"),d); |
||
76 | } |
||
77 | addPoint(pointX:double,pointY:double,event:InputEvent) |
||
78 | FirstPoint{ |
||
79 | throwPointException(PluginServices.getText(this,"incorrect_point"),pointX,pointY); |
||
80 | } |
||
81 | 3766 | caballero | } |
82 | %% |