pktools  2.6.7
Processing Kernel for geospatial data
pksensormodel.h
1 /**********************************************************************
2 pksensormodel.h: program to calculate geometric position based on row (sensor), col (sensor), roll, pitch, yaw and lens coordinates
3 Copyright (C) 2008-2014 Pieter Kempeneers
4 
5 This file is part of pktools
6 
7 pktools is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 pktools is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with pktools. If not, see <http://www.gnu.org/licenses/>.
19 ***********************************************************************/
20 #ifndef _PKSENSORMODEL_H_
21 #define _PKSENSORMODEL_H_
22 #include <vector>
23 // #include <gslwrap/matrix_double.h>
24 #include <armadillo>
25 #include "models/SensorModel.h"
26 
27 double objFunction(const std::vector<double> &x, std::vector<double> &grad, void *my_func_data);
28 
29 class DataModel{
30  public:
31  DataModel() : m_threshold(0){};
32  DataModel(const SensorModel::SensorModel& theModel) : m_model(theModel), m_threshold(0){};
33  ~DataModel(){};
34  void setModel(const SensorModel::SensorModel& theModel){m_model=theModel;};
35  const SensorModel::SensorModel& getModel() const {return m_model;};
36  int getSize() const{return m_posGCP.size();};
37  void setThreshold(double theThreshold){m_threshold=theThreshold;};
38  double getThreshold(){return m_threshold;};
39  int erase(int index){
40  m_attPlatform.erase(m_attPlatform.begin()+index);
41  m_posPlatform.erase(m_posPlatform.begin()+index);
42  m_posGCP.erase(m_posGCP.begin()+index);
43  m_row.erase(m_row.begin()+index);
44  m_col.erase(m_col.begin()+index);
45  };
46  int pushAttPlatform(const arma::vec& atp){m_attPlatform.push_back(atp); return m_attPlatform.size();};
47  int pushPosPlatform(const arma::vec& ppl){m_posPlatform.push_back(ppl); return m_posPlatform.size();};
48  int pushPosGCP(const arma::vec& pgcp){m_posGCP.push_back(pgcp); return m_posGCP.size();};
49  int pushRow(int r){m_row.push_back(r); return m_row.size();};
50  int pushCol(int c){m_col.push_back(c); return m_col.size();};
51  arma::vec getPosPlatform(int index) const{assert(index>=0);assert(index<m_posPlatform.size());return(m_posPlatform[index]);};
52  arma::vec getAttPlatform(int index) const{assert(index>=0);assert(index<m_attPlatform.size());return(m_attPlatform[index]);};
53  arma::vec getPosGCP(int index) const{assert(index>=0);assert(index<m_posGCP.size());return(m_posGCP[index]);};
54  arma::vec getPos(int index) const{
55  assert(index>=0);
56  assert(index<m_posPlatform.size());
57  assert(index<m_attPlatform.size());
58  assert(index<m_row.size());
59  assert(index<m_col.size());
60  assert(index<m_posGCP.size());
61  return(m_model.getPos(m_posPlatform[index],m_attPlatform[index],m_row[index],m_col[index],m_posGCP[index][2]));
62  };
63  double getDistGeo(int index) const{assert(index>=0);assert(index<m_posGCP.size());return(m_model.getDistGeo(m_posGCP[index],getPos(index)));};
64  int getRow(int index) const{assert(index>=0);assert(index<m_row.size());return(m_row[index]);};
65  int getCol(int index) const{assert(index>=0);assert(index<m_col.size());return(m_col[index]);};
66  double getHeight(int index) const{assert(index>=0);assert(index<m_posGCP.size());return(m_posGCP[index][2]);};
67  void setBoresightAtt(const arma::vec& bc_att){
68  m_model.setBoresightAtt(bc_att);
69  // for(int index=0;index<m_attPlatform.size();++index)
70  // m_attPlatform[index]+=bc_att;
71  };
72  private:
73  SensorModel::SensorModel m_model;
74  vector<arma::vec> m_posPlatform;
75  vector<arma::vec> m_posGCP;
76  vector<arma::vec> m_attPlatform;
77  vector<int> m_row;
78  vector<int> m_col;
79  double m_threshold;
80 };
81 
82 #endif //_PKSENSORMODEL_H_