OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
InfoIncidenceAngle.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // "Copyright Centre National d'Etudes Spatiales"
4 //
5 // License: LGPL
6 //
7 // See LICENSE.txt file in the top level directory for more details.
8 //
9 //----------------------------------------------------------------------------
10 // $Id$
11 
12 #include <otb/InfoIncidenceAngle.h>
13 #include <ossim/base/ossimDpt3d.h>
15 #include <ossim/base/ossimNotify.h>
16 #include <ossim/base/ossimString.h>
17 
18 namespace ossimplugins
19 {
20 
21 
22 static const char PREFIX[] = ".infoIncidenceAngle.";
23 static const char REF_ROW[] = "refRow";
24 static const char REF_COLUMN[] = "refColumn";
25 static const char INCIDENCE_ANGLE[] = "incidenceAngle";
26 
28  _refRow(0),
29  _refColumn(0),
30  _incidenceAngle(0.)
31 {
32 }
33 
35 {
36 }
37 
38 
40  _refRow(rhs._refRow),
41  _refColumn(rhs._refColumn),
42  _incidenceAngle(rhs._incidenceAngle)
43 {
44 }
45 
47 {
48  _refRow = rhs._refRow;
49  _refColumn = rhs._refColumn;
51  return *this;
52 }
53 
54 bool InfoIncidenceAngle::saveState(ossimKeywordlist& kwl, const char* prefix) const
55 {
56  std::string pfx;
57  if (prefix)
58  {
59  pfx = prefix;
60  }
61  pfx += PREFIX;
62  kwl.add(pfx.c_str(), REF_ROW, _refRow);
63  kwl.add(pfx.c_str(), REF_COLUMN, _refColumn);
64  kwl.add(pfx.c_str(), INCIDENCE_ANGLE, _incidenceAngle);
65 
66  return true;
67 }
68 
69 bool InfoIncidenceAngle::loadState(const ossimKeywordlist& kwl, const char* prefix)
70 {
71  static const char MODULE[] = "InfoIncidenceAngle::loadState";
72  bool result = true;
73  std::string pfx;
74  if (prefix)
75  {
76  pfx = prefix;
77  }
78  ossimString s;
79  const char* lookup = 0;
80 
81  pfx += PREFIX;
82  lookup = kwl.find(pfx.c_str(), REF_ROW);
83  if (lookup)
84  {
85  s = lookup;
86  _refRow = s.toUInt32();
87  }
88  else
89  {
91  << MODULE << " Keyword not found: " << REF_ROW << " in "<<pfx.c_str()<<" path.\n";
92  result = false;
93  }
94 
95  lookup = kwl.find(pfx.c_str(), REF_COLUMN);
96  if (lookup)
97  {
98  s = lookup;
99  _refColumn = s.toUInt32();
100  }
101  else
102  {
104  << MODULE << " Keyword not found: " << REF_COLUMN << " in "<<pfx.c_str()<<" path.\n";
105  result = false;
106  }
107 
108  lookup = kwl.find(pfx.c_str(), INCIDENCE_ANGLE);
109  if (lookup)
110  {
111  s = lookup;
113  }
114  else
115  {
117  << MODULE << " Keyword not found: " << INCIDENCE_ANGLE << " in "<<pfx.c_str()<<" path.\n";
118  result = false;
119  }
120 
121  return result;
122 }
123 }
double _incidenceAngle
IncidenceAngle (incidenceAngle node).
This class represents an InfoIncidenceAngle.
bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save object state to a keyword list.
Represents serializable keyword/value map.
const char * find(const char *key) const
ossim_uint32 toUInt32() const
bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of the object from a keyword list.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
double toDouble() const
ossim_uint32 _refColumn
Reference Column (refColumn node).
virtual ~InfoIncidenceAngle()
Destructor.
ossim_uint32 _refRow
Reference Row (refRow node).
InfoIncidenceAngle & operator=(const InfoIncidenceAngle &rhs)
Affectation operator.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)