Commit 5e3d9598ce24c263cbed1843765a637efefd0b80
1 parent
7b0f5529
Exists in
master
11530: add input position unit choice
Showing
22 changed files
with
984 additions
and
168 deletions
Show diff stats
... | ... | @@ -0,0 +1,268 @@ |
1 | +Ext.define('treps.controller.Vectors.VecDefGrid', { | |
2 | + extend: 'Ext.app.Controller', | |
3 | + | |
4 | + views: [ | |
5 | + 'Steps.TransformationDefinition.TransformationDefinitionPanel' | |
6 | + ], | |
7 | + | |
8 | + requires: [ | |
9 | + 'treps.controller.Vectors.UnitsManager' | |
10 | + ], | |
11 | + | |
12 | + stores: [ | |
13 | + 'Vectors', | |
14 | + 'Units' | |
15 | + ], | |
16 | + | |
17 | + models: [ | |
18 | + 'Vector', | |
19 | + 'Unit' | |
20 | + ], | |
21 | + | |
22 | + refs: [ | |
23 | + { | |
24 | + ref: 'vectorsGrid', | |
25 | + selector: 'dataselect_container > container > vecdef_grid' | |
26 | + }, | |
27 | + { | |
28 | + ref: 'unitsCombo', | |
29 | + selector: '#srcUnit' | |
30 | + //selector: 'dataselect_container > container > vecdef_grid > toolbar > combobox[name=srcUnit]' | |
31 | + } | |
32 | + ], | |
33 | + | |
34 | + init: function() { | |
35 | + var me = this; | |
36 | + | |
37 | + this.control({ | |
38 | + 'dataselect_container > container > vecdef_grid > toolbar > #addVecButton': { | |
39 | + click: me.onAddVector, | |
40 | + scope: me | |
41 | + }, | |
42 | + 'dataselect_container > container > vecdef_grid > toolbar > #removeVecButton': { | |
43 | + click: me.onRemoveVector, | |
44 | + scope: me | |
45 | + }, | |
46 | + 'dataselect_container > container > vecdef_grid > toolbar > #editVecButton': { | |
47 | + click: me.onEditVector, | |
48 | + scope: me | |
49 | + }, | |
50 | + '#srcUnit': { | |
51 | + change: me.onSelectUnit, | |
52 | + scope: me | |
53 | + }, | |
54 | + 'dataselect_container > container > vecdef_grid': { | |
55 | + select: me.onSelectVector, | |
56 | + scope: me | |
57 | + } | |
58 | + }); | |
59 | + | |
60 | + }, | |
61 | + | |
62 | + initStore: function(onReady) | |
63 | + { | |
64 | + var me = this; | |
65 | + //load units store in combo | |
66 | + //console.log('**** VecDefGrid:initStore: loadUnitsStore / '+me.getUnitsCombo()); | |
67 | + treps.controller.Vectors.UnitsManager.loadUnitsStore( | |
68 | + function(store) | |
69 | + { | |
70 | + me.getUnitsCombo().store = store; | |
71 | + console.log('*** loaded units store '+store.getCount()); | |
72 | + if (onReady != null) | |
73 | + onReady.call(me, store); | |
74 | + }); | |
75 | + }, | |
76 | + | |
77 | + colRenderer: function(value, metaData, record, rowIndex, colIndex, store, gridView) | |
78 | + { | |
79 | + if (colIndex == 0) | |
80 | + metaData.style = 'background:'+treps.Constants.VECTOR_COMP1_COLOR+';'; | |
81 | + else if (colIndex == 1) | |
82 | + metaData.style = 'background:'+treps.Constants.VECTOR_COMP2_COLOR+';'; | |
83 | + else if (colIndex == 2) | |
84 | + metaData.style = 'background:'+treps.Constants.VECTOR_COMP3_COLOR+';'; | |
85 | + | |
86 | + return value; | |
87 | + }, | |
88 | + | |
89 | + initRenderer: function() | |
90 | + { | |
91 | + var grid = this.getVectorsGrid(); | |
92 | + grid.colRenderer = this.colRenderer; | |
93 | + }, | |
94 | + | |
95 | + addVector: function(comp1, comp2, comp3) | |
96 | + { | |
97 | + var grid = this.getVectorsGrid(); | |
98 | + var store = grid.getStore(); | |
99 | + | |
100 | + var record = Ext.create("treps.model.Vector"); | |
101 | + record.set('comp_1',comp1); | |
102 | + record.set('comp_2',comp2); | |
103 | + record.set('comp_3',comp3); | |
104 | + record = store.add(record); | |
105 | + | |
106 | + var selMod = grid.getSelectionModel(); | |
107 | + selMod.deselectAll(); | |
108 | + selMod.select(record); | |
109 | + }, | |
110 | + | |
111 | + onAddVector: function() { | |
112 | + this.addVector('','',''); | |
113 | + this.onEditVector(); | |
114 | + }, | |
115 | + | |
116 | + onRemoveVector: function() { | |
117 | + var grid = this.getVectorsGrid(); | |
118 | + var store = grid.getStore(); | |
119 | + | |
120 | + var selMod = grid.getSelectionModel(); | |
121 | + | |
122 | + var selVecs = selMod.getSelection(); | |
123 | + | |
124 | + if (!selVecs | selVecs.length == 0) | |
125 | + { | |
126 | + treps.Messages.showError('No vector selected'); | |
127 | + return; | |
128 | + } | |
129 | + | |
130 | + selMod.deselectAll(); | |
131 | + | |
132 | + store.remove(selVecs); | |
133 | + | |
134 | + if (store.getCount() > 0) | |
135 | + selMod.select(store.getAt(0)); | |
136 | + else | |
137 | + this.application.fireEvent('resetvector'); | |
138 | + }, | |
139 | + | |
140 | + onEditVector: function() { | |
141 | + var grid = this.getVectorsGrid(); | |
142 | + | |
143 | + var selMod = grid.getSelectionModel(); | |
144 | + | |
145 | + var selVecs = selMod.getSelection(); | |
146 | + | |
147 | + if (!selVecs | selVecs.length == 0) | |
148 | + { | |
149 | + treps.Messages.showError('No vector selected'); | |
150 | + return; | |
151 | + } | |
152 | + | |
153 | + var selVec = selVecs[0]; | |
154 | + | |
155 | + this.application.fireEvent('editvector',selVec); | |
156 | + }, | |
157 | + | |
158 | + onSelectVector: function(grid,record,index) | |
159 | + { | |
160 | + this.application.fireEvent('selectvector',record); | |
161 | + }, | |
162 | + | |
163 | + clearStore: function() | |
164 | + { | |
165 | + var grid = this.getVectorsGrid(); | |
166 | + var store = grid.getStore(); | |
167 | + | |
168 | + this.application.fireEvent('resetvector'); | |
169 | + | |
170 | + store.removeAll(); | |
171 | + }, | |
172 | + | |
173 | + componentInUse: function(comp) | |
174 | + { | |
175 | + var grid = this.getVectorsGrid(); | |
176 | + var store = grid.getStore(); | |
177 | + | |
178 | + var inUse = false; | |
179 | + | |
180 | + store.each(function (vec) | |
181 | + { | |
182 | + if ((vec.get('comp_1') == comp) || (vec.get('comp_2') == comp) || (vec.get('comp_3') == comp)) | |
183 | + inUse = true; | |
184 | + }); | |
185 | + | |
186 | + return inUse; | |
187 | + }, | |
188 | + | |
189 | + isValid: function(noTrans) | |
190 | + { | |
191 | + var grid = this.getVectorsGrid(); | |
192 | + var store = grid.getStore(); | |
193 | + | |
194 | + if (!noTrans && (store.getCount() < 1)) | |
195 | + { | |
196 | + treps.Messages.showError('Please select at least one vector.'); | |
197 | + return false; | |
198 | + } | |
199 | + | |
200 | + var valid = true; | |
201 | + store.each(function (vec) | |
202 | + { | |
203 | + var errors = vec.validate(); | |
204 | + if (!errors.isValid()) | |
205 | + valid = false; | |
206 | + }); | |
207 | + | |
208 | + if (!valid) | |
209 | + { | |
210 | + treps.Messages.showError('Please define all vectors components.'); | |
211 | + return false; | |
212 | + } | |
213 | + | |
214 | + return true; | |
215 | + }, | |
216 | + | |
217 | + getVectorsStr: function() | |
218 | + { | |
219 | + var grid = this.getVectorsGrid(); | |
220 | + var store = grid.getStore(); | |
221 | + var scale = this.getUnitsCombo().getValue() | |
222 | + | |
223 | + var res = ''; | |
224 | + | |
225 | + store.each(function (vec) | |
226 | + { | |
227 | + if (res != '') | |
228 | + res += ';'; | |
229 | + res += '('; | |
230 | + res += vec.get('comp_1'); | |
231 | + res += ','; | |
232 | + res += vec.get('comp_2'); | |
233 | + res += ','; | |
234 | + res += vec.get('comp_3'); | |
235 | + if (vec.get('is_pos')) | |
236 | + { | |
237 | + res += ',1'; | |
238 | + //res += 1; | |
239 | + } else { | |
240 | + res += ',0'; | |
241 | + } | |
242 | + res+=',' + scale; | |
243 | + res += ')'; | |
244 | + }); | |
245 | + | |
246 | + return res; | |
247 | + }, | |
248 | + | |
249 | + onSelectUnit: function(combo, newValue, oldValue, eOpts) | |
250 | + { | |
251 | + console.log('***********onSelectUnit value: '+this.getScale()); | |
252 | + | |
253 | + }, | |
254 | + | |
255 | + selectDefaultUnit() { | |
256 | + var unitsCombo = this.getUnitsCombo(); | |
257 | + unitsCombo.setValue(unitsCombo.store.data.items[0].data.kmvalue); | |
258 | + //console.log('***********default selected: value: '+unitsCombo.getValue()+' '+unitsCombo.store.data.items[0].data.kmvalue); | |
259 | + }, | |
260 | + | |
261 | + getScale: function() | |
262 | + { | |
263 | + //var unitsCombo = this.getUnitsCombo(); | |
264 | + //unitCombo.options[unitCombo.selectedIndex].text | |
265 | + //console.log ('**** unit Combo selection ' + unitsCombo +' *** Combo obj : '+unitsCombo.getValue()); | |
266 | + return this.getUnitsCombo().getValue(); | |
267 | + } | |
268 | +}); | ... | ... |
... | ... | @@ -0,0 +1,20 @@ |
1 | +Ext.define('treps.store.Units', { | |
2 | + extend: 'Ext.data.Store', | |
3 | + | |
4 | + model: 'treps.model.Unit', | |
5 | + | |
6 | + remoteSort: false, | |
7 | + | |
8 | + storeId : 'UnitsStore', | |
9 | + | |
10 | + proxy: { | |
11 | + type: 'direct', | |
12 | + reader : { | |
13 | + type : 'json', | |
14 | + root : 'units' | |
15 | + }, | |
16 | + api: { | |
17 | + read : "TREPSAction.getUnitsList" | |
18 | + } | |
19 | + } | |
20 | +}); | ... | ... |
server/kernel/config/app.config
... | ... | @@ -0,0 +1,175 @@ |
1 | +<?xml version="1.0"?> | |
2 | +<treps> | |
3 | + <units> | |
4 | + <unit id="km"> | |
5 | + <fullname>Km</fullname> | |
6 | + <kmvalue>1</kmvalue> | |
7 | + </unit> | |
8 | + <unit id="AU"> | |
9 | + <fullname>AU</fullname> | |
10 | + <kmvalue>149597870</kmvalue> | |
11 | + </unit> | |
12 | + <unit id="RSun"> | |
13 | + <fullname>Sun Radius</fullname> | |
14 | + <kmvalue>695700</kmvalue> | |
15 | + </unit> | |
16 | + <unit id="RMercury"> | |
17 | + <fullname>Mercury radius</fullname> | |
18 | + <kmvalue>2440.53</kmvalue> | |
19 | + </unit> | |
20 | + <unit id="RVenus"> | |
21 | + <fullname>Venus radius</fullname> | |
22 | + <kmvalue>6051.8</kmvalue> | |
23 | + </unit> | |
24 | + <unit id="REarth"> | |
25 | + <fullname>Earth radius</fullname> | |
26 | + <kmvalue>6378.1366</kmvalue> | |
27 | + </unit> | |
28 | + <unit id="RMoon"> | |
29 | + <fullname>Moon radius</fullname> | |
30 | + <kmvalue>1737.4</kmvalue> | |
31 | + </unit> | |
32 | + <unit id="RMars"> | |
33 | + <fullname>Mars radius</fullname> | |
34 | + <kmvalue>3396.19</kmvalue> | |
35 | + </unit> | |
36 | + <unit id="RPhobos"> | |
37 | + <fullname>Phobos radius</fullname> | |
38 | + <kmvalue>13</kmvalue> | |
39 | + </unit> | |
40 | + <unit id="RDeimos"> | |
41 | + <fullname>Deimos radius</fullname> | |
42 | + <kmvalue>7.8</kmvalue> | |
43 | + </unit> | |
44 | + | |
45 | + | |
46 | + <unit id="RJupiter"> | |
47 | + <fullname>Jupiter radius</fullname> | |
48 | + <kmvalue>71492</kmvalue> | |
49 | + </unit> | |
50 | + <unit id="RIo"> | |
51 | + <fullname>Io radius</fullname> | |
52 | + <kmvalue>1829.4</kmvalue> | |
53 | + </unit> | |
54 | + <unit id="REuropa"> | |
55 | + <fullname>Europa radius</fullname> | |
56 | + <kmvalue>1562.6</kmvalue> | |
57 | + </unit> | |
58 | + <unit id="RGanymede"> | |
59 | + <fullname>Ganymede radius</fullname> | |
60 | + <kmvalue>2631.2</kmvalue> | |
61 | + </unit> | |
62 | + <unit id="RCallisto"> | |
63 | + <fullname>Callisto radius</fullname> | |
64 | + <kmvalue>2410.3</kmvalue> | |
65 | + </unit> | |
66 | + <unit id="RAmalthea"> | |
67 | + <fullname>Amalthea radius</fullname> | |
68 | + <kmvalue>125</kmvalue> | |
69 | + </unit> | |
70 | + | |
71 | + | |
72 | + | |
73 | + <unit id="RSaturn"> | |
74 | + <fullname>Saturn radius</fullname> | |
75 | + <kmvalue>60268</kmvalue> | |
76 | + </unit> | |
77 | + <unit id="RMimas"> | |
78 | + <fullname>Mimas radius</fullname> | |
79 | + <kmvalue>207.8</kmvalue> | |
80 | + </unit> | |
81 | + <unit id="REnceladus"> | |
82 | + <fullname>Enceladus radius</fullname> | |
83 | + <kmvalue>256.6</kmvalue> | |
84 | + </unit> | |
85 | + <unit id="RTethys"> | |
86 | + <fullname>Tethys radius</fullname> | |
87 | + <kmvalue>538.4</kmvalue> | |
88 | + </unit> | |
89 | + <unit id="RDione"> | |
90 | + <fullname>Dione radius</fullname> | |
91 | + <kmvalue>563.4</kmvalue> | |
92 | + </unit> | |
93 | + <unit id="RRhea"> | |
94 | + <fullname>Rhea radius</fullname> | |
95 | + <kmvalue>765</kmvalue> | |
96 | + </unit> | |
97 | + <unit id="RTitan"> | |
98 | + <fullname>Titan radius</fullname> | |
99 | + <kmvalue>2575.15</kmvalue> | |
100 | + </unit> | |
101 | + <unit id="RHyperion"> | |
102 | + <fullname>Hyperion radius</fullname> | |
103 | + <kmvalue>180.1</kmvalue> | |
104 | + </unit> | |
105 | + <unit id="RIapetus"> | |
106 | + <fullname>Iapetus radius</fullname> | |
107 | + <kmvalue>745.7</kmvalue> | |
108 | + </unit> | |
109 | + <unit id="RPhoebe"> | |
110 | + <fullname>Phoebe radius</fullname> | |
111 | + <kmvalue>109.4</kmvalue> | |
112 | + </unit> | |
113 | + | |
114 | + | |
115 | + | |
116 | + <unit id="RUranus"> | |
117 | + <fullname>Uranus radius</fullname> | |
118 | + <kmvalue>25559</kmvalue> | |
119 | + </unit> | |
120 | + <unit id="RAriel"> | |
121 | + <fullname>Ariel radius</fullname> | |
122 | + <kmvalue>581.1</kmvalue> | |
123 | + </unit> | |
124 | + <unit id="RUmbriel"> | |
125 | + <fullname>Umbriel radius</fullname> | |
126 | + <kmvalue>584.7</kmvalue> | |
127 | + </unit> | |
128 | + <unit id="RTitania"> | |
129 | + <fullname>Titania radius</fullname> | |
130 | + <kmvalue>788.9</kmvalue> | |
131 | + </unit> | |
132 | + <unit id="ROberon"> | |
133 | + <fullname>Oberon radius</fullname> | |
134 | + <kmvalue>761.4</kmvalue> | |
135 | + </unit> | |
136 | + <unit id="RMiranda"> | |
137 | + <fullname>Miranda radius</fullname> | |
138 | + <kmvalue>240.4</kmvalue> | |
139 | + </unit> | |
140 | + | |
141 | + | |
142 | + | |
143 | + <unit id="RNeptune"> | |
144 | + <fullname>Neptune radius</fullname> | |
145 | + <kmvalue>24764</kmvalue> | |
146 | + </unit> | |
147 | + <unit id="RTriton"> | |
148 | + <fullname>Triton radius</fullname> | |
149 | + <kmvalue>1352.6</kmvalue> | |
150 | + </unit> | |
151 | + <unit id="RNereid"> | |
152 | + <fullname>Nereid radius</fullname> | |
153 | + <kmvalue>170</kmvalue> | |
154 | + </unit> | |
155 | + <unit id="RNaiad"> | |
156 | + <fullname>Naiad radius</fullname> | |
157 | + <kmvalue>29</kmvalue> | |
158 | + </unit> | |
159 | + <unit id="RThalassa"> | |
160 | + <fullname>Thalassa radius</fullname> | |
161 | + <kmvalue>40</kmvalue> | |
162 | + </unit> | |
163 | + | |
164 | + | |
165 | + | |
166 | + <unit id="RPluto"> | |
167 | + <fullname>Pluto radius</fullname> | |
168 | + <kmvalue>1195</kmvalue> | |
169 | + </unit> | |
170 | + <unit id="RCharon"> | |
171 | + <fullname>Charon radius</fullname> | |
172 | + <kmvalue>606</kmvalue> | |
173 | + </unit> | |
174 | + </units> | |
175 | +</treps> | ... | ... |
server/kernel/src/Application/ApplicationConfig.cpp
... | ... | @@ -84,6 +84,14 @@ namespace TREPS |
84 | 84 | return path; |
85 | 85 | } |
86 | 86 | |
87 | + string ApplicationConfigClass::getUnitsFilePath(void) | |
88 | + { | |
89 | + //get the full path of the units definition file | |
90 | + string path = this->getDataDirPath(); | |
91 | + path += this->get("treps.data.units"); | |
92 | + return path; | |
93 | + } | |
94 | + | |
87 | 95 | string ApplicationConfigClass::getExportsFilePath(void) |
88 | 96 | { |
89 | 97 | //get the full path of the exports definition file | ... | ... |
server/kernel/src/Application/ApplicationConfig.h
... | ... | @@ -38,6 +38,9 @@ namespace TREPS |
38 | 38 | //get the full path of the time formats definition file |
39 | 39 | string getTimesFilePath(void); |
40 | 40 | |
41 | + //get the full path of the units definition file | |
42 | + string getUnitsFilePath(void); | |
43 | + | |
41 | 44 | //get the full path of the exports definition file |
42 | 45 | string getExportsFilePath(void); |
43 | 46 | ... | ... |
server/kernel/src/Common/TREPSTypes.h
... | ... | @@ -57,10 +57,11 @@ namespace TREPS |
57 | 57 | string id; |
58 | 58 | string fieldId[3]; |
59 | 59 | bool ispos; |
60 | + double scale; | |
60 | 61 | string frame; |
61 | 62 | long int nbRecords; |
62 | 63 | //constructor |
63 | - t_Vector(void) : id(""), fieldId(), ispos(false), frame(""), nbRecords(0) | |
64 | + t_Vector(void) : id(""), fieldId(), ispos(false), scale(1), frame(""), nbRecords(0) | |
64 | 65 | { |
65 | 66 | |
66 | 67 | } | ... | ... |
server/kernel/src/RequestManager/RequestManager.cpp
... | ... | @@ -12,6 +12,7 @@ |
12 | 12 | #include "RequestResultGet.h" |
13 | 13 | #include "RequestStatusGet.h" |
14 | 14 | #include "RequestTimesGet.h" |
15 | +#include "RequestUnitsGet.h" | |
15 | 16 | #include "RequestExportsGet.h" |
16 | 17 | #include "RequestFormatsGet.h" |
17 | 18 | #include "RequestExportOp.h" |
... | ... | @@ -90,6 +91,8 @@ namespace TREPS |
90 | 91 | this->request = new RequestStatusGetClass(); |
91 | 92 | else if (typeStr.compare("times_get") == 0) |
92 | 93 | this->request = new RequestTimesGetClass(); |
94 | + else if (typeStr.compare("units_get") == 0) | |
95 | + this->request = new RequestUnitsGetClass(); | |
93 | 96 | else if (typeStr.compare("exports_get") == 0) |
94 | 97 | this->request = new RequestExportsGetClass(); |
95 | 98 | else if (typeStr.compare("formats_get") == 0) | ... | ... |
server/kernel/src/RequestManager/RequestRunOp.cpp
server/kernel/src/RequestManager/RequestRunOp.h
... | ... | @@ -0,0 +1,67 @@ |
1 | +#include "RequestUnitsGet.h" | |
2 | + | |
3 | +#include "../UnitManager/UnitManager.h" | |
4 | + | |
5 | +using namespace TREPS::UnitManager; | |
6 | + | |
7 | +namespace TREPS | |
8 | +{ | |
9 | + namespace RequestManager | |
10 | + { | |
11 | + RequestUnitsGetClass::RequestUnitsGetClass(void):RequestAbstractClass() | |
12 | + { | |
13 | + this->outputType = OUTPUT_XMLFILE; | |
14 | + } | |
15 | + | |
16 | + RequestUnitsGetClass::~RequestUnitsGetClass(void) | |
17 | + { | |
18 | + } | |
19 | + | |
20 | + string RequestUnitsGetClass::getRequestId(void) | |
21 | + { | |
22 | + return "units_get"; | |
23 | + } | |
24 | + | |
25 | + bool RequestUnitsGetClass::load(RequestLoaderClass *loader) | |
26 | + { | |
27 | + //nothing to do | |
28 | + return true; | |
29 | + } | |
30 | + | |
31 | + bool RequestUnitsGetClass::run(void) | |
32 | + { | |
33 | + string unitsFile = this->app->getConf()->getUnitsFilePath(); | |
34 | + | |
35 | + if (unitsFile.compare("") == 0) | |
36 | + return false; | |
37 | + | |
38 | + //get unit manager instance | |
39 | + UnitManagerClass *unitMgr = new UnitManagerClass; | |
40 | + | |
41 | + //file validation | |
42 | + bool fileOK = unitMgr->init(unitsFile.c_str()); | |
43 | + | |
44 | + return fileOK; | |
45 | + } | |
46 | + | |
47 | + void RequestUnitsGetClass::writeResult(ResultWriterClass *writer) | |
48 | + { | |
49 | + //No result file for this request | |
50 | + } | |
51 | + | |
52 | + string RequestUnitsGetClass::getResultFileSuffix(void) | |
53 | + { | |
54 | + return ""; | |
55 | + } | |
56 | + | |
57 | + string RequestUnitsGetClass::getXMLFilePath(void) | |
58 | + { | |
59 | + return this->app->getConf()->getUnitsFilePath(); | |
60 | + } | |
61 | + | |
62 | + string RequestUnitsGetClass::getStringResult(void) | |
63 | + { | |
64 | + return ""; | |
65 | + } | |
66 | + } | |
67 | +} | ... | ... |
... | ... | @@ -0,0 +1,44 @@ |
1 | +#ifndef REQUESTUNITSSGET_H | |
2 | +#define REQUESTUNITSSGET_H | |
3 | + | |
4 | +#include "RequestAbstract.h" | |
5 | + | |
6 | +namespace TREPS | |
7 | +{ | |
8 | + namespace RequestManager | |
9 | + { | |
10 | + class RequestUnitsGetClass : public RequestAbstractClass | |
11 | + { | |
12 | + public: | |
13 | + RequestUnitsGetClass(void); | |
14 | + | |
15 | + ~RequestUnitsGetClass(void); | |
16 | + | |
17 | + //return request id | |
18 | + string getRequestId(void); | |
19 | + | |
20 | + //load request inputs | |
21 | + bool load(RequestLoaderClass *loader); | |
22 | + | |
23 | + //run request | |
24 | + bool run(void); | |
25 | + | |
26 | + //write request result | |
27 | + void writeResult(ResultWriterClass *writer); | |
28 | + | |
29 | + //get suffix used for result file | |
30 | + string getResultFileSuffix(void); | |
31 | + | |
32 | + //get path to the result XML file | |
33 | + string getXMLFilePath(void); | |
34 | + | |
35 | + //get string result | |
36 | + string getStringResult(void); | |
37 | + | |
38 | + private: | |
39 | + }; | |
40 | + | |
41 | + } | |
42 | +} | |
43 | + | |
44 | +#endif | ... | ... |
server/kernel/src/Transformation/TransformationAbstract.cpp
server/kernel/src/Transformation/TransformationCDPP3DView.cpp
... | ... | @@ -2,6 +2,8 @@ |
2 | 2 | |
3 | 3 | #include <vector> |
4 | 4 | #include <iterator> |
5 | +// 9639 | |
6 | +#include <algorithm> | |
5 | 7 | |
6 | 8 | #include "../../CDPP3DViewSOAPClient/cdppBinder.nsmap" |
7 | 9 | |
... | ... | @@ -77,8 +79,24 @@ namespace TREPS |
77 | 79 | string status = "Clone source data"; |
78 | 80 | this->trepsRequest->setStatus(status.c_str()); |
79 | 81 | //if no fame transformation and no vector , content of result file == content of source file, except for the time field |
82 | + | |
83 | + // 9639 if « pattern - TF_PATTERN - user defined pattern » and no transformation | |
84 | + //this->result->clone(this->request->getSrcFields(), this->request->getSrcDataRecordList(), | |
85 | + // this->request->getTimeFieldId().c_str()); | |
86 | + string startingIdxToCopy = ""; | |
87 | + if(this->request->getTimeFormat()==TF_PATTERN){ | |
88 | + // in case "t_TimeFormat pattern 1" | |
89 | + // count how many time field [] | |
90 | + string lPattern = this->request->getTimePattern(); | |
91 | + int lCnt = std::count(lPattern.begin(), lPattern.end(), ']') - 1; | |
92 | + startingIdxToCopy = intToStr(lCnt); | |
93 | + | |
94 | + }else{ | |
95 | + startingIdxToCopy = this->request->getTimeFieldId().c_str(); | |
96 | + } | |
80 | 97 | this->result->clone(this->request->getSrcFields(), this->request->getSrcDataRecordList(), |
81 | - this->request->getTimeFieldId().c_str()); | |
98 | + startingIdxToCopy.c_str()); | |
99 | + | |
82 | 100 | } |
83 | 101 | else |
84 | 102 | { |
... | ... | @@ -131,7 +149,10 @@ namespace TREPS |
131 | 149 | LOG4CXX_INFO(this->app->getLog()->getPtr(),"Search for src timeFile for RTN/RTP "<<request->getSrcCenter().c_str()); |
132 | 150 | istringstream iss(request->getSrcCenter()); |
133 | 151 | vector<string> splitStr((istream_iterator<string>(iss)),istream_iterator<string>()); |
134 | - if(splitStr.size()!=4) { | |
152 | + | |
153 | + // 11165 : transfo RTN - update parameter checking | |
154 | + //if(splitStr.size()!=4) { | |
155 | + if(splitStr.size()<4) { | |
135 | 156 | this->errorMsg = "Source frame center should be 4 elements: "; |
136 | 157 | this->errorMsg += request->getSrcCenter().c_str(); |
137 | 158 | LOG4CXX_ERROR(this->app->getLog()->getPtr(),this->errorMsg); |
... | ... | @@ -144,7 +165,10 @@ namespace TREPS |
144 | 165 | LOG4CXX_INFO(this->app->getLog()->getPtr(),"Search for dst timeFile for RTN/RTP "<<request->getDstCenter().c_str()); |
145 | 166 | istringstream iss(request->getDstCenter()); |
146 | 167 | vector<string> splitStr((istream_iterator<string>(iss)),istream_iterator<string>()); |
147 | - if(splitStr.size()!=4) { | |
168 | + | |
169 | + // 11165 : transfo RTN - update parameter checking | |
170 | + //if(splitStr.size()!=4) { | |
171 | + if(splitStr.size()<4) { | |
148 | 172 | this->errorMsg = "Dest frame center should be 4 elements: "; |
149 | 173 | this->errorMsg += request->getDstCenter().c_str(); |
150 | 174 | LOG4CXX_ERROR(this->app->getLog()->getPtr(),this->errorMsg); |
... | ... | @@ -216,9 +240,9 @@ namespace TREPS |
216 | 240 | while (crtRecord != NULL) |
217 | 241 | { |
218 | 242 | ns4__Tuple3d *tup = new ns4__Tuple3d(); |
219 | - tup->x = crtRecord->getDoubleValue(vector->fieldId[0].c_str()); | |
220 | - tup->y = crtRecord->getDoubleValue(vector->fieldId[1].c_str()); | |
221 | - tup->z = crtRecord->getDoubleValue(vector->fieldId[2].c_str()); | |
243 | + tup->x = crtRecord->getDoubleValue(vector->fieldId[0].c_str())*vector->scale; | |
244 | + tup->y = crtRecord->getDoubleValue(vector->fieldId[1].c_str())*vector->scale; | |
245 | + tup->z = crtRecord->getDoubleValue(vector->fieldId[2].c_str())*vector->scale; | |
222 | 246 | |
223 | 247 | vT.push_back(tup); |
224 | 248 | crtRecord = crtRecord->getNextRecord(); |
... | ... | @@ -308,7 +332,10 @@ namespace TREPS |
308 | 332 | |
309 | 333 | _ns3__listFrames2Response listFrames2Response; |
310 | 334 | |
311 | - bool res = (this->client->listFrames2(&listFrames2Request,&listFrames2Response) == SOAP_OK); | |
335 | + //compilAndInstall.sh pb compilation Ubuntu | |
336 | + // error: no matching function for call to ‘cdppBinderProxy::listFrames2(_ns3__listFrames2*, _ns3__listFrames2Response*) | |
337 | + bool res = (this->client->listFrames2(&listFrames2Request,&listFrames2Response) == SOAP_OK); | |
338 | + //bool res = (this->client->listFrames2(&listFrames2Request,listFrames2Response) == SOAP_OK); | |
312 | 339 | |
313 | 340 | if (!res) |
314 | 341 | { |
... | ... | @@ -352,7 +379,13 @@ namespace TREPS |
352 | 379 | //run listNewFrameOrb to perform transformation (rotation + translation) |
353 | 380 | //_ns3__listNewFrameOrbResponse listNewFrameOrbResponse; |
354 | 381 | ns4__TimeFileArray listFilesResponse; |
382 | + | |
383 | + //compilAndInstall.sh pb compilation Ubuntu | |
384 | + // error: no matching function for call to ‘cdppBinderProxy::listFrames2(_ns3__listFrames2*, _ns3__listFrames2Response*) | |
355 | 385 | res = (this->client->listFiles(&listFilesRequest,&listFilesResponse) == SOAP_OK); |
386 | + //res = (this->client->listFiles(&listFilesRequest,listFilesResponse) == SOAP_OK); | |
387 | + | |
388 | + | |
356 | 389 | LOG4CXX_INFO(this->app->getLog()->getPtr(),"found timefiles" << listFilesResponse.timeFile.size()); |
357 | 390 | if(res && listFilesResponse.timeFile.size()>0) { |
358 | 391 | return listFilesResponse.timeFile.at(0); |
... | ... | @@ -461,7 +494,12 @@ namespace TREPS |
461 | 494 | //run listNewFrameOrb to perform transformation (rotation + translation) |
462 | 495 | _ns3__listNewFrameOrbResponse listNewFrameOrbResponse; |
463 | 496 | |
464 | - res = (this->client->listNewFrameOrb(&listNewFrameOrbRequest,&listNewFrameOrbResponse) == SOAP_OK); | |
497 | + | |
498 | + //compilAndInstall.sh pb compilation ubuntu | |
499 | + // error: no matching function for call | |
500 | + res = (this->client->listNewFrameOrb(&listNewFrameOrbRequest,&listNewFrameOrbResponse) == SOAP_OK); | |
501 | + //res = (this->client->listNewFrameOrb(&listNewFrameOrbRequest,listNewFrameOrbResponse) == SOAP_OK); | |
502 | + | |
465 | 503 | |
466 | 504 | #ifndef WITH_GETORBURL |
467 | 505 | this->deleteTimeList(listNewFrameOrbRequest.pDateTimeInput); |
... | ... | @@ -497,7 +535,13 @@ namespace TREPS |
497 | 535 | //run listNewFrameAtt to perform transformation (rotation) |
498 | 536 | _ns3__listNewFrameAttResponse listNewFrameAttResponse; |
499 | 537 | |
538 | + | |
539 | + | |
540 | + //compilAndInstall.sh pb compilation ubuntu | |
541 | + // error: no matching function for call | |
500 | 542 | res = (this->client->listNewFrameAtt(&listNewFrameAttRequest,&listNewFrameAttResponse) == SOAP_OK); |
543 | + //res = (this->client->listNewFrameAtt(&listNewFrameAttRequest,listNewFrameAttResponse) == SOAP_OK); | |
544 | + | |
501 | 545 | |
502 | 546 | #ifndef WITH_GETORBURL |
503 | 547 | this->deleteTimeList(listNewFrameAttRequest.pDateTimeInput); |
... | ... | @@ -601,7 +645,9 @@ namespace TREPS |
601 | 645 | if (!crtResData.loadTimes(CDPP3DVIEW_TIME_ID,TF_PATTERN,CDPP3DVIEW_TIME_PATTERN)) |
602 | 646 | { |
603 | 647 | crtResData.clear(); |
648 | + | |
604 | 649 | this->errorMsg = "Cannot load times in result file"; |
650 | + | |
605 | 651 | LOG4CXX_ERROR(this->app->getLog()->getPtr(),this->errorMsg); |
606 | 652 | return false; |
607 | 653 | } | ... | ... |
server/kernel/src/Transformation/TransformationRequest.cpp
... | ... | @@ -118,6 +118,9 @@ namespace TREPS |
118 | 118 | //remove current vector to vectors string |
119 | 119 | vectors = vectors.substr(p+1,vectors.length()-p-1); |
120 | 120 | } |
121 | + | |
122 | + //ApplicationClass *app = ApplicationClass::getInstance(); | |
123 | + //LOG4CXX_INFO(app->getLog()->getPtr(),vector.c_str()); | |
121 | 124 | |
122 | 125 | //trim vector string |
123 | 126 | vector = getTRIMStr(vector.c_str()); |
... | ... | @@ -178,21 +181,41 @@ namespace TREPS |
178 | 181 | //get third component |
179 | 182 | //find ',' char |
180 | 183 | p = vector.find(","); |
184 | + if (p == string::npos) | |
185 | + { | |
186 | + finish = true; | |
187 | + continue; | |
188 | + } | |
189 | + | |
190 | + | |
191 | + //extract comp id | |
192 | + vec.fieldId[2] = vector.substr(0,p); | |
193 | + //remove first component to vector string | |
194 | + vector = vector.substr(p+1,vector.length()-p-1); | |
195 | + //trim comp id | |
196 | + vec.fieldId[2] = getTRIMStr(vec.fieldId[2].c_str()); | |
197 | + | |
198 | + p = vector.find(","); | |
181 | 199 | if (p != string::npos) |
182 | 200 | { |
183 | 201 | //get isPos value |
184 | - po = vector.substr(p+1,vector.length()-p-1); | |
202 | + po = vector.substr(0,p); | |
185 | 203 | po = getTRIMStr(po.c_str()); |
186 | 204 | vec.ispos = (po.compare("1") == 0); |
187 | - vector = vector.substr(0,p); | |
205 | + //vector = vector.substr(0,p); | |
206 | + //find scale | |
207 | + po = vector.substr(p+1,vector.length()-p-1); | |
208 | + vec.scale = atof(getTRIMStr(po.c_str()).c_str()); | |
188 | 209 | } |
189 | - else | |
210 | + else { | |
190 | 211 | vec.ispos = false; |
212 | + vec.scale = 1; | |
213 | + } | |
214 | + | |
191 | 215 | |
192 | - vec.fieldId[2] = getTRIMStr(vector.c_str()); | |
216 | + //vec.fieldId[2] = getTRIMStr(vector.c_str()); | |
193 | 217 | |
194 | 218 | vec.frame = srcFrame; |
195 | - | |
196 | 219 | vec.id = "v_"; |
197 | 220 | vec.id += intToStr(index); |
198 | 221 | |
... | ... | @@ -225,6 +248,11 @@ namespace TREPS |
225 | 248 | vecDef += crtVec.fieldId[2]; |
226 | 249 | if (crtVec.ispos) |
227 | 250 | vecDef += ",1"; |
251 | + else | |
252 | + vecDef += ",0"; | |
253 | + | |
254 | + vecDef += ","; | |
255 | + vecDef += doubleToStr(crtVec.scale); | |
228 | 256 | vecDef += ")"; |
229 | 257 | } |
230 | 258 | return vecDef; | ... | ... |
server/kernel/src/Transformation/TransformationRequest.h
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | #define TRANSFORMATIONREQUEST_H |
3 | 3 | |
4 | 4 | #include <string> |
5 | +#include <iostream> | |
5 | 6 | |
6 | 7 | #include "../Common/TREPSTypes.h" |
7 | 8 | #include "../DataRecord/DataRecordList.h" |
... | ... | @@ -39,6 +40,7 @@ namespace TREPS |
39 | 40 | //get transformation destination center |
40 | 41 | string getDstCenter(void) const; |
41 | 42 | |
43 | + | |
42 | 44 | //set times |
43 | 45 | void setTimes(const t_Time startTime, const t_Time stopTime); |
44 | 46 | ... | ... |
... | ... | @@ -0,0 +1,58 @@ |
1 | +#include "UnitManager.h" | |
2 | + | |
3 | +#include "../Common/Toolbox.h" | |
4 | + | |
5 | +using namespace TREPS::Common; | |
6 | + | |
7 | +namespace TREPS | |
8 | +{ | |
9 | + namespace UnitManager | |
10 | + { | |
11 | + UnitManagerClass::UnitManagerClass(void) : app(NULL), loader(NULL) | |
12 | + { | |
13 | + this->app = ApplicationClass::getInstance(); | |
14 | + } | |
15 | + | |
16 | + UnitManagerClass::~UnitManagerClass(void) | |
17 | + { | |
18 | + if (this->loader != NULL) | |
19 | + { | |
20 | + this->loader->close(); | |
21 | + delete this->loader; | |
22 | + this->loader = NULL; | |
23 | + } | |
24 | + } | |
25 | + | |
26 | + bool UnitManagerClass::init(const char *file_path) | |
27 | + { | |
28 | + //create xml loader | |
29 | + if (this->loader == NULL) | |
30 | + this->loader = new XMLManagerClass(); | |
31 | + | |
32 | + this->loader->close(); | |
33 | + | |
34 | + if (!this->loader->isExist(file_path)) | |
35 | + { | |
36 | + LOG4CXX_INFO(this->app->getLog()->getPtr(),"Cannot find units file : " << file_path); | |
37 | + return false; | |
38 | + } | |
39 | + | |
40 | + //load file | |
41 | + if (!this->loader->loadFile(file_path)) | |
42 | + { | |
43 | + LOG4CXX_INFO(this->app->getLog()->getPtr(),"Cannot load units file : " << file_path); | |
44 | + return false; | |
45 | + } | |
46 | + | |
47 | + //xsd validation | |
48 | + if (!this->loader->isValid(TREPS_UNITS_XSD)) | |
49 | + { | |
50 | + LOG4CXX_INFO(this->app->getLog()->getPtr(),"Invalid units file : " << file_path); | |
51 | + return false; | |
52 | + } | |
53 | + | |
54 | + return true; | |
55 | + } | |
56 | + | |
57 | + } | |
58 | +} | ... | ... |
... | ... | @@ -0,0 +1,36 @@ |
1 | +#ifndef UNITMANAGER_H | |
2 | +#define UNITMANAGER_H | |
3 | + | |
4 | +#include "../Common/Singleton.h" | |
5 | +#include "../Application/Application.h" | |
6 | +#include "../XMLManager/XMLManager.h" | |
7 | + | |
8 | +#define TREPS_UNITS_XSD "units.xsd" | |
9 | + | |
10 | +using namespace TREPS::Application; | |
11 | +using namespace TREPS::XMLManager; | |
12 | + | |
13 | +namespace TREPS | |
14 | +{ | |
15 | + namespace UnitManager | |
16 | + { | |
17 | + class UnitManagerClass | |
18 | + { | |
19 | + public: | |
20 | + UnitManagerClass(void); | |
21 | + | |
22 | + ~UnitManagerClass(void); | |
23 | + | |
24 | + //load units list file, + xsd validation | |
25 | + bool init(const char *file_path); | |
26 | + | |
27 | + | |
28 | + private: | |
29 | + ApplicationClass *app; | |
30 | + | |
31 | + XMLManagerClass *loader; | |
32 | + }; | |
33 | + } | |
34 | +} | |
35 | + | |
36 | +#endif | ... | ... |
... | ... | @@ -0,0 +1,24 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> | |
3 | + <xs:element name="treps"> | |
4 | + <xs:complexType> | |
5 | + <xs:sequence> | |
6 | + <xs:element name="units"> | |
7 | + <xs:complexType> | |
8 | + <xs:sequence> | |
9 | + <xs:element name="unit" maxOccurs="unbounded" minOccurs="1"> | |
10 | + <xs:complexType> | |
11 | + <xs:sequence> | |
12 | + <xs:element type="xs:string" name="fullname"/> | |
13 | + <xs:element type="xs:float" name="kmvalue"/> | |
14 | + </xs:sequence> | |
15 | + <xs:attribute type="xs:string" name="id" use="required"/> | |
16 | + </xs:complexType> | |
17 | + </xs:element> | |
18 | + </xs:sequence> | |
19 | + </xs:complexType> | |
20 | + </xs:element> | |
21 | + </xs:sequence> | |
22 | + </xs:complexType> | |
23 | + </xs:element> | |
24 | +</xs:schema> | ... | ... |
server/php/direct/classes/TREPSAction.php
1 | -<?php | |
2 | - require_once("../Constants.php"); | |
3 | - | |
4 | - require_once(TREPS_PHP_DIR."RequestManager.php"); | |
5 | - | |
6 | - class TREPSAction { | |
7 | - function startNewOperation($arg) | |
8 | - { | |
9 | - $datatype = $arg->type; | |
10 | - $reqMgr = new RequestManager(); | |
11 | - if ($datatype == 'local') | |
12 | - $location = TREPS_PHP_TMP_DIR.$arg->data; | |
13 | - else if ($datatype == 'url') | |
14 | - $location = $arg->data; | |
15 | - else if ($datatype == 'data') | |
16 | - { | |
17 | - $file_name = time(NULL)."_".$reqMgr->generateRandomString(); | |
18 | - $pos = strpos($arg->data,"base64,"); | |
19 | - if ($pos === false) | |
20 | - $file = $arg->data; | |
21 | - else | |
22 | - { | |
23 | - $file = substr($arg->data,$pos+7); | |
24 | - $file = base64_decode($file); | |
25 | - } | |
26 | - $location = TREPS_PHP_TMP_DIR.$file_name; | |
27 | - file_put_contents($location, $file); | |
28 | - $datatype = 'local'; | |
29 | - } | |
30 | - | |
31 | - $res = $reqMgr->run('new_op',array('type' => $datatype, 'location' => $location),OutputTypeEnum::OUTPUT_RESULTFILE); | |
32 | - | |
33 | - if ($datatype == 'local') | |
34 | - if (file_exists($location)) | |
35 | - unlink($location); | |
36 | - | |
37 | - return $res; | |
38 | - } | |
39 | - | |
40 | - function resetOperation($arg) | |
41 | - { | |
42 | - $reqMgr = new RequestManager(); | |
43 | - $res = $reqMgr->run('reset_op',array('id' => $arg->id),OutputTypeEnum::OUTPUT_NONE); | |
44 | - return $res; | |
45 | - } | |
46 | - | |
47 | - function getStatusOperation($arg) | |
48 | - { | |
49 | - $reqMgr = new RequestManager(); | |
50 | - $res = $reqMgr->run('status_get',array('id' => $arg->id),OutputTypeEnum::OUTPUT_STRING); | |
51 | - return $res; | |
52 | - } | |
53 | - | |
54 | - function runOperation($arg) | |
55 | - { | |
56 | - $reqMgr = new RequestManager(); | |
57 | - $res = $reqMgr->run('run_op',array('id' => $arg->id, 'srcframe' => $arg->srcframe,'srccenter' => $arg->srccenter, 'dstframe' => $arg->dstframe, 'dstcenter' => $arg->dstcenter, 'starttime' => $arg->starttime, 'stoptime' => $arg->stoptime, 'vectors' => $arg->vectors, 'timefieldid' => $arg->timefieldid, 'timeformatid' => $arg->timeformatid, 'timepattern' => $arg->timepattern), OutputTypeEnum::OUTPUT_RESULTFILE); | |
58 | - return $res; | |
59 | - } | |
60 | - | |
61 | - function exportOperation($arg) | |
62 | - { | |
63 | - $reqMgr = new RequestManager(); | |
64 | - $res = $reqMgr->run('export_op',array('id' => $arg->id, 'format' => $arg->format, 'structure' => $arg->structure, 'timeformat' => $arg->timeformat, 'timepattern' => $arg->timepattern), OutputTypeEnum::OUTPUT_RESULTFILE); | |
65 | - return $res; | |
66 | - } | |
67 | - | |
68 | - function getSourceInfo($arg) | |
69 | - { | |
70 | - $reqMgr = new RequestManager(); | |
71 | - $res = $reqMgr->run('source_info',array('id' => $arg->id),OutputTypeEnum::OUTPUT_RESULTFILE); | |
72 | - return $res; | |
73 | - } | |
74 | - | |
75 | - function getSourceData($arg) | |
76 | - { | |
77 | - $reqMgr = new RequestManager(); | |
78 | - $res = $reqMgr->run('source_get',array('id' => $arg->id, 'start' => $arg->start, 'limit' => $arg->limit),OutputTypeEnum::OUTPUT_RESULTFILE); | |
79 | - return $res; | |
80 | - } | |
81 | - | |
82 | - function getResultInfo($arg) | |
83 | - { | |
84 | - $reqMgr = new RequestManager(); | |
85 | - $res = $reqMgr->run('result_info',array('id' => $arg->id),OutputTypeEnum::OUTPUT_RESULTFILE); | |
86 | - return $res; | |
87 | - } | |
88 | - | |
89 | - function getResultData($arg) | |
90 | - { | |
91 | - $reqMgr = new RequestManager(); | |
92 | - $res = $reqMgr->run('result_get',array('id' => $arg->id, 'start' => $arg->start, 'limit' => $arg->limit),OutputTypeEnum::OUTPUT_RESULTFILE); | |
93 | - return $res; | |
94 | - } | |
95 | - | |
96 | - function getRunInfo($arg) | |
97 | - { | |
98 | - $reqMgr = new RequestManager(); | |
99 | - $res = $reqMgr->run('run_info',array('id' => $arg->id),OutputTypeEnum::OUTPUT_RESULTFILE); | |
100 | - return $res; | |
101 | - } | |
102 | - | |
103 | - function getBodiesList($arg) | |
104 | - { | |
105 | - $reqMgr = new RequestManager(); | |
106 | - $res = $reqMgr->run('bodies_get',array('id' => $arg->id, 'issc' => $arg->issc, 'starttime' => $arg->starttime, 'stoptime' => $arg->stoptime),OutputTypeEnum::OUTPUT_XMLFILE); | |
107 | - return $res; | |
108 | - } | |
109 | - | |
110 | - function getFramesList() | |
111 | - { | |
112 | - $reqMgr = new RequestManager(); | |
113 | - $res = $reqMgr->run('frames_get',array(),OutputTypeEnum::OUTPUT_XMLFILE); | |
114 | - return $res; | |
115 | - } | |
116 | - | |
117 | - function getTimesList() | |
118 | - { | |
119 | - $reqMgr = new RequestManager(); | |
120 | - $res = $reqMgr->run('times_get',array(),OutputTypeEnum::OUTPUT_XMLFILE); | |
121 | - return $res; | |
122 | - } | |
123 | - | |
124 | - function getExportsList() | |
125 | - { | |
126 | - $reqMgr = new RequestManager(); | |
127 | - $res = $reqMgr->run('exports_get',array(),OutputTypeEnum::OUTPUT_XMLFILE); | |
128 | - return $res; | |
129 | - } | |
130 | - | |
131 | - function getFormatsList() | |
132 | - { | |
133 | - $reqMgr = new RequestManager(); | |
134 | - $res = $reqMgr->run('formats_get',array(),OutputTypeEnum::OUTPUT_XMLFILE); | |
135 | - return $res; | |
136 | - } | |
137 | - | |
138 | - function getStatus($arg) | |
139 | - { | |
140 | - $reqMgr = new RequestManager(); | |
141 | - $res = $reqMgr->run('status_get',array('id' => $arg->id),OutputTypeEnum::OUTPUT_STRING); | |
142 | - return $res; | |
143 | - } | |
144 | - | |
145 | - function getKernelVersion() | |
146 | - { | |
147 | - $reqMgr = new RequestManager(); | |
148 | - $res = $reqMgr->run('version_get',array(),OutputTypeEnum::OUTPUT_STRING); | |
149 | - return $res; | |
150 | - } | |
151 | - } | |
152 | -?> | |
1 | +<?php | |
2 | + require_once("../Constants.php"); | |
3 | + | |
4 | + require_once(TREPS_PHP_DIR."RequestManager.php"); | |
5 | + | |
6 | + class TREPSAction { | |
7 | + function startNewOperation($arg) | |
8 | + { | |
9 | + $datatype = $arg->type; | |
10 | + $reqMgr = new RequestManager(); | |
11 | + if ($datatype == 'local') | |
12 | + $location = TREPS_PHP_TMP_DIR.$arg->data; | |
13 | + else if ($datatype == 'url') | |
14 | + $location = $arg->data; | |
15 | + else if ($datatype == 'data') | |
16 | + { // bug error execution : remove paramter NULL | |
17 | + $file_name = time()."_".$reqMgr->generateRandomString(); | |
18 | + $pos = strpos($arg->data,"base64,"); | |
19 | + if ($pos === false) | |
20 | + $file = $arg->data; | |
21 | + else | |
22 | + { | |
23 | + $file = substr($arg->data,$pos+7); | |
24 | + $file = base64_decode($file); | |
25 | + } | |
26 | + $location = TREPS_PHP_TMP_DIR.$file_name; | |
27 | + file_put_contents($location, $file); | |
28 | + $datatype = 'local'; | |
29 | + } | |
30 | + | |
31 | + $res = $reqMgr->run('new_op',array('type' => $datatype, 'location' => $location),OutputTypeEnum::OUTPUT_RESULTFILE); | |
32 | + | |
33 | + if ($datatype == 'local') | |
34 | + if (file_exists($location)) | |
35 | + unlink($location); | |
36 | + | |
37 | + return $res; | |
38 | + } | |
39 | + | |
40 | + function resetOperation($arg) | |
41 | + { | |
42 | + $reqMgr = new RequestManager(); | |
43 | + $res = $reqMgr->run('reset_op',array('id' => $arg->id),OutputTypeEnum::OUTPUT_NONE); | |
44 | + return $res; | |
45 | + } | |
46 | + | |
47 | + function getStatusOperation($arg) | |
48 | + { | |
49 | + $reqMgr = new RequestManager(); | |
50 | + $res = $reqMgr->run('status_get',array('id' => $arg->id),OutputTypeEnum::OUTPUT_STRING); | |
51 | + return $res; | |
52 | + } | |
53 | + | |
54 | + function runOperation($arg) | |
55 | + { | |
56 | + $reqMgr = new RequestManager(); | |
57 | + $res = $reqMgr->run('run_op',array('id' => $arg->id, 'srcframe' => $arg->srcframe,'srccenter' => $arg->srccenter, 'dstframe' => $arg->dstframe, 'dstcenter' => $arg->dstcenter, 'starttime' => $arg->starttime, 'stoptime' => $arg->stoptime, 'vectors' => $arg->vectors, 'timefieldid' => $arg->timefieldid, 'timeformatid' => $arg->timeformatid, 'timepattern' => $arg->timepattern), OutputTypeEnum::OUTPUT_RESULTFILE); | |
58 | + return $res; | |
59 | + } | |
60 | + | |
61 | + function exportOperation($arg) | |
62 | + { | |
63 | + $reqMgr = new RequestManager(); | |
64 | + $res = $reqMgr->run('export_op',array('id' => $arg->id, 'format' => $arg->format, 'structure' => $arg->structure, 'timeformat' => $arg->timeformat, 'timepattern' => $arg->timepattern), OutputTypeEnum::OUTPUT_RESULTFILE); | |
65 | + return $res; | |
66 | + } | |
67 | + | |
68 | + function getSourceInfo($arg) | |
69 | + { | |
70 | + $reqMgr = new RequestManager(); | |
71 | + $res = $reqMgr->run('source_info',array('id' => $arg->id),OutputTypeEnum::OUTPUT_RESULTFILE); | |
72 | + return $res; | |
73 | + } | |
74 | + | |
75 | + function getSourceData($arg) | |
76 | + { | |
77 | + $reqMgr = new RequestManager(); | |
78 | + $res = $reqMgr->run('source_get',array('id' => $arg->id, 'start' => $arg->start, 'limit' => $arg->limit),OutputTypeEnum::OUTPUT_RESULTFILE); | |
79 | + return $res; | |
80 | + } | |
81 | + | |
82 | + function getResultInfo($arg) | |
83 | + { | |
84 | + $reqMgr = new RequestManager(); | |
85 | + $res = $reqMgr->run('result_info',array('id' => $arg->id),OutputTypeEnum::OUTPUT_RESULTFILE); | |
86 | + return $res; | |
87 | + } | |
88 | + | |
89 | + function getResultData($arg) | |
90 | + { | |
91 | + $reqMgr = new RequestManager(); | |
92 | + $res = $reqMgr->run('result_get',array('id' => $arg->id, 'start' => $arg->start, 'limit' => $arg->limit),OutputTypeEnum::OUTPUT_RESULTFILE); | |
93 | + return $res; | |
94 | + } | |
95 | + | |
96 | + function getRunInfo($arg) | |
97 | + { | |
98 | + $reqMgr = new RequestManager(); | |
99 | + $res = $reqMgr->run('run_info',array('id' => $arg->id),OutputTypeEnum::OUTPUT_RESULTFILE); | |
100 | + return $res; | |
101 | + } | |
102 | + | |
103 | + function getBodiesList($arg) | |
104 | + { | |
105 | + $reqMgr = new RequestManager(); | |
106 | + $res = $reqMgr->run('bodies_get',array('id' => $arg->id, 'issc' => $arg->issc, 'starttime' => $arg->starttime, 'stoptime' => $arg->stoptime),OutputTypeEnum::OUTPUT_XMLFILE); | |
107 | + return $res; | |
108 | + } | |
109 | + | |
110 | + function getFramesList() | |
111 | + { | |
112 | + $reqMgr = new RequestManager(); | |
113 | + $res = $reqMgr->run('frames_get',array(),OutputTypeEnum::OUTPUT_XMLFILE); | |
114 | + return $res; | |
115 | + } | |
116 | + | |
117 | + function getTimesList() | |
118 | + { | |
119 | + $reqMgr = new RequestManager(); | |
120 | + $res = $reqMgr->run('times_get',array(),OutputTypeEnum::OUTPUT_XMLFILE); | |
121 | + return $res; | |
122 | + } | |
123 | + | |
124 | + function getUnitsList() | |
125 | + { | |
126 | + $reqMgr = new RequestManager(); | |
127 | + $res = $reqMgr->run('units_get',array(),OutputTypeEnum::OUTPUT_XMLFILE); | |
128 | + return $res; | |
129 | + } | |
130 | + | |
131 | + | |
132 | + function getExportsList() | |
133 | + { | |
134 | + $reqMgr = new RequestManager(); | |
135 | + $res = $reqMgr->run('exports_get',array(),OutputTypeEnum::OUTPUT_XMLFILE); | |
136 | + return $res; | |
137 | + } | |
138 | + | |
139 | + function getFormatsList() | |
140 | + { | |
141 | + $reqMgr = new RequestManager(); | |
142 | + $res = $reqMgr->run('formats_get',array(),OutputTypeEnum::OUTPUT_XMLFILE); | |
143 | + return $res; | |
144 | + } | |
145 | + | |
146 | + function getStatus($arg) | |
147 | + { | |
148 | + $reqMgr = new RequestManager(); | |
149 | + $res = $reqMgr->run('status_get',array('id' => $arg->id),OutputTypeEnum::OUTPUT_STRING); | |
150 | + return $res; | |
151 | + } | |
152 | + | |
153 | + function getKernelVersion() | |
154 | + { | |
155 | + $reqMgr = new RequestManager(); | |
156 | + $res = $reqMgr->run('version_get',array(),OutputTypeEnum::OUTPUT_STRING); | |
157 | + return $res; | |
158 | + } | |
159 | + } | |
160 | +?> | ... | ... |