annotate Applications/Samples/StoneSampleCommands_generated.ts @ 593:6bf8f881fcb5

OpenGLBasicPolylineRenderer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 26 Apr 2019 13:04:56 +0200
parents 79bb0a02d1cc
children 4eccf698e52f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
527
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
1 /*
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
2 1 2 3 4 5 6 7
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
3 12345678901234567890123456789012345678901234567890123456789012345678901234567890
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
4
535
79bb0a02d1cc - Added ORTHANC_OVERRIDE to several methods (translates to "override" in C++ 11 compilers)
Benjamin Golinvaux <bgo@osimis.io>
parents: 527
diff changeset
5 Generated on 2019-03-18 12:07:42.696093 by stonegentool
527
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
6
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
7 */
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
8
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
9 function StoneCheckSerializedValueType(value: any, typeStr: string)
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
10 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
11 StoneCheckSerializedValueTypeGeneric(value);
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
12
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
13 if (value['type'] != typeStr)
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
14 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
15 throw new Error(
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
16 `Cannot deserialize type ${value['type']} into ${typeStr}`);
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
17 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
18 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
19
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
20 function isString(val: any) :boolean
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
21 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
22 return ((typeof val === 'string') || (val instanceof String));
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
23 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
24
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
25 function StoneCheckSerializedValueTypeGeneric(value: any)
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
26 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
27 // console.//log("+-------------------------------------------------+");
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
28 // console.//log("| StoneCheckSerializedValueTypeGeneric |");
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
29 // console.//log("+-------------------------------------------------+");
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
30 // console.//log("value = ");
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
31 // console.//log(value);
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
32 if ( (!('type' in value)) || (!isString(value.type)) )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
33 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
34 throw new Error(
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
35 "Cannot deserialize value ('type' key invalid)");
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
36 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
37 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
38
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
39 // end of generic methods
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
40
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
41 export enum Tool {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
42 LineMeasure = "LineMeasure",
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
43 CircleMeasure = "CircleMeasure",
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
44 Crop = "Crop",
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
45 Windowing = "Windowing",
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
46 Zoom = "Zoom",
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
47 Pan = "Pan",
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
48 Move = "Move",
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
49 Rotate = "Rotate",
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
50 Resize = "Resize",
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
51 Mask = "Mask"
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
52 };
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
53
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
54 export function Tool_FromString(strValue:string) : Tool
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
55 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
56 if( strValue == "LineMeasure" )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
57 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
58 return Tool.LineMeasure;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
59 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
60 if( strValue == "CircleMeasure" )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
61 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
62 return Tool.CircleMeasure;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
63 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
64 if( strValue == "Crop" )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
65 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
66 return Tool.Crop;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
67 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
68 if( strValue == "Windowing" )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
69 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
70 return Tool.Windowing;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
71 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
72 if( strValue == "Zoom" )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
73 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
74 return Tool.Zoom;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
75 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
76 if( strValue == "Pan" )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
77 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
78 return Tool.Pan;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
79 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
80 if( strValue == "Move" )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
81 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
82 return Tool.Move;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
83 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
84 if( strValue == "Rotate" )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
85 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
86 return Tool.Rotate;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
87 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
88 if( strValue == "Resize" )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
89 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
90 return Tool.Resize;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
91 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
92 if( strValue == "Mask" )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
93 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
94 return Tool.Mask;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
95 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
96
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
97 let msg : string = `String ${strValue} cannot be converted to Tool. Possible values are: LineMeasure, CircleMeasure, Crop, Windowing, Zoom, Pan, Move, Rotate, Resize, Mask`;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
98 throw new Error(msg);
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
99 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
100
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
101 export function Tool_ToString(value:Tool) : string
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
102 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
103 if( value == Tool.LineMeasure )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
104 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
105 return "LineMeasure";
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
106 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
107 if( value == Tool.CircleMeasure )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
108 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
109 return "CircleMeasure";
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
110 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
111 if( value == Tool.Crop )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
112 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
113 return "Crop";
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
114 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
115 if( value == Tool.Windowing )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
116 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
117 return "Windowing";
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
118 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
119 if( value == Tool.Zoom )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
120 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
121 return "Zoom";
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
122 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
123 if( value == Tool.Pan )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
124 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
125 return "Pan";
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
126 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
127 if( value == Tool.Move )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
128 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
129 return "Move";
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
130 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
131 if( value == Tool.Rotate )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
132 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
133 return "Rotate";
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
134 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
135 if( value == Tool.Resize )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
136 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
137 return "Resize";
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
138 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
139 if( value == Tool.Mask )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
140 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
141 return "Mask";
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
142 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
143
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
144 let msg : string = `Value ${value} cannot be converted to Tool. Possible values are: `;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
145 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
146 let _LineMeasure_enumValue : string = Tool.LineMeasure; // enums are strings in stonecodegen, so this will work.
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
147 let msg_LineMeasure : string = `LineMeasure (${_LineMeasure_enumValue}), `;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
148 msg = msg + msg_LineMeasure;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
149 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
150 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
151 let _CircleMeasure_enumValue : string = Tool.CircleMeasure; // enums are strings in stonecodegen, so this will work.
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
152 let msg_CircleMeasure : string = `CircleMeasure (${_CircleMeasure_enumValue}), `;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
153 msg = msg + msg_CircleMeasure;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
154 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
155 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
156 let _Crop_enumValue : string = Tool.Crop; // enums are strings in stonecodegen, so this will work.
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
157 let msg_Crop : string = `Crop (${_Crop_enumValue}), `;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
158 msg = msg + msg_Crop;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
159 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
160 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
161 let _Windowing_enumValue : string = Tool.Windowing; // enums are strings in stonecodegen, so this will work.
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
162 let msg_Windowing : string = `Windowing (${_Windowing_enumValue}), `;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
163 msg = msg + msg_Windowing;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
164 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
165 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
166 let _Zoom_enumValue : string = Tool.Zoom; // enums are strings in stonecodegen, so this will work.
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
167 let msg_Zoom : string = `Zoom (${_Zoom_enumValue}), `;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
168 msg = msg + msg_Zoom;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
169 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
170 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
171 let _Pan_enumValue : string = Tool.Pan; // enums are strings in stonecodegen, so this will work.
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
172 let msg_Pan : string = `Pan (${_Pan_enumValue}), `;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
173 msg = msg + msg_Pan;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
174 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
175 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
176 let _Move_enumValue : string = Tool.Move; // enums are strings in stonecodegen, so this will work.
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
177 let msg_Move : string = `Move (${_Move_enumValue}), `;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
178 msg = msg + msg_Move;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
179 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
180 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
181 let _Rotate_enumValue : string = Tool.Rotate; // enums are strings in stonecodegen, so this will work.
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
182 let msg_Rotate : string = `Rotate (${_Rotate_enumValue}), `;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
183 msg = msg + msg_Rotate;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
184 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
185 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
186 let _Resize_enumValue : string = Tool.Resize; // enums are strings in stonecodegen, so this will work.
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
187 let msg_Resize : string = `Resize (${_Resize_enumValue}), `;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
188 msg = msg + msg_Resize;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
189 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
190 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
191 let _Mask_enumValue : string = Tool.Mask; // enums are strings in stonecodegen, so this will work.
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
192 let msg_Mask : string = `Mask (${_Mask_enumValue})`;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
193 msg = msg + msg_Mask;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
194 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
195 throw new Error(msg);
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
196 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
197
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
198 export enum ActionType {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
199 UndoCrop = "UndoCrop",
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
200 Rotate = "Rotate",
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
201 Invert = "Invert"
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
202 };
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
203
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
204 export function ActionType_FromString(strValue:string) : ActionType
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
205 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
206 if( strValue == "UndoCrop" )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
207 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
208 return ActionType.UndoCrop;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
209 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
210 if( strValue == "Rotate" )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
211 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
212 return ActionType.Rotate;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
213 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
214 if( strValue == "Invert" )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
215 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
216 return ActionType.Invert;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
217 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
218
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
219 let msg : string = `String ${strValue} cannot be converted to ActionType. Possible values are: UndoCrop, Rotate, Invert`;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
220 throw new Error(msg);
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
221 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
222
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
223 export function ActionType_ToString(value:ActionType) : string
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
224 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
225 if( value == ActionType.UndoCrop )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
226 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
227 return "UndoCrop";
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
228 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
229 if( value == ActionType.Rotate )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
230 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
231 return "Rotate";
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
232 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
233 if( value == ActionType.Invert )
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
234 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
235 return "Invert";
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
236 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
237
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
238 let msg : string = `Value ${value} cannot be converted to ActionType. Possible values are: `;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
239 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
240 let _UndoCrop_enumValue : string = ActionType.UndoCrop; // enums are strings in stonecodegen, so this will work.
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
241 let msg_UndoCrop : string = `UndoCrop (${_UndoCrop_enumValue}), `;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
242 msg = msg + msg_UndoCrop;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
243 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
244 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
245 let _Rotate_enumValue : string = ActionType.Rotate; // enums are strings in stonecodegen, so this will work.
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
246 let msg_Rotate : string = `Rotate (${_Rotate_enumValue}), `;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
247 msg = msg + msg_Rotate;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
248 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
249 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
250 let _Invert_enumValue : string = ActionType.Invert; // enums are strings in stonecodegen, so this will work.
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
251 let msg_Invert : string = `Invert (${_Invert_enumValue})`;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
252 msg = msg + msg_Invert;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
253 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
254 throw new Error(msg);
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
255 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
256
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
257
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
258
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
259 export class SelectTool {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
260 tool:Tool;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
261
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
262 constructor() {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
263 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
264
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
265 public StoneSerialize(): string {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
266 let container: object = {};
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
267 container['type'] = 'StoneSampleCommands.SelectTool';
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
268 container['value'] = this;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
269 return JSON.stringify(container);
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
270 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
271
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
272 public static StoneDeserialize(valueStr: string) : SelectTool
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
273 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
274 let value: any = JSON.parse(valueStr);
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
275 StoneCheckSerializedValueType(value, 'StoneSampleCommands.SelectTool');
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
276 let result: SelectTool = value['value'] as SelectTool;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
277 return result;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
278 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
279 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
280 export class Action {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
281 type:ActionType;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
282
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
283 constructor() {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
284 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
285
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
286 public StoneSerialize(): string {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
287 let container: object = {};
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
288 container['type'] = 'StoneSampleCommands.Action';
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
289 container['value'] = this;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
290 return JSON.stringify(container);
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
291 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
292
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
293 public static StoneDeserialize(valueStr: string) : Action
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
294 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
295 let value: any = JSON.parse(valueStr);
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
296 StoneCheckSerializedValueType(value, 'StoneSampleCommands.Action');
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
297 let result: Action = value['value'] as Action;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
298 return result;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
299 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
300 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
301
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
302 export interface IHandler {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
303 };
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
304
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
305 /** Service function for StoneDispatchToHandler */
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
306 export function StoneDispatchJsonToHandler(
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
307 jsonValue: any, handler: IHandler): boolean
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
308 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
309 StoneCheckSerializedValueTypeGeneric(jsonValue);
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
310 let type: string = jsonValue["type"];
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
311 if (type == "")
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
312 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
313 // this should never ever happen
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
314 throw new Error("Caught empty type while dispatching");
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
315 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
316 else
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
317 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
318 return false;
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
319 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
320 }
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
321
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
322 /** Takes a serialized type and passes this to the handler */
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
323 export function StoneDispatchToHandler(
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
324 strValue: string, handler: IHandler): boolean
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
325 {
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
326 // console.//log("+------------------------------------------------+");
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
327 // console.//log("| StoneDispatchToHandler |");
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
328 // console.//log("+------------------------------------------------+");
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
329 // console.//log("strValue = ");
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
330 // console.//log(strValue);
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
331 let jsonValue: any = JSON.parse(strValue)
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
332 return StoneDispatchJsonToHandler(jsonValue, handler);
b1377625e4ba Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
333 }