Commit 9524040ee4a0c610f18268f428b5cd15dc6ee30a

Authored by Laurent BEIGBEDER
1 parent 557cd0cc
Exists in master

6926: Prise en compte des formats RTN et RTP

Showing 32 changed files with 1762 additions and 46 deletions   Show diff stats
ihm/app/controller/Bodies/BodiesManager.js 0 → 100644
... ... @@ -0,0 +1,39 @@
  1 +Ext.define('treps.controller.Bodies.BodiesManager', {
  2 + singleton : true,
  3 +
  4 + constructor: function() {
  5 + },
  6 +
  7 + loadBodiesStore: function(id, isSc, start, stop, onAfterLoad) {
  8 + var me = this;
  9 +
  10 + //var store = Ext.getStore('Bodies');
  11 + //if (store == null)
  12 +
  13 + var store = Ext.create('treps.store.Bodies');
  14 + //else store.removeAll();
  15 +
  16 + var args = {
  17 + 'id' : id,
  18 + 'issc' : isSc,
  19 + 'starttime' : start,
  20 + 'stoptime' : stop
  21 + };
  22 + store.getProxy().extraParams = args;
  23 + store.load(
  24 + {
  25 + scope: me,
  26 + callback: function(records, operation, success)
  27 + {
  28 + if (!success)
  29 + {
  30 + treps.Messages.showError("Cannot get bodies list");
  31 + return;
  32 + }
  33 + console.log("BodiesManager: store loaded! "+store.count(false));
  34 + if (onAfterLoad != null)
  35 + onAfterLoad.call(me,store);
  36 + }
  37 + });
  38 + }
  39 +});
... ...
ihm/app/controller/Bodies/BodySelection.js 0 → 100644
... ... @@ -0,0 +1,93 @@
  1 +Ext.define('treps.controller.Bodies.BodySelection', {
  2 + extend: 'Ext.app.Controller',
  3 +
  4 + requires: [
  5 + 'treps.controller.Bodies.BodiesManager'
  6 + ],
  7 +
  8 + views: [
  9 + 'Steps.TransformationDefinition.BodySelectionPanel',
  10 + 'treps.view.Bodies.BodiesCombo'
  11 + ],
  12 +
  13 + refs: [
  14 + {
  15 + ref: 'bodiesCenterCombo',
  16 + selector: '#centercombo'
  17 + },
  18 + {
  19 + ref: 'bodiesScCombo',
  20 + selector: '#sccombo'
  21 + }
  22 + ],
  23 +
  24 + init: function() {
  25 + var me = this;
  26 +
  27 + //console.log('BodySelection init '+this.getView('Steps.TransformationDefinition.BodySelectionPanel'));
  28 +
  29 + },
  30 +
  31 + initStore: function(start,stop,onReady)
  32 + {
  33 + var me = this;
  34 + this.getView('Steps.TransformationDefinition.BodySelectionPanel').create();
  35 + console.log("bodies centr combo: "+me.getBodiesCenterCombo());
  36 + console.log("bodies sc combo: "+me.getBodiesScCombo());
  37 + //if(isSc) {
  38 + treps.controller.Bodies.BodiesManager.loadBodiesStore(treps.model.Session.get('id'),'true',start, stop,
  39 + function(store) {
  40 + //console.log(me);
  41 + me.getBodiesScCombo().store = store;
  42 + if (onReady != null) {
  43 + treps.controller.Bodies.BodiesManager.loadBodiesStore(treps.model.Session.get('id'),'false',start, stop,
  44 + function(store) {
  45 + //console.log(me);
  46 + me.getBodiesCenterCombo().store = store;
  47 + if (onReady != null) {
  48 + onReady.call(me, store);
  49 + }
  50 + }
  51 + );
  52 + }
  53 + }
  54 + );
  55 + //} else {
  56 +//}
  57 + },
  58 +
  59 + getBodySelWin: function(pTitle) {
  60 + var me = this;
  61 + console.log(this.getView('Steps.TransformationDefinition.BodySelectionPanel'));
  62 + return Ext.create('Ext.window.Window', {
  63 + title: pTitle,
  64 + layout: 'fit',
  65 + modal: true,
  66 + maximizable: false,
  67 + collapsible:false,
  68 + floating:true,
  69 + closable:false,
  70 + centered:true,
  71 + //items:[{xtype:'bodies_panel'}]
  72 + });
  73 + },
  74 +
  75 + //get 'id name' string of selected sc
  76 + getScBody: function() {
  77 + return this.getBodiesScCombo().getValue()+' '+this.getBodiesScCombo().getRawValue();
  78 + },
  79 +
  80 + setScBody: function(body) {
  81 + this.getBodiesScCombo().setValue(body);
  82 + },
  83 +
  84 + //get 'id name' string of selected natural body
  85 + getCenterBody: function() {
  86 + return this.getBodiesCenterCombo().getValue()+' '+this.getBodiesCenterCombo().getRawValue();
  87 + },
  88 +
  89 + setCenterBody: function(body) {
  90 + this.getBodiesCenterCombo().setValue(body);
  91 + }
  92 +
  93 +});
... ...
ihm/app/controller/Frames/FramesSelection.js
... ... @@ -2,7 +2,9 @@ Ext.define('treps.controller.Frames.FramesSelection', {
2 2 extend: 'Ext.app.Controller',
3 3  
4 4 requires: [
5   - 'treps.controller.Frames.FramesManager'
  5 + 'treps.controller.Frames.FramesManager',
  6 + 'treps.controller.Bodies.BodySelection',
  7 + 'treps.controller.Data.Store.DataStoreManager'
6 8 ],
7 9  
8 10 views: [
... ... @@ -10,19 +12,62 @@ Ext.define('treps.controller.Frames.FramesSelection', {
10 12 ],
11 13  
12 14 refs: [
13   - {
14   - ref: 'sourceCombo',
15   - selector: '#srcSysFrame'
16   - },
  15 + {
  16 + ref: 'sourceCombo',
  17 + selector: '#srcSysFrame'
  18 + },
17 19 {
18 20 ref: 'destCombo',
19 21 selector: '#destSysFrame'
20 22 }
21 23 ],
  24 +
  25 + srcCenter : '',
  26 + dstCenter : '',
22 27  
23   - init: function() {
24   - var me = this;
25   - },
  28 + init: function() {
  29 + var me = this;
  30 + //timeDefController.init();
  31 +
  32 + this.control({
  33 + '#srcSysFrame': {
  34 + select: me.onSrcFrameSelect,
  35 + scope: me
  36 + }
  37 + });
  38 + this.control({
  39 + '#destSysFrame': {
  40 + select: me.onDstFrameSelect,
  41 + scope: me
  42 + }
  43 + });
  44 +
  45 + },
  46 +
  47 + onSrcFrameSelect: function() {
  48 + var me = this;
  49 + var timeDefController = treps.app.getController('Times.SourceTimeSelection');
  50 + if((me.getSrcFrame()=='RTN') || (me.getSrcFrame()=='RTP')) {
  51 + if(timeDefController.getTimeFormat() == "") {//check time is defined
  52 + treps.Messages.showWarning("You must select a time field to use RTN/RTP coordinate system.");
  53 + me.getSourceCombo().setValue(null);
  54 + } else {
  55 + me.selectRTBodies('Select bodies for '+me.getSrcFrame(),me.getSourceCombo());
  56 + }
  57 + }
  58 + },
  59 + onDstFrameSelect: function() {
  60 + var me = this;
  61 + var timeDefController = treps.app.getController('Times.SourceTimeSelection');
  62 + if((me.getDstFrame()=='RTN') || (me.getDstFrame()=='RTP')) {
  63 + if(timeDefController.getTimeFormat() == "") {//check time is defined
  64 + treps.Messages.showWarning("You must select a time field to use RTN/RTP coordinate system.");
  65 + me.getDestCombo().setValue(null);
  66 + } else {
  67 + me.selectRTBodies('Select bodies for '+me.getDstFrame(),me.getDestCombo());
  68 + }
  69 + }
  70 + },
26 71  
27 72 initStore: function(onReady)
28 73 {
... ... @@ -37,6 +82,66 @@ Ext.define('treps.controller.Frames.FramesSelection', {
37 82 onReady.call(me, store);
38 83 });
39 84 },
  85 +
  86 +
  87 + //show RTN/RTP bodies selection and returns center formated string as follow:
  88 + // centerid centername scid scname
  89 +
  90 + ctrlAdded: false,
  91 + currentCombo: undefined,
  92 + currentBodyWin: undefined,
  93 +
  94 + selectRTBodies: function(pTitle,frameCombo) {
  95 + var me = this;
  96 + //var bodySelCtrl = treps.app.getController('treps.controller.Bodies.BodySelection');
  97 + var bodySelCtrl = Ext.create('treps.controller.Bodies.BodySelection');
  98 + treps.controller.Data.Store.DataStoreManager.getStore('SourceDataStore');
  99 + var bodySelWin = bodySelCtrl.getBodySelWin(pTitle);
  100 + this.currentCombo=frameCombo;
  101 + this.currentBodyWin = bodySelWin;
  102 + if(!this.ctrlAdded) {
  103 + this.control({
  104 + 'bodies_panel > #okbtn': {
  105 + click: function() {
  106 + var center = bodySelCtrl.getCenterBody()+' '+bodySelCtrl.getScBody();
  107 + if(this.currentCombo==me.getSourceCombo()) {
  108 + me.srcCenter = center;
  109 + console.log("set src center "+me.srcCenter+" dst="+me.dstCenter);
  110 + }
  111 + if(this.currentCombo==me.getDestCombo()) {
  112 + me.dstCenter = center;
  113 + console.log("set dst center "+me.dstCenter+" src="+me.srcCenter);
  114 + }
  115 + me.currentBodyWin.close();
  116 + },
  117 + scope: me
  118 + }
  119 + });
  120 + this.ctrlAdded = true;
  121 + }
  122 + var srcStore = treps.controller.Data.Store.DataStoreManager.getStore('SourceDataStore');
  123 + var gridController = treps.app.getController('Data.Grid.SourceDataGrid');
  124 + var timeCol = gridController.getFirstColumnDataIndex(gridController.getSourceGrid());
  125 + bodySelCtrl.initStore(srcStore.getAt(0).get(timeCol), srcStore.getAt(srcStore.totalCount-1).get(timeCol),
  126 + function(lBodies){
  127 + console.log("combo Sc found? "+bodySelCtrl.getBodiesScCombo().store.count(false));
  128 + console.log("combo Center found? "+bodySelCtrl.getBodiesCenterCombo().store.count(false));
  129 + //for RTN, select default sun value
  130 + if(frameCombo.getValue()=='RTN') bodySelCtrl.getBodiesCenterCombo().setValue('10');
  131 + bodySelWin.add(bodySelCtrl.getBodiesScCombo().ownerCt);
  132 + bodySelWin.doLayout();
  133 + bodySelWin.show();
  134 + }
  135 + );
  136 +
  137 + },
  138 +
  139 + getSrcCenter: function() {
  140 + return this.srcCenter;
  141 + },
  142 + getDstCenter: function() {
  143 + return this.dstCenter;
  144 + },
40 145  
41 146 getSrcFrame: function() {
42 147 return this.getSourceCombo().getValue();
... ... @@ -69,6 +174,7 @@ Ext.define('treps.controller.Frames.FramesSelection', {
69 174 treps.Messages.showError('Please select a destination frame');
70 175 return false;
71 176 }
  177 +
72 178  
73 179 return true;
74 180 }
... ...
ihm/app/controller/Steps/TransformationDefinitionStep.js
... ... @@ -51,6 +51,10 @@ Ext.define('treps.controller.Steps.TransformationDefinitionStep', {
51 51 scope: me
52 52 }
53 53 );
  54 +
  55 +
  56 +
  57 +
54 58  
55 59 },
56 60  
... ... @@ -95,8 +99,8 @@ Ext.define('treps.controller.Steps.TransformationDefinitionStep', {
95 99  
96 100 onAfterLoad: function(store, records, successful, eOpts)
97 101 {
  102 + var me = this;
98 103 var gridController = treps.app.getController('Data.Grid.SourceDataGrid');
99   -
100 104 gridController.setTotalInHeader(store.totalCount);
101 105 },
102 106  
... ... @@ -197,35 +201,55 @@ Ext.define('treps.controller.Steps.TransformationDefinitionStep', {
197 201 var vecDefController = treps.app.getController('Vectors.VecDefGrid');
198 202 var timeDefController = treps.app.getController('Times.SourceTimeSelection');
199 203 timeDefController.init();
  204 +
  205 + var srcStore = treps.controller.Data.Store.DataStoreManager.getStore('SourceDataStore');
  206 + var timeCol = gridController.getFirstColumnDataIndex(gridController.getSourceGrid());
200 207  
201 208 var dataGrid = gridController.getSourceGrid();
202 209  
203   - var args = {
204   - 'id' : treps.model.Session.get('id'),
205   - 'srcframe' : framesDefController.getSrcFrame(),
206   - 'dstframe' : framesDefController.getDstFrame(),
207   - 'vectors' : vecDefController.getVectorsStr(),
208   - 'timeformatid' : timeDefController.getTimeFormat(),
209   - 'timepattern' : timeDefController.getTimePattern(),
210   - 'timefieldid' : gridController.getFirstColumnDataIndex(dataGrid)
211   - };
  210 +
  211 +
  212 +
  213 + var srcFrame = framesDefController.getSrcFrame();
  214 + var dstFrame = framesDefController.getDstFrame()
  215 + var srcCenter = framesDefController.getSrcCenter();
  216 + var dstCenter = framesDefController.getDstCenter();
  217 +
  218 + console.log('found srccenter: '+srcCenter+' / '+dstCenter);
212 219  
213 220 var infoMsg = [];
214 221  
215   - if ((args.srcframe == null) && (args.dstframe == null))
  222 + if ((srcFrame == null) && (dstFrame == null))
216 223 infoMsg.push("No frames selected.");
217 224 else
218 225 {
219   - if (args.srcframe == args.dstframe)
  226 + if (srcFrame == dstFrame)
220 227 infoMsg.push("Source and destination frames are identical.");
221 228  
222   - if ((args.srcframe != args.dstframe) && (args.timeformatid == ""))
  229 + if ((srcFrame != dstFrame) && (timeDefController.getTimeFormat() == ""))
223 230 infoMsg.push("No time field selected. You must be sure that selected transformation don't need to use the time. If time needed, it will be set to 01/01/1970.");
224 231  
225   - if (args.vectors == "")
  232 + if (vecDefController.getVectorsStr() == "")
226 233 infoMsg.push("No vector defined. The full source data will be used during the next step.");
227 234 }
228 235  
  236 +
  237 + var args = {
  238 + 'id' : treps.model.Session.get('id'),
  239 + 'srcframe' : srcFrame,
  240 + 'srccenter' : srcCenter,
  241 + 'dstframe' : dstFrame,
  242 + 'dstcenter' : dstCenter,
  243 + 'starttime' : srcStore.getAt(0).get(timeCol),
  244 + 'stoptime' : srcStore.getAt(srcStore.totalCount-1).get(timeCol),
  245 + 'vectors' : vecDefController.getVectorsStr(),
  246 + 'timeformatid' : timeDefController.getTimeFormat(),
  247 + 'timepattern' : timeDefController.getTimePattern(),
  248 + 'timefieldid' : gridController.getFirstColumnDataIndex(dataGrid)
  249 + };
  250 +
  251 +
  252 +
229 253 if (infoMsg.length == 0)
230 254 this.callRequest(args,afterrequest);
231 255 else
... ... @@ -243,10 +267,12 @@ Ext.define('treps.controller.Steps.TransformationDefinitionStep', {
243 267 me.callRequest(args,afterrequest);
244 268 }
245 269 );
246   - }var session = treps.model.Session;
  270 + }
  271 + var session = treps.model.Session;
247 272  
248 273 },
249 274  
  275 +
250 276 doInitStep: function() {
251 277 var me = this;
252 278 var session = treps.model.Session;
... ...
ihm/app/model/Body.js 0 → 100644
... ... @@ -0,0 +1,18 @@
  1 +Ext.define('treps.model.Body', {
  2 + extend: 'Ext.data.Model',
  3 +
  4 + fields: [
  5 + {
  6 + name: 'id', type: 'string'
  7 + },
  8 + {
  9 + name: 'fullname', type: 'string'
  10 + },
  11 + {
  12 + name: 'startTime', type: 'date', dateFormat: 'c'
  13 + },
  14 + {
  15 + name: 'endTime', type: 'date', dateFormat: 'c'
  16 + }
  17 + ]
  18 +});
... ...
ihm/app/store/Bodies.js 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +Ext.define('treps.store.Bodies', {
  2 + extend: 'Ext.data.Store',
  3 +
  4 + model: 'treps.model.Body',
  5 +
  6 + sorters: [{
  7 + property: 'fullname',
  8 + direction: 'ASC'
  9 + }],
  10 +
  11 + sortOnLoad: true,
  12 + remoteSort: false,
  13 +
  14 + proxy: {
  15 + type: 'direct',
  16 + reader : {
  17 + type : 'json',
  18 + root : 'bodies'
  19 + },
  20 + api: {
  21 + read : "TREPSAction.getBodiesList"
  22 + }
  23 + }
  24 +
  25 +});
... ...
ihm/app/view/Bodies/BodiesCombo.js 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +Ext.define('treps.view.Bodies.BodiesCombo', {
  2 + extend: 'Ext.form.field.ComboBox',
  3 + alias: 'widget.bodies_combo',
  4 +
  5 + editable:false,
  6 +
  7 + valueField: 'id',
  8 +
  9 + queryMode: 'local',
  10 +
  11 + emptyText: 'Choose a body',
  12 +
  13 + tpl: Ext.create('Ext.XTemplate',
  14 + '<tpl for=".">',
  15 + '<div class="x-boundlist-item">{fullname}</div>',
  16 + '</tpl>'
  17 + ),
  18 +
  19 + displayTpl: Ext.create('Ext.XTemplate',
  20 + '<tpl for=".">',
  21 + '<tpl if="id">',
  22 + '{fullname}',
  23 + '<tpl else>',
  24 + '',
  25 + '</tpl>',
  26 + '</tpl>'
  27 + )
  28 +});
... ...
ihm/app/view/Steps/TransformationDefinition/BodySelectionPanel.js 0 → 100644
... ... @@ -0,0 +1,53 @@
  1 +Ext.define('treps.view.Steps.TransformationDefinition.BodySelectionPanel' ,{
  2 + extend: 'Ext.form.Panel',
  3 +
  4 + alias: 'widget.bodies_panel',
  5 +
  6 + requires: [
  7 + 'treps.view.Bodies.BodiesCombo'
  8 + ],
  9 +
  10 + initComponent: function() {
  11 + this.callParent(arguments);
  12 + },
  13 +
  14 + /*tools: [
  15 + {
  16 + type: 'help',
  17 + pageId: 'bodies'
  18 + }
  19 + ],
  20 + */
  21 + //title: 'Body selection',
  22 +
  23 + layout: {
  24 + type: 'vbox',
  25 + align: 'center',
  26 + padding: 5,
  27 + margin: 5
  28 + },
  29 +
  30 + items: [
  31 + {
  32 + xtype: 'bodies_combo',
  33 + id: 'centercombo',
  34 + fieldLabel: 'Center',
  35 + labelWidth: 150,
  36 + padding: 5,
  37 + flex: 1
  38 + },
  39 + {
  40 + xtype: 'bodies_combo',
  41 + id: 'sccombo',
  42 + fieldLabel: 'Spacecraft',
  43 + labelWidth: 150,
  44 + padding: 5,
  45 + flex: 1
  46 + },
  47 + {
  48 + xtype: 'button',
  49 + text: 'OK',
  50 + id: 'okbtn'
  51 + }
  52 + ]
  53 +});
... ...
server/kernel/data/frames.xml
... ... @@ -119,7 +119,7 @@
119 119 Heliocentric Earth Ecliptic
120 120 </fullname>
121 121 <description>
122   - The Heliocentric Earth Ecliptic frame is defined as follows ):
  122 + The Heliocentric Earth Ecliptic frame is defined as follows :
123 123  
124 124 - X-Y plane is defined by the Earth Mean Ecliptic plane of date,
125 125 therefore, the +Z axis is the primary vector,and it defined as
... ... @@ -141,14 +141,24 @@
141 141 <fullname>
142 142 ECLIPJ2000 centered on Jupiter
143 143 </fullname>
144   - <description>
  144 + <description>The value for the obliquity of the
  145 + ecliptic at J2000 is taken from
  146 + of 'Explanatory Supplement to the Astronomical Almanac'
  147 + edited by P. Kenneth Seidelmann. University Science
  148 + Books, 20 Edgehill Road, Mill Valley, CA 94941 (1992)
  149 + page 114 equation 3.222-1
145 150 </description>
146 151 </frame>
147 152 <frame id="KECLIP">
148 153 <fullname>
149 154 ECLIPJ2000 centered on Saturn
150 155 </fullname>
151   - <description>
  156 + <description>The value for the obliquity of the
  157 + ecliptic at J2000 is taken from
  158 + of 'Explanatory Supplement to the Astronomical Almanac'
  159 + edited by P. Kenneth Seidelmann. University Science
  160 + Books, 20 Edgehill Road, Mill Valley, CA 94941 (1992)
  161 + page 114 equation 3.222-1
152 162 </description>
153 163 </frame>
154 164 <frame id="VSO">
... ... @@ -533,7 +543,12 @@
533 543 <fullname>
534 544 ECLIPJ2000 centered on Mercury
535 545 </fullname>
536   - <description>
  546 + <description>The value for the obliquity of the
  547 + ecliptic at J2000 is taken from
  548 + of 'Explanatory Supplement to the Astronomical Almanac'
  549 + edited by P. Kenneth Seidelmann. University Science
  550 + Books, 20 Edgehill Road, Mill Valley, CA 94941 (1992)
  551 + page 114 equation 3.222-1
537 552 </description>
538 553 </frame>
539 554 <frame id="MESO">
... ... @@ -581,11 +596,18 @@
581 596 Ganymede Phi-Omega
582 597 </fullname>
583 598 <description>
  599 +In those Cartesian coordinate system (referred to as MphiO, M=Ganymede, Europa, Io, Callisto),
  600 +X is along the flow direction, Y is along the Moon-Jupiter vector, and Z is along the spin axis.
  601 +These coordinates are analogous to the earth-centered GSE coordinates that relate to the direction of
  602 +flow of the solar wind onto Earth's environment
  603 +All the vectors are geometric: no aberration corrections are used.
584 604 </description>
585 605 </frame>
586 606 <frame id="IAU_SUN">
587 607 <fullname>Body-Fixed Frame</fullname>
588 608 <description>
  609 + Archinal, B.A., Acton, C.H., A’Hearn, M.F. et al. Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2015.
  610 + Celest Mech Dyn Astr 130, 22 (2018). https://doi.org/10.1007/s10569-017-9805-5
589 611 </description>
590 612 </frame>
591 613 <frame id="MESE">
... ... @@ -628,26 +650,36 @@
628 650 <frame id="IAU_MERCURY">
629 651 <fullname>Body-Fixed Frame</fullname>
630 652 <description>
  653 + Archinal, B.A., Acton, C.H., A’Hearn, M.F. et al. Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2015.
  654 + Celest Mech Dyn Astr 130, 22 (2018). https://doi.org/10.1007/s10569-017-9805-5
631 655 </description>
632 656 </frame>
633 657 <frame id="IAU_VENUS">
634 658 <fullname>Body-Fixed Frame</fullname>
635 659 <description>
  660 + Archinal, B.A., Acton, C.H., A’Hearn, M.F. et al. Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2015.
  661 + Celest Mech Dyn Astr 130, 22 (2018). https://doi.org/10.1007/s10569-017-9805-5
636 662 </description>
637 663 </frame>
638 664 <frame id="IAU_EARTH">
639 665 <fullname>Body-Fixed Frame</fullname>
640 666 <description>
  667 + Archinal, B.A., Acton, C.H., A’Hearn, M.F. et al. Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2015.
  668 + Celest Mech Dyn Astr 130, 22 (2018). https://doi.org/10.1007/s10569-017-9805-5
641 669 </description>
642 670 </frame>
643 671 <frame id="IAU_MOON">
644 672 <fullname>Body-Fixed Frame</fullname>
645 673 <description>
  674 + Archinal, B.A., Acton, C.H., A’Hearn, M.F. et al. Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2015.
  675 + Celest Mech Dyn Astr 130, 22 (2018). https://doi.org/10.1007/s10569-017-9805-5
646 676 </description>
647 677 </frame>
648 678 <frame id="IAU_MARS">
649 679 <fullname>Body-Fixed Frame</fullname>
650 680 <description>
  681 + Archinal, B.A., Acton, C.H., A’Hearn, M.F. et al. Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2015.
  682 + Celest Mech Dyn Astr 130, 22 (2018). https://doi.org/10.1007/s10569-017-9805-5
651 683 </description>
652 684 </frame>
653 685 <frame id="PSE">
... ... @@ -739,7 +771,8 @@
739 771 <frame id="IAU_JUPITER">
740 772 <fullname>Body-Fixed Frame</fullname>
741 773 <description>
742   - Same as SYSTEM_3
  774 + Archinal, B.A., Acton, C.H., A’Hearn, M.F. et al. Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2015.
  775 + Celest Mech Dyn Astr 130, 22 (2018). https://doi.org/10.1007/s10569-017-9805-5
743 776 </description>
744 777 </frame>
745 778 <frame id="IPHIO">
... ... @@ -770,6 +803,8 @@ flow of the solar wind onto Earth&#39;s environment &lt;/description&gt;
770 803 <frame id="IAU_SATURN">
771 804 <fullname>Body-Fixed Frame</fullname>
772 805 <description>
  806 + Archinal, B.A., Acton, C.H., A’Hearn, M.F. et al. Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2015.
  807 + Celest Mech Dyn Astr 130, 22 (2018). https://doi.org/10.1007/s10569-017-9805-5
773 808 </description>
774 809 </frame>
775 810 <frame id="MIIS">
... ... @@ -888,7 +923,12 @@ flow of the solar wind onto Earth&#39;s environment &lt;/description&gt;
888 923 </frame>
889 924 <frame id="UECLIP">
890 925 <fullname>ECLIPJ2000 centered on Uranus</fullname>
891   - <description>
  926 + <description>The value for the obliquity of the
  927 + ecliptic at J2000 is taken from
  928 + of 'Explanatory Supplement to the Astronomical Almanac'
  929 + edited by P. Kenneth Seidelmann. University Science
  930 + Books, 20 Edgehill Road, Mill Valley, CA 94941 (1992)
  931 + page 114 equation 3.222-1
892 932 </description>
893 933 </frame>
894 934 <frame id="USO">
... ... @@ -913,6 +953,8 @@ flow of the solar wind onto Earth&#39;s environment &lt;/description&gt;
913 953 <frame id="IAU_URANUS">
914 954 <fullname>Body-Fixed Frame</fullname>
915 955 <description>
  956 + Archinal, B.A., Acton, C.H., A’Hearn, M.F. et al. Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2015.
  957 + Celest Mech Dyn Astr 130, 22 (2018). https://doi.org/10.1007/s10569-017-9805-5
916 958 </description>
917 959 </frame>
918 960 <frame id="NEME">
... ... @@ -923,7 +965,12 @@ flow of the solar wind onto Earth&#39;s environment &lt;/description&gt;
923 965 </frame>
924 966 <frame id="NECLIP">
925 967 <fullname>ECLIPJ2000 centered on Neptune</fullname>
926   - <description>
  968 + <description>The value for the obliquity of the
  969 + ecliptic at J2000 is taken from
  970 + of 'Explanatory Supplement to the Astronomical Almanac'
  971 + edited by P. Kenneth Seidelmann. University Science
  972 + Books, 20 Edgehill Road, Mill Valley, CA 94941 (1992)
  973 + page 114 equation 3.222-1
927 974 </description>
928 975 </frame>
929 976 <frame id="NSO">
... ... @@ -948,6 +995,8 @@ flow of the solar wind onto Earth&#39;s environment &lt;/description&gt;
948 995 <frame id="IAU_NEPTUNE">
949 996 <fullname>Body-Fixed Frame</fullname>
950 997 <description>
  998 + Archinal, B.A., Acton, C.H., A’Hearn, M.F. et al. Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2015.
  999 + Celest Mech Dyn Astr 130, 22 (2018). https://doi.org/10.1007/s10569-017-9805-5
951 1000 </description>
952 1001 </frame>
953 1002 <frame id="PEME">
... ... @@ -957,7 +1006,12 @@ flow of the solar wind onto Earth&#39;s environment &lt;/description&gt;
957 1006 </frame>
958 1007 <frame id="PECLIP">
959 1008 <fullname>ECLIPJ2000 centered on Pluto</fullname>
960   - <description>
  1009 + <description>The value for the obliquity of the
  1010 + ecliptic at J2000 is taken from
  1011 + of 'Explanatory Supplement to the Astronomical Almanac'
  1012 + edited by P. Kenneth Seidelmann. University Science
  1013 + Books, 20 Edgehill Road, Mill Valley, CA 94941 (1992)
  1014 + page 114 equation 3.222-1
961 1015 </description>
962 1016 </frame>
963 1017 <frame id="PSO">
... ... @@ -982,6 +1036,8 @@ flow of the solar wind onto Earth&#39;s environment &lt;/description&gt;
982 1036 <frame id="IAU_PLUTO">
983 1037 <fullname>Body-Fixed Frame</fullname>
984 1038 <description>
  1039 + Archinal, B.A., Acton, C.H., A’Hearn, M.F. et al. Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2015.
  1040 + Celest Mech Dyn Astr 130, 22 (2018). https://doi.org/10.1007/s10569-017-9805-5
985 1041 </description>
986 1042 </frame>
987 1043 <frame id="67PCG_CSO">
... ... @@ -1086,5 +1142,40 @@ flow of the solar wind onto Earth&#39;s environment &lt;/description&gt;
1086 1142 - All vectors are geometric: no aberration corrections are used.
1087 1143 </description>
1088 1144 </frame>
  1145 + <frame id="RTN">
  1146 + <fullname>Sun-Spaceraft coordinate system</fullname>
  1147 + <description>
  1148 + RTN Frame is defined as follows:
  1149 + - R is positive from the Sun to the spacecraft.
  1150 + - T is omega cross R, where omega is the sun spin axis.
  1151 + - N is R cross T, which completes the right-handed system.
  1152 +
  1153 + This frame assumes the instantaneous center is located at the Sun,
  1154 + and not the spacecraft. Further, the axes are associated
  1155 + with the normal X, Y, and Z in the following manner:
  1156 +
  1157 + - R -> X
  1158 + - T -> Y
  1159 + - N -> Z
  1160 + </description>
  1161 + </frame>
  1162 + <frame id="RTP">
  1163 + <fullname>Planet-Spaceraft coordinate system</fullname>
  1164 + <description>
  1165 + The RTP frame is defined as follows:
  1166 + - R is positive from the Planet to the spacecraft.
  1167 + - T is omega cross R, where omega is the planet spin axis.
  1168 + - P is R cross T, which completes the right-handed system.
  1169 +
  1170 +
  1171 + This frame assumes the instantaneous center is located at planet
  1172 + and not the spacecraft. Further, the axes are associated
  1173 + with the normal X, Y, and Z in the following manner:
  1174 +
  1175 + - R -> X
  1176 + - Theta -> Y
  1177 + - Phi -> Z
  1178 + </description>
  1179 + </frame>
1089 1180 </frames>
1090 1181 </treps>
... ...
server/kernel/src/Bodies/BodiesAbstract.cpp 0 → 100644
... ... @@ -0,0 +1,107 @@
  1 +#include "BodiesAbstract.h"
  2 +
  3 +#include <iostream>
  4 +#include <cstring>
  5 +
  6 +#include "../Common/Toolbox.h"
  7 +#include "../TimeManager/TimeManager.h"
  8 +
  9 +using namespace std;
  10 +using namespace TREPS::Common;
  11 +using namespace TREPS::File;
  12 +using namespace TREPS::TimeManager;
  13 +
  14 +namespace TREPS
  15 +{
  16 + namespace Bodies
  17 + {
  18 + BodiesAbstractClass::BodiesAbstractClass(RequestAbstractClass *trepsRequest) : app(NULL), trepsRequest(trepsRequest),
  19 + errorMsg(""), request(NULL), result(NULL)
  20 + {
  21 + this->app = ApplicationClass::getInstance();
  22 +
  23 + this->request = new BodiesRequestClass();
  24 +
  25 + this->result = new BodiesResultClass();
  26 + }
  27 +
  28 + BodiesAbstractClass::~BodiesAbstractClass(void)
  29 + {
  30 + if (this->request != NULL)
  31 + {
  32 + delete this->request;
  33 + this->request = NULL;
  34 + }
  35 +
  36 + if (this->result != NULL)
  37 + {
  38 + delete this->result;
  39 + this->result = NULL;
  40 + }
  41 + }
  42 +
  43 + bool BodiesAbstractClass::init(const bool isSc, const t_Time *startTime, const t_Time *endTime)
  44 + {
  45 + this->trepsRequest->setStatus("Initialize bodies abstract class");
  46 +
  47 + if (this->request == NULL)
  48 + {
  49 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot init bodies request");
  50 + return false;
  51 + }
  52 +
  53 + this->request->setIsSc(isSc);
  54 + this->request->setTimes(startTime, endTime);
  55 +
  56 + //save request file
  57 +/* if (!this->request->saveToFile(bodiesRequest))
  58 + {
  59 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot save bodies request file");
  60 + return false;
  61 + }
  62 +*/
  63 + return true;
  64 + }
  65 +
  66 + bool BodiesAbstractClass::writeResult(const char *resultPath)
  67 + {
  68 + this->trepsRequest->setStatus("Finalize getbodies XML result");
  69 +
  70 + FileWriterBodiesClass *fileWriter = new FileWriterBodiesClass();
  71 + map<string,string> attributes;
  72 + attributes.clear();
  73 +
  74 + //init the file writer
  75 + if (!fileWriter->init(resultPath, &attributes))
  76 + {
  77 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Error to init the file to write " << resultPath);
  78 + delete fileWriter;
  79 + return false;
  80 + }
  81 +
  82 + //write file data
  83 + if (!fileWriter->writeData(result->getBodies()))
  84 + {
  85 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Error to write data");
  86 + delete fileWriter;
  87 + return false;
  88 + }
  89 +
  90 + //save file
  91 + bool res = fileWriter->save();
  92 +
  93 + if (!res)
  94 + {
  95 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Error to save file");
  96 + }
  97 +
  98 + delete fileWriter;
  99 + return res;
  100 + }
  101 +
  102 + string BodiesAbstractClass::getLastError(void)
  103 + {
  104 + return this->errorMsg;
  105 + }
  106 + }
  107 +}
... ...
server/kernel/src/Bodies/BodiesAbstract.h 0 → 100644
... ... @@ -0,0 +1,59 @@
  1 +#ifndef BODIESABSTRACT_H
  2 +#define BODIESABSTRACT_H
  3 +
  4 +#include <list>
  5 +
  6 +#include "BodiesRequest.h"
  7 +#include "BodiesResult.h"
  8 +#include "../Application/Application.h"
  9 +#include "../File/FileWriterBodies.h"
  10 +#include "../RequestManager/RequestAbstract.h"
  11 +
  12 +using namespace std;
  13 +using namespace TREPS::Application;
  14 +using namespace TREPS::RequestManager;
  15 +
  16 +namespace TREPS
  17 +{
  18 + namespace Bodies
  19 + {
  20 + class BodiesAbstractClass
  21 + {
  22 + public :
  23 + BodiesAbstractClass(RequestAbstractClass *trepsRequest);
  24 +
  25 + virtual ~BodiesAbstractClass(void) = 0;
  26 +
  27 + //init request
  28 + bool init(const bool isSc, const t_Time *startTime, const t_Time *endTime);
  29 +
  30 + //get list of available bodies for this engine
  31 + //virtual t_StringList getBodies(const t_Time *startTime, const t_Time *endTime) = 0;
  32 +
  33 + //run request
  34 + virtual bool run() = 0;
  35 +
  36 + //write request result
  37 + bool writeResult(const char *resultPath);
  38 +
  39 + //get last error message
  40 + string getLastError(void);
  41 +
  42 + protected :
  43 + ApplicationClass *app;
  44 +
  45 + RequestAbstractClass *trepsRequest;
  46 +
  47 + string errorMsg;
  48 +
  49 + //get source vector list
  50 + //t_VectorList getSrcVectorsList(const char *vectorsDef, const char *srcFrame);
  51 +
  52 + BodiesRequestClass *request;
  53 +
  54 + BodiesResultClass *result;
  55 + };
  56 + }
  57 +}
  58 +
  59 +#endif
... ...
server/kernel/src/Bodies/BodiesCDPP3DView.cpp 0 → 100644
... ... @@ -0,0 +1,168 @@
  1 +#include "BodiesCDPP3DView.h"
  2 +
  3 +#include <vector>
  4 +
  5 +//#include "../../CDPP3DViewSOAPClient/cdppBinder.nsmap"
  6 +#include "../../CDPP3DViewSOAPClient/cdpp3dviewcdppBinderProxy.h"
  7 +#include "../Common/Toolbox.h"
  8 +//#include "../DataRetriever/DataRetriever.h"
  9 +//#include "../File/FileLoaderManager.h"
  10 +#include "../TimeManager/TimeManager.h"
  11 +
  12 +using namespace TREPS::Common;
  13 +using namespace TREPS::TimeManager;
  14 +
  15 +namespace TREPS
  16 +{
  17 + namespace Bodies
  18 + {
  19 + BodiesCDPP3DViewClass::BodiesCDPP3DViewClass(RequestAbstractClass *trepsRequest):BodiesAbstractClass(trepsRequest),
  20 + client(NULL)
  21 + {
  22 + //init SOAP client for 3DView Web Service
  23 + this->client = new cdppBinderProxy(SOAP_IO_KEEPALIVE);
  24 + }
  25 +
  26 + BodiesCDPP3DViewClass::~BodiesCDPP3DViewClass(void)
  27 + {
  28 + if (this->client != NULL)
  29 + {
  30 + delete this->client;
  31 + this->client = NULL;
  32 + }
  33 + }
  34 +
  35 + bool BodiesCDPP3DViewClass::run()
  36 + {
  37 + this->errorMsg = "";
  38 +
  39 +
  40 + //for each vector
  41 + //for (t_VectorList::iterator it=this->request->getSrcVectors()->begin(); it != this->request->getSrcVectors()->end(); ++it)
  42 + //{
  43 +
  44 + string generalStatus = "";
  45 + generalStatus += " - Running step : list bodies";
  46 + this->trepsRequest->setStatus(generalStatus.c_str());
  47 + t_Bodies bodies = this->callListBodiesRequest(request->getIsSc());
  48 +
  49 + generalStatus = "Bodies found: ";
  50 + generalStatus += bodies.size();
  51 + generalStatus += " - Running step : filter bodies result";
  52 + //this->trepsRequest->setStatus(generalStatus.c_str());
  53 +
  54 + LOG4CXX_INFO(this->app->getLog()->getPtr(),"listBodies result : " << bodies.size() << " bodies found");
  55 +
  56 + t_Bodies filteredBodies;
  57 + //get time manager instance
  58 + TimeManagerClass *timeMgr = TimeManagerClass::getInstance();
  59 +
  60 + for (unsigned int i=0;i<bodies.size();i++) {
  61 + //LOG4CXX_INFO(this->app->getLog()->getPtr(),"BodiesCDPP3DView.run(): in for : " << i);
  62 + ns4__Body* body = bodies.at(i);
  63 + ns4__TimeRange* coverage = body->coverage;
  64 + if(coverage==0) continue;
  65 + //LOG4CXX_INFO(this->app->getLog()->getPtr(),"BodiesCDPP3DView.run(): body " <<bodies.at(i)->name.c_str()<<"/"<<coverage);
  66 + //LOG4CXX_INFO(this->app->getLog()->getPtr(),"BodiesCDPP3DView.run(): body " <<bodies.at(i)->name.c_str()<<"/"<<coverage->startTime<<"/"<<coverage->stopTime);
  67 + time_t lBodyStart = coverage->startTime;
  68 + time_t lBodyStop = coverage->stopTime;
  69 + time_t lFileStart = timeMgr->to_TIMESTAMP(request->getStartTime());
  70 + time_t lFileStop = timeMgr->to_TIMESTAMP(request->getStopTime());
  71 +
  72 + //LOG4CXX_INFO(this->app->getLog()->getPtr(),"BodiesCDPP3DView.run(): compare body start: " << ctime(&lBodyStart));
  73 + //LOG4CXX_INFO(this->app->getLog()->getPtr(),"BodiesCDPP3DView.run(): compare body stop: " << ctime(&lBodyStop));
  74 + //LOG4CXX_INFO(this->app->getLog()->getPtr(),"BodiesCDPP3DView.run(): compare filter start: " << ctime(&lFileStart));
  75 + //LOG4CXX_INFO(this->app->getLog()->getPtr(),"BodiesCDPP3DView.run(): compare filter stop: " << ctime(&lFileStop));
  76 +
  77 + //check if body timerange covers file timerange
  78 + if((lBodyStart-lFileStart)<0 && (lBodyStop-lFileStop)>0) {
  79 + /*ns4__Body *lNewBody = soap_new_req_ns4__Body(body->soap, body->naifId, body->modelId, body->name,
  80 + soap_new_req_ns4__TimeRange(body->soap, lBodyStart, lBodyStop),
  81 + body->type, body->color, body->size,
  82 + body->prefFrame, body->prefCenter, body->prefStarSubset);
  83 + */
  84 + filteredBodies.push_back(body);
  85 + }
  86 +
  87 +
  88 +
  89 +
  90 + }
  91 + LOG4CXX_INFO(this->app->getLog()->getPtr(),"BodiesCDPP3DView.run(): filtered bodies result : " << filteredBodies.size() << " bodies found");
  92 +
  93 + //copy result xml file in op workspace
  94 + generalStatus = "Bodies filtered: ";
  95 + generalStatus += filteredBodies.size();
  96 + generalStatus += " - Running step : Save bodies result";
  97 + //LOG4CXX_INFO(this->app->getLog()->getPtr(),"BodiesCDPP3DView.run(): set Status");
  98 + //this->trepsRequest->setStatus(generalStatus.c_str());
  99 + //add result
  100 + //LOG4CXX_INFO(this->app->getLog()->getPtr(),"BodiesCDPP3DView.run(): set result");
  101 + this->result->init(filteredBodies);
  102 + //}
  103 +
  104 + return true;
  105 + }
  106 +
  107 +
  108 + t_Bodies BodiesCDPP3DViewClass::callListBodiesRequest(bool isSc)
  109 + {
  110 + bool res = false;
  111 + t_Bodies response;
  112 +
  113 + string method = "listBodies";
  114 +
  115 + //Init 3DView listBodies request
  116 + _ns3__listBodies listBodiesRequest;
  117 + _ns3__listBodiesResponse listBodiesResponse;
  118 + if(isSc) {
  119 + listBodiesRequest.pType = ns4__BodyType__SPACECRAFT;
  120 + LOG4CXX_INFO(this->app->getLog()->getPtr(),"BodiesCDPP3DView.callListBodiesRequest(): type : sc");
  121 + res = (this->client->listBodies(&listBodiesRequest,&listBodiesResponse) == SOAP_OK);
  122 + } else {
  123 + listBodiesRequest.pType = ns4__BodyType__PLANET;
  124 + LOG4CXX_INFO(this->app->getLog()->getPtr(),"BodiesCDPP3DView.callListBodiesRequest(): type : planet");
  125 + //ns4__BodyType__PLANET, ///< xs:string value="PLANET"
  126 + //ns4__BodyType__SATELLITE, ///< xs:string value="SATELLITE"
  127 + //ns4__BodyType__COMET, ///< xs:string value="COMET"
  128 + //ns4__BodyType__ASTEROID, ///< xs:string value="ASTEROID"
  129 + res = (this->client->listBodies(&listBodiesRequest,&listBodiesResponse) == SOAP_OK);
  130 + t_Bodies planets = listBodiesResponse.return_;
  131 +/* listBodiesRequest.pType = ns4__BodyType__SATELLITE;
  132 + res = (this->client->listBodies(&listBodiesRequest,&listBodiesResponse) == SOAP_OK);
  133 + for(unsigned i=0;i<planets.size();i++) {
  134 + listBodiesResponse.return_.push_back(planets.at(i));
  135 + }
  136 +*/
  137 + }
  138 +
  139 + //run listNewFrameOrb to perform transformation (rotation + translation)
  140 + //_ns3__listNewFrameOrbResponse listNewFrameOrbResponse;
  141 +
  142 +
  143 + //#ifndef WITH_GETORBURL
  144 + //this->deleteTimeList(listNewFrameOrbRequest.pDateTimeInput);
  145 + //this->deleteVectorTuple3d(listNewFrameOrbRequest.pDataInput);
  146 + //#endif
  147 +
  148 + if (!res)
  149 + {
  150 + this->errorMsg = "Error during the call of ";
  151 + this->errorMsg += method;
  152 + this->errorMsg += " of 3DView Web Service";
  153 + if (this->client->soap_fault_string() != NULL)
  154 + {
  155 + this->errorMsg += " (";
  156 + this->errorMsg += this->client->soap_fault_string();
  157 + this->errorMsg += ")";
  158 + }
  159 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),this->errorMsg);
  160 +
  161 + } else {
  162 + response = listBodiesResponse.return_;
  163 + }
  164 +
  165 + return response;
  166 + }
  167 + }
  168 +}
... ...
server/kernel/src/Bodies/BodiesCDPP3DView.h 0 → 100644
... ... @@ -0,0 +1,42 @@
  1 +#ifndef BODIESCDPP3DVIEW_H
  2 +#define BODIESCDPP3DVIEW_H
  3 +
  4 +
  5 +
  6 +#include "BodiesAbstract.h"
  7 +
  8 +#define CDPP3DVIEW_TIME_PATTERN "[YYYY]-[MM]-[DD]T[hh]:[mm]:[ss].[mls]"
  9 +
  10 +
  11 +namespace TREPS
  12 +{
  13 + namespace Bodies
  14 + {
  15 + typedef vector<ns4__Body*> t_Bodies;
  16 +
  17 + class BodiesCDPP3DViewClass : public BodiesAbstractClass
  18 + {
  19 + public :
  20 + BodiesCDPP3DViewClass(RequestAbstractClass *trepsRequest);
  21 +
  22 + ~BodiesCDPP3DViewClass(void);
  23 +
  24 + //retreive bodies
  25 + bool run();
  26 +
  27 +
  28 + private :
  29 + //pointer to the WS client
  30 + cdppBinderProxy *client;
  31 + //retreive all bodies
  32 + t_Bodies callListBodiesRequest(const bool isSc);
  33 + //filter bodies with their coverage
  34 + t_Bodies filterBodiesRequest(const t_Time *startDate, const t_Time *endDate);
  35 +
  36 +
  37 +
  38 + };
  39 + }
  40 +}
  41 +
  42 +#endif
... ...
server/kernel/src/Bodies/BodiesRequest.cpp 0 → 100644
... ... @@ -0,0 +1,49 @@
  1 +#include "BodiesRequest.h"
  2 +
  3 +#include "../Common/Toolbox.h"
  4 +#include "../XMLManager/XMLManager.h"
  5 +
  6 +using namespace TREPS::Common;
  7 +using namespace TREPS::XMLManager;
  8 +
  9 +namespace TREPS
  10 +{
  11 + namespace Bodies
  12 + {
  13 + BodiesRequestClass::BodiesRequestClass(void) : startTime(), stopTime()
  14 + {
  15 + }
  16 +
  17 + BodiesRequestClass::~BodiesRequestClass(void)
  18 + {
  19 + }
  20 +
  21 +
  22 + void BodiesRequestClass::setIsSc(bool isSc){
  23 + this->isSc=isSc;
  24 + }
  25 +
  26 + bool BodiesRequestClass::getIsSc(void) {
  27 + return this->isSc;
  28 + }
  29 +
  30 +
  31 +
  32 + void BodiesRequestClass::setTimes(const t_Time *startTime, const t_Time *stopTime)
  33 + {
  34 + this->startTime = *startTime;
  35 + this->stopTime = *stopTime;
  36 + }
  37 +
  38 + t_Time BodiesRequestClass::getStartTime(void) const
  39 + {
  40 + return this->startTime;
  41 + }
  42 +
  43 + t_Time BodiesRequestClass::getStopTime(void) const
  44 + {
  45 + return this->stopTime;
  46 + }
  47 +
  48 + }
  49 +}
... ...
server/kernel/src/Bodies/BodiesRequest.h 0 → 100644
... ... @@ -0,0 +1,42 @@
  1 +#ifndef BODIESREQUEST_H
  2 +#define BODIESREQUEST_H
  3 +
  4 +#include <string>
  5 +
  6 +#include "../Common/TREPSTypes.h"
  7 +
  8 +using namespace std;
  9 +using namespace TREPS::Common;
  10 +
  11 +namespace TREPS
  12 +{
  13 + namespace Bodies
  14 + {
  15 + class BodiesRequestClass
  16 + {
  17 + public :
  18 + BodiesRequestClass(void);
  19 +
  20 + ~BodiesRequestClass(void);
  21 +
  22 + //set spacecraft type query boolean
  23 + void setIsSc(bool isSc);
  24 + //get spacecraft type query boolean
  25 + bool getIsSc(void);
  26 +
  27 + //set times
  28 + void setTimes(const t_Time *startTime, const t_Time *stopTime);
  29 + //get start time
  30 + t_Time getStartTime(void) const;
  31 + //get end time
  32 + t_Time getStopTime(void) const;
  33 +
  34 + private :
  35 + bool isSc;
  36 + t_Time startTime;
  37 + t_Time stopTime;
  38 + };
  39 + }
  40 +}
  41 +
  42 +#endif
... ...
server/kernel/src/Bodies/BodiesResult.cpp 0 → 100644
... ... @@ -0,0 +1,31 @@
  1 +#include "BodiesResult.h"
  2 +
  3 +namespace TREPS
  4 +{
  5 + namespace Bodies
  6 + {
  7 + BodiesResultClass::BodiesResultClass(void) : app(NULL)
  8 + {
  9 + this->app = ApplicationClass::getInstance();
  10 +
  11 + }
  12 +
  13 + BodiesResultClass::~BodiesResultClass(void)
  14 + {
  15 + }
  16 +
  17 + t_Bodies *BodiesResultClass::getBodies(void) const
  18 + {
  19 + return const_cast<t_Bodies*>(&this->bodies);
  20 + }
  21 +
  22 + bool BodiesResultClass::init(t_Bodies bodies)
  23 + {
  24 + //reset result
  25 + this->bodies = bodies;
  26 +
  27 + return true;
  28 + }
  29 +
  30 + }
  31 +}
... ...
server/kernel/src/Bodies/BodiesResult.h 0 → 100644
... ... @@ -0,0 +1,44 @@
  1 +#ifndef BODIESRESULT_H
  2 +#define BODIESRESULT_H
  3 +
  4 +#include "../Common/TREPSTypes.h"
  5 +#include "../Application/Application.h"
  6 +#include "../../CDPP3DViewSOAPClient/cdpp3dviewcdppBinderProxy.h"
  7 +//#include "../DataRecord/DataRecordList.h"
  8 +//#include "../Export/ExportManager.h"
  9 +
  10 +
  11 +using namespace TREPS::Common;
  12 +using namespace TREPS::Application;
  13 +
  14 +namespace TREPS
  15 +{
  16 + namespace Bodies
  17 + {
  18 + //declare stype as in Bodies/BodiesCDPP3DView.h
  19 + typedef vector<ns4__Body*> t_Bodies;
  20 +
  21 + class BodiesResultClass
  22 + {
  23 + public :
  24 + BodiesResultClass(void);
  25 +
  26 + ~BodiesResultClass(void);
  27 +
  28 + //init listBodies result
  29 + bool init(t_Bodies bodies);
  30 +
  31 + //get result
  32 + t_Bodies *getBodies(void) const;
  33 +
  34 +
  35 + private :
  36 + ApplicationClass *app;
  37 +
  38 + t_Bodies bodies;
  39 +
  40 + };
  41 + }
  42 +}
  43 +
  44 +#endif
... ...
server/kernel/src/File/FileWriterBodies.cpp 0 → 100644
... ... @@ -0,0 +1,196 @@
  1 +#include "FileWriterBodies.h"
  2 +
  3 +#include <cstring>
  4 +
  5 +#include "../TimeManager/TimeManager.h"
  6 +#include "../Common/Toolbox.h"
  7 +
  8 +using namespace TREPS::Common;
  9 +using namespace TREPS::TimeManager;
  10 +
  11 +namespace TREPS
  12 +{
  13 + namespace File
  14 + {
  15 + FileWriterBodiesClass::FileWriterBodiesClass(void): filePath(""), writer(NULL)
  16 + {
  17 + this->app = ApplicationClass::getInstance();
  18 + this->writer = new XMLManagerClass();
  19 + }
  20 +
  21 + FileWriterBodiesClass::~FileWriterBodiesClass(void)
  22 + {
  23 + if (this->writer != NULL)
  24 + {
  25 + delete this->writer;
  26 + this->writer = NULL;
  27 + }
  28 + }
  29 +
  30 + bool FileWriterBodiesClass::init(const char *file_path, const map<string,string> *attributes)
  31 + {
  32 + if (!this->close())
  33 + {
  34 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot close previous document");
  35 + return false;
  36 + }
  37 +
  38 + if (!this->writer->create("treps"))
  39 + {
  40 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot init xml document");
  41 + return false;
  42 + }
  43 +
  44 + Node *rootNode = this->writer->getRootNode();
  45 +
  46 + if (rootNode == NULL)
  47 + {
  48 + this->close();
  49 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot get root node");
  50 + return false;
  51 + }
  52 +
  53 +/* if (!this->writer->addAttributeToNode("version", "1.2", rootNode))
  54 + {
  55 + this->close();
  56 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot set VOTable version");
  57 + return false;
  58 + }
  59 +*/
  60 +/* if (!this->writer->addAttributeToNode("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance", rootNode))
  61 + {
  62 + this->close();
  63 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot set xmlns:xsi");
  64 + return false;
  65 + }
  66 +*/
  67 +/*
  68 + if (!this->writer->addAttributeToNode("xmlns", "http://www.ivoa.net/xml/VOTable/v1.2", rootNode))
  69 + {
  70 + this->close();
  71 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot set xmlns");
  72 + return false;
  73 + }
  74 +
  75 + if (!this->writer->addAttributeToNode("xmlns:stc", "http://www.ivoa.net/xml/STC/v1.30", rootNode))
  76 + {
  77 + this->close();
  78 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot set xmlns:stc");
  79 + return false;
  80 + }
  81 +*/
  82 + Node *bodiesNode = this->writer->addChildToRoot("bodies");
  83 +
  84 + if (bodiesNode == NULL)
  85 + {
  86 + this->close();
  87 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot add bodies node");
  88 + return false;
  89 + }
  90 +
  91 +
  92 + bool res = this->writer->save(file_path);
  93 +
  94 + if (res)
  95 + this->filePath = file_path;
  96 + else
  97 + this->close();
  98 +
  99 + return res;
  100 + }
  101 +
  102 +
  103 + bool FileWriterBodiesClass::writeData(const t_Bodies *bodies)
  104 + {
  105 + if (!this->writer->isInUse())
  106 + {
  107 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"File not initialized");
  108 + return false;
  109 + }
  110 +
  111 + //get bodies node
  112 + Node *bodiesNode = this->writer->getChildFromRoot("bodies");
  113 +
  114 + if (bodiesNode == NULL)
  115 + {
  116 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot get bodies node");
  117 + return false;
  118 + }
  119 +
  120 +
  121 + //Add bodies
  122 + TimeManagerClass *timeMgr = TimeManagerClass::getInstance();
  123 +
  124 + //init iso pattern
  125 + string isoPattern = timeMgr->getPatternFromTimeId("iso-mls-z");
  126 + timeMgr->setCurrentPattern(isoPattern.c_str());
  127 +
  128 + //typedef t_Bodies::iterator tBdIter;
  129 + for (unsigned int i=0;i<bodies->size();i++) {
  130 + ns4__Body* body = bodies->at(i);
  131 + ns4__TimeRange* coverage = body->coverage;
  132 + t_Time lBodyStart;
  133 + t_Time lBodyStop;
  134 + if(!timeMgr->from_TIMESTAMP(coverage->startTime, lBodyStart)) {
  135 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot convert "<<body->name.c_str()<< " start time");
  136 + return false;
  137 + }
  138 + if(!timeMgr->from_TIMESTAMP(coverage->stopTime, lBodyStop)) {
  139 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot convert "<<body->name.c_str()<< " stop time");
  140 + return false;
  141 + }
  142 +
  143 + Node *bodyNode = this->writer->addChildToNode("body", bodiesNode);
  144 + string strId;
  145 + stringstream strstr;
  146 + strstr << body->naifId;
  147 +
  148 + //itoa(body->naifId,buff,10);
  149 + this->writer->addAttributeToNode("id", strstr.str().c_str(), bodyNode);
  150 + //this->writer->setNodeContent(strstr.str().c_str(), this->writer->addChildToNode("id", bodyNode));
  151 + this->writer->setNodeContent(body->name.c_str(), this->writer->addChildToNode("fullname", bodyNode));
  152 + this->writer->setNodeContent(timeMgr->to_PATTERN(lBodyStart).c_str(), this->writer->addChildToNode("startTime", bodyNode));
  153 + this->writer->setNodeContent(timeMgr->to_PATTERN(lBodyStop).c_str(), this->writer->addChildToNode("endTime", bodyNode));
  154 +
  155 + }
  156 +
  157 +
  158 + return true;
  159 + }
  160 +
  161 + bool FileWriterBodiesClass::save(void)
  162 + {
  163 + if (!this->writer->isInUse())
  164 + return false;
  165 +
  166 + bool res = this->writer->save(this->filePath.c_str());
  167 +
  168 + /*if (res)
  169 + {
  170 + //check xsd validity
  171 + if (!this->writer->isValid(TREPS_VOTABLE_XSD))
  172 + {
  173 + LOG4CXX_INFO(this->app->getLog()->getPtr(),"The generated VOTable is not valid!");
  174 + }
  175 + }*/
  176 +
  177 + return res;
  178 + }
  179 +
  180 + bool FileWriterBodiesClass::close(void)
  181 + {
  182 + if (this->writer->isInUse())
  183 + {
  184 + this->writer->close();
  185 + this->filePath = "";
  186 + }
  187 +
  188 + return !this->writer->isInUse();
  189 + }
  190 +
  191 + bool FileWriterBodiesClass::isOpened(void)
  192 + {
  193 + return this->writer->isInUse();
  194 + }
  195 + }
  196 +}
... ...
server/kernel/src/File/FileWriterBodies.h 0 → 100644
... ... @@ -0,0 +1,57 @@
  1 +#ifndef FILEWRITERBODIES_H
  2 +#define FILEWRITERBODIES_H
  3 +
  4 +//#define TREPS_VOTABLE_XSD "votable-V1.2.xsd"
  5 +
  6 +//#include "FileWriterAbstract.h"
  7 +//#include <stdio.h>
  8 +//#include <stdlib.h>
  9 +#include "../XMLManager/XMLManager.h"
  10 +#include "../../CDPP3DViewSOAPClient/cdpp3dviewcdppBinderProxy.h"
  11 +
  12 +using namespace TREPS::XMLManager;
  13 +
  14 +namespace TREPS
  15 +{
  16 + namespace File
  17 + {
  18 + //declare stype as in Bodies/BodiesCDPP3DView.h
  19 + typedef vector<ns4__Body*> t_Bodies;
  20 +
  21 + class FileWriterBodiesClass
  22 + {
  23 + public :
  24 + FileWriterBodiesClass(void);
  25 +
  26 + ~FileWriterBodiesClass(void);
  27 +
  28 + //create XML file and add general attributes
  29 + bool init(const char *file_path, const map<string,string> *attributes);
  30 +
  31 + //write bodies in xml file
  32 + bool writeData(const t_Bodies *bodies);
  33 +
  34 + //save the XML file
  35 + bool save(void);
  36 +
  37 + //close the xml file
  38 + bool close(void);
  39 +
  40 + //test if a file is opened
  41 + bool isOpened(void);
  42 +
  43 + protected :
  44 + ApplicationClass *app;
  45 +
  46 + private :
  47 + //path to the initialized file
  48 + string filePath;
  49 +
  50 + //pointer to the xml writer
  51 + XMLManagerClass *writer;
  52 +
  53 + };
  54 + }
  55 +}
  56 +
  57 +#endif
... ...
server/kernel/src/RequestManager/RequestBodiesGet.cpp 0 → 100644
... ... @@ -0,0 +1,163 @@
  1 +#include "RequestBodiesGet.h"
  2 +
  3 +#include "../Bodies/BodiesCDPP3DView.h"
  4 +#include "../Common/Toolbox.h"
  5 +#include "../TimeManager/TimeManager.h"
  6 +
  7 +using namespace TREPS::Common;
  8 +using namespace TREPS::Bodies;
  9 +using namespace TREPS::TimeManager;
  10 +
  11 +namespace TREPS
  12 +{
  13 + namespace RequestManager
  14 + {
  15 + RequestBodiesGetClass::RequestBodiesGetClass(void):RequestAbstractClass(), startTime(), stopTime()
  16 + {
  17 + this->outputType = OUTPUT_XMLFILE;
  18 + }
  19 +
  20 + RequestBodiesGetClass::~RequestBodiesGetClass(void)
  21 + {
  22 + }
  23 +
  24 + string RequestBodiesGetClass::getRequestId(void)
  25 + {
  26 + return "bodies_get";
  27 + }
  28 +
  29 + bool RequestBodiesGetClass::load(RequestLoaderClass *loader)
  30 + {
  31 + //init request and lock workind dir where we will generate result file
  32 + if (!this->initOpId(loader,true))
  33 + {
  34 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot get op Id");
  35 + return false;
  36 + }
  37 +
  38 + //get isSc
  39 + string isSc = loader->getArgStrByName("issc");
  40 + if(isSc.compare("true")==0) {
  41 + this->isSc = true;
  42 + } else {
  43 + this->isSc = false;
  44 + }
  45 + LOG4CXX_INFO(this->app->getLog()->getPtr(),"RequestBodiesGetClass found isSc "<<isSc.c_str()<<" / "<<this->isSc);
  46 + //get start time
  47 + string startTime = loader->getArgStrByName("starttime");
  48 + //get end time
  49 + string stopTime = loader->getArgStrByName("stoptime");
  50 +
  51 +
  52 + //get time manager instance
  53 + TimeManagerClass *timeMgr = TimeManagerClass::getInstance();
  54 +
  55 + string pattern = timeMgr->detectPattern(startTime.c_str());
  56 + timeMgr->setCurrentPattern(pattern.c_str());
  57 + timeMgr->from_PATTERN(startTime.c_str(),this->startTime,false);
  58 + timeMgr->from_PATTERN(stopTime.c_str(),this->stopTime,false);
  59 +
  60 +
  61 + LOG4CXX_INFO(this->app->getLog()->getPtr(),"RequestBodiesGetClass converted start and stop "<<startTime.c_str()<<" / "<<stopTime.c_str());
  62 +
  63 + /*
  64 + t_FieldType type;
  65 + t_TimeFormat timeformat;
  66 + string timepattern;
  67 +
  68 + if (pattern.compare("") != 0)
  69 + {
  70 + //a time pattern has been detected
  71 + timeformat = TF_PATTERN;
  72 + timepattern = pattern;
  73 + type = FT_TIME;
  74 + }
  75 + */
  76 +
  77 +
  78 +
  79 +
  80 + return true;
  81 + }
  82 +
  83 + bool RequestBodiesGetClass::run(void)
  84 + {
  85 +
  86 +
  87 +
  88 + //init getBodies manager
  89 + BodiesCDPP3DViewClass *getBodies = new BodiesCDPP3DViewClass(this);
  90 + TimeManagerClass *timeMgr = TimeManagerClass::getInstance();
  91 + string isoPattern = timeMgr->getPatternFromTimeId("iso-mls-z");
  92 + timeMgr->setCurrentPattern(isoPattern.c_str());
  93 +
  94 + //LOG4CXX_INFO(this->app->getLog()->getPtr(),"RequestBodiesGet init getBodies");
  95 + if (!getBodies->init(this->isSc, &(this->startTime),&(this->stopTime)))
  96 + {
  97 + this->lastMsg = getBodies->getLastError();
  98 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Error to init transformation request");
  99 + return false;
  100 + }
  101 +
  102 + //get bodies
  103 + bool res = getBodies->run();
  104 +
  105 + if (!res)
  106 + {
  107 + this->lastMsg = getBodies->getLastError();
  108 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Error during get Bodies between "<<timeMgr->to_PATTERN(this->startTime).c_str()<<" and "<<timeMgr->to_PATTERN(this->stopTime).c_str());
  109 + } else {
  110 +
  111 +
  112 + //get working dir
  113 + string dirPath = this->dirMgr->createNewDir(false);
  114 + if (dirPath.compare("") == 0)
  115 + {
  116 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Error create dir path");
  117 + return false;
  118 + }
  119 + //LOG4CXX_INFO(this->app->getLog()->getPtr(),"Got dirPath: "<<dirPath.c_str());
  120 +
  121 + this->filePath += getPathCorrection(this->app->getConf()->getWorkingDirPath().c_str());
  122 + this->filePath += getPathCorrection(dirPath.c_str());
  123 + this->filePath += "bodiesList.xml";
  124 +
  125 + //LOG4CXX_INFO(this->app->getLog()->getPtr(),"*** RequestBodiesGet writer to file "<<this->filePath.c_str());
  126 +
  127 + if (this->filePath.compare("") == 0)
  128 + {
  129 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Error to get bodies result file path");
  130 + return false;
  131 + }
  132 +
  133 + getBodies->writeResult(this->filePath.c_str());
  134 + }
  135 +
  136 + //this->success = res;
  137 + delete getBodies;
  138 +
  139 + return res;
  140 +
  141 + }
  142 +
  143 + void RequestBodiesGetClass::writeResult(ResultWriterClass *writer)
  144 + {
  145 + //No result file for this request
  146 + }
  147 +
  148 + string RequestBodiesGetClass::getResultFileSuffix(void)
  149 + {
  150 + return "";
  151 + }
  152 +
  153 + string RequestBodiesGetClass::getXMLFilePath(void)
  154 + {
  155 + return this->filePath;
  156 + }
  157 +
  158 + string RequestBodiesGetClass::getStringResult(void)
  159 + {
  160 + return "";
  161 + }
  162 + }
  163 +}
... ...
server/kernel/src/RequestManager/RequestBodiesGet.h 0 → 100644
... ... @@ -0,0 +1,51 @@
  1 +#ifndef REQUESTBODIESGET_H
  2 +#define REQUESTBODIESGET_H
  3 +
  4 +#include "RequestAbstract.h"
  5 +
  6 +namespace TREPS
  7 +{
  8 + namespace RequestManager
  9 + {
  10 + class RequestBodiesGetClass : public RequestAbstractClass
  11 + {
  12 + public:
  13 + RequestBodiesGetClass(void);
  14 +
  15 + ~RequestBodiesGetClass(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 result XML file
  33 + string getXMLFilePath(void);
  34 +
  35 + //get string result
  36 + string getStringResult(void);
  37 +
  38 + private:
  39 +
  40 + t_Time startTime;
  41 + t_Time stopTime;
  42 + bool isSc;
  43 + string filePath;
  44 + string lastMsg;
  45 +
  46 + };
  47 +
  48 + }
  49 +}
  50 +
  51 +#endif
... ...
server/kernel/src/RequestManager/RequestManager.cpp
... ... @@ -5,6 +5,7 @@
5 5 #include "RequestResetOp.h"
6 6 #include "RequestSourceInfo.h"
7 7 #include "RequestSourceGet.h"
  8 +#include "RequestBodiesGet.h"
8 9 #include "RequestFramesGet.h"
9 10 #include "RequestRunOp.h"
10 11 #include "RequestResultInfo.h"
... ... @@ -75,6 +76,8 @@ namespace TREPS
75 76 this->request = new RequestSourceInfoClass();
76 77 else if (typeStr.compare("source_get") == 0)
77 78 this->request = new RequestSourceGetClass();
  79 + else if (typeStr.compare("bodies_get") == 0)
  80 + this->request = new RequestBodiesGetClass();
78 81 else if (typeStr.compare("frames_get") == 0)
79 82 this->request = new RequestFramesGetClass();
80 83 else if (typeStr.compare("run_op") == 0)
... ...
server/kernel/src/RequestManager/RequestRunOp.cpp
... ... @@ -12,8 +12,8 @@ namespace TREPS
12 12 {
13 13 namespace RequestManager
14 14 {
15   - RequestRunOpClass::RequestRunOpClass(void):RequestAbstractClass(), srcFrame(""), dstFrame(""), vectorsDef(""), timeFieldId(""),
16   - timeFormatId(""), timePattern(""), success(false), lastMsg("")
  15 + RequestRunOpClass::RequestRunOpClass(void):RequestAbstractClass(), srcFrame(""), dstFrame(""), srcCenter(""), dstCenter(""),
  16 + vectorsDef(""), timeFieldId(""), timeFormatId(""), timePattern(""), success(false), lastMsg("")
17 17 {
18 18 }
19 19  
... ... @@ -37,12 +37,28 @@ namespace TREPS
37 37 return false;
38 38 }
39 39  
  40 + //get start time
  41 + string startTime = loader->getArgStrByName("starttime");
  42 + //get end time
  43 + string stopTime = loader->getArgStrByName("stoptime");
  44 +
  45 +
  46 + //get time manager instance
  47 + TimeManagerClass *timeMgr = TimeManagerClass::getInstance();
  48 +
  49 + string pattern = timeMgr->detectPattern(startTime.c_str());
  50 + timeMgr->setCurrentPattern(pattern.c_str());
  51 + timeMgr->from_PATTERN(startTime.c_str(),this->startTime,false);
  52 + timeMgr->from_PATTERN(stopTime.c_str(),this->stopTime,false);
  53 +
40 54 //get source frame
41 55 this->srcFrame = loader->getArgStrByName("srcframe");
42   -
43 56 //get destination frame
44 57 this->dstFrame = loader->getArgStrByName("dstframe");
45 58  
  59 +
  60 +
  61 +
46 62 //test frames.
47 63 if ((this->srcFrame.compare("") == 0) && (this->dstFrame.compare("") != 0))
48 64 {
... ... @@ -56,6 +72,28 @@ namespace TREPS
56 72 return false;
57 73 }
58 74  
  75 +
  76 + /**** For RTN frames ***********/
  77 + //get source center
  78 + this->srcCenter = loader->getArgStrByName("srccenter");
  79 + //get destination center
  80 + this->dstCenter = loader->getArgStrByName("dstcenter");
  81 +
  82 + if(this->srcFrame.compare("RTN")==0 || this->srcFrame.compare("RTP")==0) {
  83 + if(srcCenter.compare("")==0) {
  84 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot get source center for RTP/RTN frame.");
  85 + return false;
  86 + }
  87 + //get TimeFile from atoi(srcCenter.c_str())
  88 + }
  89 + if(this->dstFrame.compare("RTN")==0 || this->dstFrame.compare("RTP")==0) {
  90 + if(dstCenter.compare("")==0) {
  91 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),"Cannot get destination center for RTP/RTN frame.");
  92 + return false;
  93 + }
  94 + //get TimeFile from atoi(dstCenter.c_str())
  95 + }
  96 +
59 97 bool noTrans = (this->srcFrame.compare(this->dstFrame) == 0);
60 98  
61 99 //get vectors definition
... ... @@ -123,7 +161,9 @@ namespace TREPS
123 161 //init transformation engine
124 162 TransformationAbstractClass *trans = new TransformationCDPP3DViewClass(this);
125 163  
126   - if (!trans->init(this->srcFrame.c_str(), this->dstFrame.c_str(), this->vectorsDef.c_str(),
  164 + if (!trans->init(this->srcFrame.c_str(), this->dstFrame.c_str(),
  165 + this->srcCenter.c_str(), this->dstCenter.c_str(), this->startTime, this->stopTime,
  166 + this->vectorsDef.c_str(),
127 167 this->timeFieldId.c_str(), this->timeFormatId.c_str(), this->timePattern.c_str(),
128 168 sourcePath.c_str(), requestPath.c_str()))
129 169 {
... ...
server/kernel/src/RequestManager/RequestRunOp.h
... ... @@ -40,8 +40,13 @@ namespace TREPS
40 40  
41 41 private :
42 42 string srcFrame;
43   -
44 43 string dstFrame;
  44 +
  45 + //for RTN/RTP
  46 + string srcCenter;
  47 + string dstCenter;
  48 + t_Time startTime;
  49 + t_Time stopTime;
45 50  
46 51 string vectorsDef;
47 52  
... ...
server/kernel/src/Transformation/TransformationAbstract.cpp
... ... @@ -41,7 +41,8 @@ namespace TREPS
41 41 }
42 42 }
43 43  
44   - bool TransformationAbstractClass::init(const char *srcFrame, const char *dstFrame, const char *srcVecDef,
  44 + bool TransformationAbstractClass::init(const char *srcFrame, const char *dstFrame, const char *srcCenter, const char *dstCenter,
  45 + const t_Time startTime, const t_Time stopTime, const char *srcVecDef,
45 46 const char *timeFieldId, const char *timeFormatId, const char *timePattern, const char *srcDataFile,
46 47 const char *transformationRequest)
47 48 {
... ... @@ -69,6 +70,9 @@ namespace TREPS
69 70 }
70 71  
71 72 this->request->setFrames(srcFrame, dstFrame);
  73 + this->request->setCenters(srcCenter,dstCenter);
  74 + this->request->setTimes(startTime,stopTime);
  75 +
72 76  
73 77 //load src data
74 78 if (!this->request->loadSrcData(srcDataFile))
... ...
server/kernel/src/Transformation/TransformationAbstract.h
... ... @@ -26,7 +26,8 @@ namespace TREPS
26 26 virtual ~TransformationAbstractClass(void) = 0;
27 27  
28 28 //init request
29   - bool init(const char *srcFrame, const char *dstFrame, const char *srcVecDef,
  29 + bool init(const char *srcFrame, const char *dstFrame, const char *srcCenter, const char *dstCenter,
  30 + const t_Time startTime, const t_Time stopTime, const char *srcVecDef,
30 31 const char *timeFieldId, const char *timeFormatId, const char *timePattern,
31 32 const char *srcDataFile, const char *transformationRequest);
32 33  
... ...
server/kernel/src/Transformation/TransformationCDPP3DView.cpp
1 1 #include "TransformationCDPP3DView.h"
2 2  
3 3 #include <vector>
  4 +#include <iterator>
4 5  
5 6 #include "../../CDPP3DViewSOAPClient/cdppBinder.nsmap"
6 7  
... ... @@ -99,6 +100,45 @@ namespace TREPS
99 100 vectorStatus += intToStr(crtIndex + 1);
100 101 vectorStatus += " / ";
101 102 vectorStatus += intToStr(nbSrcVectors);
  103 +
  104 + //if RTN/RTP, get files
  105 + vector<ns4__TimeFile*> timeFiles;
  106 + //get time manager instance
  107 + TimeManagerClass *timeMgr = TimeManagerClass::getInstance();
  108 + time_t lStart = timeMgr->to_TIMESTAMP(request->getStartTime());
  109 + time_t lStop = timeMgr->to_TIMESTAMP(request->getStopTime());
  110 +
  111 + LOG4CXX_INFO(this->app->getLog()->getPtr(),"Search for RTN/RTP " << request->getSrcFrame().c_str()<< "/"<<request->getDstFrame().c_str());
  112 +
  113 +
  114 + if(request->getSrcFrame().compare("RTN")==0||request->getSrcFrame().compare("RTP")==0){
  115 + LOG4CXX_INFO(this->app->getLog()->getPtr(),"Search for src timeFile for RTN/RTP "<<request->getSrcCenter().c_str());
  116 + istringstream iss(request->getSrcCenter());
  117 + vector<string> splitStr((istream_iterator<string>(iss)),istream_iterator<string>());
  118 + if(splitStr.size()!=4) {
  119 + this->errorMsg = "Source frame center should be 4 elements: ";
  120 + this->errorMsg += request->getSrcCenter().c_str();
  121 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),this->errorMsg);
  122 + return false;
  123 + }
  124 + LOG4CXX_INFO(this->app->getLog()->getPtr(),"Found src sc: "<<splitStr.at(2).c_str());
  125 + timeFiles.push_back(callListFilesRequest(atoi(splitStr.at(2).c_str()),lStart,lStop ));
  126 + }
  127 + if(request->getDstFrame().compare("RTN")==0||request->getDstFrame().compare("RTP")==0){
  128 + LOG4CXX_INFO(this->app->getLog()->getPtr(),"Search for dst timeFile for RTN/RTP "<<request->getDstCenter().c_str());
  129 + istringstream iss(request->getDstCenter());
  130 + vector<string> splitStr((istream_iterator<string>(iss)),istream_iterator<string>());
  131 + if(splitStr.size()!=4) {
  132 + this->errorMsg = "Dest frame center should be 4 elements: ";
  133 + this->errorMsg += request->getDstCenter().c_str();
  134 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),this->errorMsg);
  135 + return false;
  136 + }
  137 + LOG4CXX_INFO(this->app->getLog()->getPtr(),"Found dst sc: "<<splitStr.at(2).c_str());
  138 + timeFiles.push_back(callListFilesRequest(atoi(splitStr.at(2).c_str()),lStart,lStop ));
  139 + }
  140 +
  141 +
102 142  
103 143 #ifdef WITH_GETORBURL
104 144 //call getOrbUrl to generate a VOTable
... ... @@ -116,13 +156,13 @@ namespace TREPS
116 156 generalStatus = vectorStatus;
117 157 generalStatus += " - Running step : Compute transformation";
118 158 this->trepsRequest->setStatus(generalStatus.c_str());
119   - url = this->callNewFrameRequest(&(*it), url.c_str());
  159 + url = this->callNewFrameRequest(&(*it), url.c_str(),timeFiles);
120 160  
121 161 #else
122 162 string generalStatus = vectorStatus;
123 163 generalStatus += " - Running step : Compute transformation";
124 164 this->trepsRequest->setStatus(generalStatus.c_str());
125   - string url = this->callNewFrameRequest(&(*it));
  165 + string url = this->callNewFrameRequest(&(*it),timeFiles);
126 166 #endif
127 167  
128 168  
... ... @@ -265,11 +305,68 @@ namespace TREPS
265 305 {
266 306 this->availableFrames.push_back((*it)->name);
267 307 }
  308 + //add dynamic frames
  309 + this->availableFrames.push_back("RTN");
  310 + this->availableFrames.push_back("RTP");
268 311 }
269 312  
270 313 return true;
271 314 }
272 315  
  316 + ns4__TimeFile* TransformationCDPP3DViewClass::callListFilesRequest(int bodyId, time_t startTime, time_t stopTime)
  317 + {
  318 + bool res = false;
  319 +
  320 +
  321 + string method = "listFiles";
  322 +
  323 + //Init 3DView listBodies request
  324 + _ns3__listFiles listFilesRequest;
  325 + //_ns3__listNewFrameOrb listNewFrameOrbRequest;
  326 + //listNewFrameOrbRequest.pUrlInput = NULL;
  327 + //listNewFrameOrbRequest.pDateTimeInput = this->createTimeList();
  328 + //listNewFrameOrbRequest.pInFrame = this->request->getSrcFrame();
  329 + //listNewFrameOrbRequest.pOutFrame = this->request->getDstFrame();
  330 + ns4__TimeFileType type = ns4__TimeFileType__ORBIT;
  331 + listFilesRequest.type = &type;
  332 + listFilesRequest.pBodyId = bodyId;
  333 + listFilesRequest.pStartTime = startTime;
  334 + listFilesRequest.pStopTime = stopTime;
  335 +
  336 + //run listNewFrameOrb to perform transformation (rotation + translation)
  337 + //_ns3__listNewFrameOrbResponse listNewFrameOrbResponse;
  338 + ns4__TimeFileArray listFilesResponse;
  339 + res = (this->client->listFiles(&listFilesRequest,&listFilesResponse) == SOAP_OK);
  340 + LOG4CXX_INFO(this->app->getLog()->getPtr(),"found timefiles" << listFilesResponse.timeFile.size());
  341 + if(res && listFilesResponse.timeFile.size()>0) {
  342 + return listFilesResponse.timeFile.at(0);
  343 + } else {
  344 + res = false;
  345 + }
  346 +
  347 +
  348 + if (!res)
  349 + {
  350 + this->errorMsg = "Error during the call of ";
  351 + this->errorMsg += method;
  352 + this->errorMsg += " of 3DView Web Service";
  353 + if (this->client->soap_fault_string() != NULL)
  354 + {
  355 + this->errorMsg += " (";
  356 + this->errorMsg += this->client->soap_fault_string();
  357 + this->errorMsg += ")";
  358 + }
  359 + LOG4CXX_ERROR(this->app->getLog()->getPtr(),this->errorMsg);
  360 +
  361 + }
  362 +
  363 + return NULL;
  364 + }
  365 +
  366 +
  367 +
  368 +
  369 +
273 370 #ifdef WITH_GETORBURL
274 371 string TransformationCDPP3DViewClass::callGetOrbUrlRequest(const t_Vector *crtSrcVec)
275 372 {
... ... @@ -311,9 +408,9 @@ namespace TREPS
311 408 #endif
312 409  
313 410 #ifdef WITH_GETORBURL
314   - string TransformationCDPP3DViewClass::callNewFrameRequest(const t_Vector *crtSrcVec, const char *dataURL)
  411 + string TransformationCDPP3DViewClass::callNewFrameRequest(const t_Vector *crtSrcVec, const char *dataURL, vector<ns4__TimeFile*> timeFiles)
315 412 #else
316   - string TransformationCDPP3DViewClass::callNewFrameRequest(const t_Vector *crtSrcVec)
  413 + string TransformationCDPP3DViewClass::callNewFrameRequest(const t_Vector *crtSrcVec, vector<ns4__TimeFile*> timeFiles)
317 414 #endif
318 415 {
319 416 bool res = false;
... ... @@ -340,6 +437,10 @@ namespace TREPS
340 437 #endif
341 438 listNewFrameOrbRequest.pInFrame = this->request->getSrcFrame();
342 439 listNewFrameOrbRequest.pOutFrame = this->request->getDstFrame();
  440 + //for RTN/RTP
  441 + listNewFrameOrbRequest.pInCenter = this->request->getSrcCenter();
  442 + listNewFrameOrbRequest.pOutCenter = this->request->getDstCenter();
  443 + listNewFrameOrbRequest.pTimeFiles = timeFiles;
343 444  
344 445 //run listNewFrameOrb to perform transformation (rotation + translation)
345 446 _ns3__listNewFrameOrbResponse listNewFrameOrbResponse;
... ... @@ -372,6 +473,10 @@ namespace TREPS
372 473 #endif
373 474 listNewFrameAttRequest.pInFrame = this->request->getSrcFrame();
374 475 listNewFrameAttRequest.pOutFrame = this->request->getDstFrame();
  476 + //for RTN/RTP
  477 + listNewFrameAttRequest.pInCenter = this->request->getSrcCenter();
  478 + listNewFrameAttRequest.pOutCenter = this->request->getDstCenter();
  479 + listNewFrameAttRequest.pTimeFiles = timeFiles;
375 480  
376 481 //run listNewFrameAtt to perform transformation (rotation)
377 482 _ns3__listNewFrameAttResponse listNewFrameAttResponse;
... ...
server/kernel/src/Transformation/TransformationCDPP3DView.h
... ... @@ -62,11 +62,14 @@ namespace TREPS
62 62 #ifdef WITH_GETORBURL
63 63 string callGetOrbUrlRequest(const t_Vector *crtSrcVec);
64 64  
65   - string callNewFrameRequest(const t_Vector *crtSrcVec, const char *dataURL);
  65 + string callNewFrameRequest(const t_Vector *crtSrcVec, const char *dataURL, vector<ns4__TimeFile*> timeFiles);
66 66 #else
67   - string callNewFrameRequest(const t_Vector *crtSrcVec);
  67 + string callNewFrameRequest(const t_Vector *crtSrcVec, vector<ns4__TimeFile*> timeFiles);
68 68 #endif
69 69  
  70 +
  71 + ns4__TimeFile* callListFilesRequest(int bodyId, time_t startTime, time_t stopTime);
  72 +
70 73 //get response
71 74 string getURLResponse(const char *response);
72 75  
... ...
server/kernel/src/Transformation/TransformationRequest.cpp
... ... @@ -14,7 +14,7 @@ namespace TREPS
14 14 {
15 15 namespace Transformation
16 16 {
17   - TransformationRequestClass::TransformationRequestClass(void) : srcFrame(""), dstFrame(""), timeFieldId(""), timeFormat(TF_NONE), timePattern("")
  17 + TransformationRequestClass::TransformationRequestClass(void) : srcFrame(""), dstFrame(""), srcCenter(""), dstCenter(""), startTime(), stopTime(), timeFieldId(""), timeFormat(TF_NONE), timePattern("")
18 18 {
19 19 this->srcVectors.clear();
20 20 this->srcData.clear();
... ... @@ -50,6 +50,40 @@ namespace TREPS
50 50 return this->dstFrame;
51 51 }
52 52  
  53 + void TransformationRequestClass::setCenters(const char *srcCenter, const char *dstCenter)
  54 + {
  55 + this->srcCenter = srcCenter;
  56 + this->dstCenter = dstCenter;
  57 + }
  58 +
  59 + string TransformationRequestClass::getSrcCenter(void) const
  60 + {
  61 + return this->srcCenter;
  62 + }
  63 +
  64 + string TransformationRequestClass::getDstCenter(void) const
  65 + {
  66 + return this->dstCenter;
  67 + }
  68 +
  69 + void TransformationRequestClass::setTimes(const t_Time startTime, const t_Time stopTime)
  70 + {
  71 + this->startTime = startTime;
  72 + this->stopTime = stopTime;
  73 + }
  74 +
  75 + t_Time TransformationRequestClass::getStartTime(void) const
  76 + {
  77 + return this->startTime;
  78 + }
  79 +
  80 + t_Time TransformationRequestClass::getStopTime(void) const
  81 + {
  82 + return this->stopTime;
  83 + }
  84 +
  85 +
  86 +
53 87 bool TransformationRequestClass::setSrcVectorsDefinition(const char *srcVecDef, const char *srcFrame)
54 88 {
55 89 this->srcVectors.clear();
... ...
server/kernel/src/Transformation/TransformationRequest.h
... ... @@ -30,6 +30,25 @@ namespace TREPS
30 30 //get transformation destination frame
31 31 string getDstFrame(void) const;
32 32  
  33 + //set transformation centers for RTN/RTP frames
  34 + void setCenters(const char *srcCenter, const char *dstCenter);
  35 +
  36 + //get transformation source center
  37 + string getSrcCenter(void) const;
  38 +
  39 + //get transformation destination center
  40 + string getDstCenter(void) const;
  41 +
  42 + //set times
  43 + void setTimes(const t_Time startTime, const t_Time stopTime);
  44 +
  45 + //get start time
  46 + t_Time getStartTime(void) const;
  47 + //get end time
  48 + t_Time getStopTime(void) const;
  49 +
  50 +
  51 +
33 52 //set source vectors defintiion
34 53 bool setSrcVectorsDefinition(const char *srcVecDef, const char *srcFrame);
35 54  
... ... @@ -72,6 +91,10 @@ namespace TREPS
72 91 private :
73 92 string srcFrame;
74 93 string dstFrame;
  94 + string srcCenter;
  95 + string dstCenter;
  96 + t_Time startTime;
  97 + t_Time stopTime;
75 98  
76 99 t_VectorList srcVectors;
77 100  
... ...
server/php/direct/classes/TREPSAction.php
... ... @@ -54,7 +54,7 @@
54 54 function runOperation($arg)
55 55 {
56 56 $reqMgr = new RequestManager();
57   - $res = $reqMgr->run('run_op',array('id' => $arg->id, 'srcframe' => $arg->srcframe, 'dstframe' => $arg->dstframe, 'vectors' => $arg->vectors, 'timefieldid' => $arg->timefieldid, 'timeformatid' => $arg->timeformatid, 'timepattern' => $arg->timepattern), OutputTypeEnum::OUTPUT_RESULTFILE);
  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 58 return $res;
59 59 }
60 60  
... ... @@ -100,6 +100,13 @@
100 100 return $res;
101 101 }
102 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 +
103 110 function getFramesList()
104 111 {
105 112 $reqMgr = new RequestManager();
... ...
server/php/direct/config.php
... ... @@ -32,6 +32,9 @@ $API = array(
32 32 'getRunInfo'=>array(
33 33 'len'=>1
34 34 ),
  35 + 'getBodiesList'=>array(
  36 + 'len'=>1
  37 + ),
35 38 'getFramesList'=>array(
36 39 'len'=>1
37 40 ),
... ...