Blame view

src/ExternLib/FramesTransformation/FramesTransformation.hh 2.17 KB
cebd3f0e   Benjamin Renard   First implementat...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * FramesTransformation.hh
 *
 *  Created on: Jul 18, 2016
 *      Author: AKKA IS
 */

#ifndef FRAMESTRANSFORMATION_HH_
#define FRAMESTRANSFORMATION_HH_

#include "Parameter.hh"
#include "ParamData.hh"
#include "DataTypeMath.hh"
#include "Operation.hh"
#include "SpiceKernelMgr.hh"

namespace AMDA {
namespace Parameters {

/**
 * @class FramesTransformation
 * @brief It is responsible to compute the frames transformation.
 * @details This class implement the interface Operation.
 */
template<class TParamData>
class FramesTransformation : public Operation {

	typedef typename TParamData::ElementType ElemType;

public:
	/**
	 * @brief Constructor.
	 * @details Create the ParamData type of the input ParamData.
	 */
  FramesTransformation(Process& pProcess, TParamData& paramInput, const char* fromFrame, const char* toFrame, bool isPosition)
	: Operation(pProcess),
	  _paramInput(paramInput),
	  _paramOutput(new TParamData()),
	  _fromFrame(fromFrame),
	  _toFrame(toFrame),
	  _isPosition(isPosition) {
	  _paramDataOutput=_paramOutput;
  }

	/**
	 * @overload Operation::write(ParamDataIndexInfo &pParamDataIndexInfo)
	 */
  void  write(ParamDataIndexInfo &pParamDataIndexInfo) {
	  for (unsigned int _index = pParamDataIndexInfo._startIndex ;
			  _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess;
			  ++_index)
	  {
		  ElemType output = _paramInput.get(pParamDataIndexInfo._startIndex);

cd03a89d   Benjamin Renard   Check NaN value b...
55
56
57
58
59
60
61
62
63
64
		  if (!isNAN(_paramInput.getDataList()[_index]))
			  AMDA::SpiceKernel::SpiceKernelMgr::getInstance()->transform(
					  _fromFrame.c_str(),
					  _toFrame.c_str(),
					  _isPosition,
					  _paramInput.getTime(_index),
					  _paramInput.getDataList()[_index],
					  output);
		  else
			  output << NotANumber();
cebd3f0e   Benjamin Renard   First implementat...
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93

		  _paramOutput->pushTime(_paramInput.getTime(_index));
		  _paramOutput->getDataList().push_back(output);
	  }
  }

private:
	/**<
	 * @brief It is the channel of data derived
	 */
  TParamData &_paramInput;

	/**<
	 * @brief It is the channel of the data derived
	 */
  TParamData *_paramOutput;

  std::string _fromFrame;

  std::string _toFrame;

  bool _isPosition;


};

} /* namespace Parameters */
} /* namespace AMDA */
#endif /* FRAMESTRANSFORMATION_HH_ */