OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Public Attributes | Friends | List of all members
ossimQuickbirdRpcHeader Class Reference

#include <ossimQuickbirdRpcHeader.h>

Inheritance diagram for ossimQuickbirdRpcHeader:
ossimErrorStatusInterface

Public Member Functions

 ossimQuickbirdRpcHeader ()
 
bool open (const ossimFilename &file)
 
bool isAPolynomial () const
 
bool isBPolynomial () const
 
bool readCoeff (std::istream &in, std::vector< double > &coeff)
 
bool parseNameValue (const ossimString &line)
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 

Public Attributes

ossimString theFilename
 
ossimString theSatId
 
ossimString theBandId
 
ossimString theSpecId
 
double theErrBias
 
double theErrRand
 
ossim_int32 theLineOffset
 
ossim_int32 theSampOffset
 
double theLatOffset
 
double theLonOffset
 
double theHeightOffset
 
double theLineScale
 
double theSampScale
 
double theLatScale
 
double theLonScale
 
double theHeightScale
 
std::vector< double > theLineNumCoeff
 
std::vector< double > theLineDenCoeff
 
std::vector< double > theSampNumCoeff
 
std::vector< double > theSampDenCoeff
 

Friends

OSSIM_DLL std::ostream & operator<< (std::ostream &out, const ossimQuickbirdRpcHeader &data)
 

Additional Inherited Members

- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 

Detailed Description

Definition at line 8 of file ossimQuickbirdRpcHeader.h.

Constructor & Destructor Documentation

◆ ossimQuickbirdRpcHeader()

ossimQuickbirdRpcHeader::ossimQuickbirdRpcHeader ( )

Definition at line 55 of file ossimQuickbirdRpcHeader.cpp.

Member Function Documentation

◆ isAPolynomial()

bool ossimQuickbirdRpcHeader::isAPolynomial ( ) const
inline

Definition at line 17 of file ossimQuickbirdRpcHeader.h.

Referenced by ossimQuickbirdRpcModel::parseRpcData().

18  {
19  return theSpecId.contains("A");
20  }
bool contains(char aChar) const
Definition: ossimString.h:58

◆ isBPolynomial()

bool ossimQuickbirdRpcHeader::isBPolynomial ( ) const
inline

Definition at line 21 of file ossimQuickbirdRpcHeader.h.

22  {
23  return theSpecId.contains("B");
24  }
bool contains(char aChar) const
Definition: ossimString.h:58

◆ open()

bool ossimQuickbirdRpcHeader::open ( const ossimFilename file)

Definition at line 71 of file ossimQuickbirdRpcHeader.cpp.

References ossimString::c_str(), ossimString::contains(), getline(), ossimErrorCodes::OSSIM_OK, parseNameValue(), readCoeff(), ossimErrorStatusInterface::setErrorStatus(), ossimErrorStatusInterface::theErrorStatus, theFilename, theLineDenCoeff, theLineNumCoeff, theSampDenCoeff, theSampNumCoeff, and ossimString::upcase().

Referenced by ossimQuickbirdRpcModel::parseRpcData().

72 {
73  theFilename = file;
74  std::ifstream in(file.c_str(), std::ios::in|std::ios::binary);
75 
76  char test[64];
77 
78  in.read((char*)test, 63);
79  test[63] = '\0';
80  in.seekg(0);
81  ossimString line = test;
82  line = line.upcase();
83 
84  if(parseNameValue(line))
85  {
87  getline(in,
88  line);
90  {
91  line = line.upcase();
92  if(line.contains("LINENUMCOEF"))
93  {
94  if(!readCoeff(in, theLineNumCoeff))
95  {
97  break;
98  }
99  }
100  else if(line.contains("LINEDENCOEF"))
101  {
102  if(!readCoeff(in, theLineDenCoeff))
103  {
104  setErrorStatus();
105  break;
106  }
107  }
108  else if(line.contains("SAMPNUMCOEF"))
109  {
110  if(!readCoeff(in, theSampNumCoeff))
111  {
112  setErrorStatus();
113  break;
114  }
115  }
116  else if(line.contains("SAMPDENCOEF"))
117  {
118  if(!readCoeff(in, theSampDenCoeff))
119  {
120  setErrorStatus();
121  break;
122  }
123  }
124  else if(!parseNameValue(line))
125  {
126  setErrorStatus();
127  break;
128  }
129  getline(in,
130  line);
131  }
132  }
133  else
134  {
135  setErrorStatus();
136  }
138 }
static ossimString upcase(const ossimString &aString)
Definition: ossimString.cpp:34
static const ossimErrorCode OSSIM_OK
std::basic_ifstream< char > ifstream
Class for char input file streams.
Definition: ossimIosFwd.h:44
bool contains(char aChar) const
Definition: ossimString.h:58
std::istream & getline(std::istream &is, ossimString &str, char delim)
Definition: ossimString.h:916
bool readCoeff(std::istream &in, std::vector< double > &coeff)
std::vector< double > theSampNumCoeff
std::vector< double > theLineNumCoeff
bool parseNameValue(const ossimString &line)
std::vector< double > theSampDenCoeff
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
std::vector< double > theLineDenCoeff

◆ parseNameValue()

bool ossimQuickbirdRpcHeader::parseNameValue ( const ossimString line)

Definition at line 163 of file ossimQuickbirdRpcHeader.cpp.

References ossimString::after(), ossimString::before(), ossimString::contains(), theBandId, theErrBias, theErrRand, theHeightOffset, theHeightScale, theLatOffset, theLatScale, theLineOffset, theLineScale, theLonOffset, theLonScale, theSampOffset, theSampScale, theSatId, theSpecId, ossimString::toDouble(), and ossimString::toInt().

Referenced by open().

164 {
165  bool result = true;
166  ossimString lineCopy = line;
167 
168  if(lineCopy.contains("SATID"))
169  {
170  theSatId = lineCopy.after("\"");
171  theSatId = theSatId.before("\"");
172  }
173  else if(lineCopy.contains("BANDID"))
174  {
175  theBandId = lineCopy.after("\"");
176  theBandId = theBandId.before("\"");
177  }
178  else if(lineCopy.contains("SPECID"))
179  {
180  theSpecId = lineCopy.after("\"");
181  theSpecId = theSpecId.before("\"");
182  }
183  else if(lineCopy.contains("BEGIN_GROUP"))
184  {
185  }
186  else if(lineCopy.contains("ERRBIAS"))
187  {
188  lineCopy = lineCopy.after("=");
189  theErrBias = lineCopy.before(";").toDouble();
190  }
191  else if(lineCopy.contains("ERRRAND"))
192  {
193  lineCopy = lineCopy.after("=");
194  theErrRand = lineCopy.before(";").toDouble();
195  }
196  else if(lineCopy.contains("LINEOFFSET"))
197  {
198  lineCopy = lineCopy.after("=");
199  theLineOffset = lineCopy.before(";").toInt();
200  }
201  else if(lineCopy.contains("SAMPOFFSET"))
202  {
203  lineCopy = lineCopy.after("=");
204  theSampOffset = lineCopy.before(";").toInt();
205  }
206  else if(lineCopy.contains("LATOFFSET"))
207  {
208  lineCopy = lineCopy.after("=");
209  theLatOffset = lineCopy.before(";").toDouble();
210  }
211  else if(lineCopy.contains("LONGOFFSET"))
212  {
213  lineCopy = lineCopy.after("=");
214  theLonOffset = lineCopy.before(";").toDouble();
215  }
216  else if(lineCopy.contains("HEIGHTOFFSET"))
217  {
218  lineCopy = lineCopy.after("=");
219  theHeightOffset = lineCopy.before(";").toDouble();
220  }
221  else if(lineCopy.contains("LINESCALE"))
222  {
223  lineCopy = lineCopy.after("=");
224  theLineScale = lineCopy.before(";").toDouble();
225  }
226  else if(lineCopy.contains("SAMPSCALE"))
227  {
228  lineCopy = lineCopy.after("=");
229  theSampScale = lineCopy.before(";").toDouble();
230  }
231  else if(lineCopy.contains("LATSCALE"))
232  {
233  lineCopy = lineCopy.after("=");
234  theLatScale = lineCopy.before(";").toDouble();
235  }
236  else if(lineCopy.contains("LONGSCALE"))
237  {
238  lineCopy = lineCopy.after("=");
239  theLonScale = lineCopy.before(";").toDouble();
240  }
241  else if(lineCopy.contains("HEIGHTSCALE"))
242  {
243  lineCopy = lineCopy.after("=");
244  theHeightScale = lineCopy.before(";").toDouble();
245  }
246  else if(lineCopy.contains("END_GROUP"))
247  {
248  }
249  else if(lineCopy.contains("END"))
250  {
251  }
252  else
253  {
254  result = false;
255  }
256 
257  return result;
258 }
ossimString before(const ossimString &str, std::string::size_type pos=0) const
METHOD: before(str, pos) Returns string beginning at pos and ending one before the token str If strin...
bool contains(char aChar) const
Definition: ossimString.h:58
double toDouble() const
ossimString after(const ossimString &str, std::string::size_type pos=0) const
METHOD: after(str, pos) Returns string immediately after the token str.
int toInt() const

◆ readCoeff()

bool ossimQuickbirdRpcHeader::readCoeff ( std::istream &  in,
std::vector< double > &  coeff 
)

Definition at line 140 of file ossimQuickbirdRpcHeader.cpp.

References ossimString::contains(), getline(), ossimString::push_back(), ossimString::toDouble(), and ossimString::trim().

Referenced by open().

142 {
143  coeff.clear();
144  bool done = false;
145  ossimString line;
146  while(!in.eof()&&!in.bad()&&!done)
147  {
148  getline(in,
149  line);
150  line.trim();
151  line.trim(',');
152  if(line.contains(");"))
153  {
154  done = true;
155  line.trim(';');
156  line.trim(')');
157  }
158  coeff.push_back(line.toDouble());
159  }
160  return done;
161 }
bool contains(char aChar) const
Definition: ossimString.h:58
std::istream & getline(std::istream &is, ossimString &str, char delim)
Definition: ossimString.h:916
void push_back(char c)
Equivalent to insert(end(), c).
Definition: ossimString.h:905
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
double toDouble() const

Friends And Related Function Documentation

◆ operator<<

OSSIM_DLL std::ostream& operator<< ( std::ostream &  out,
const ossimQuickbirdRpcHeader data 
)
friend

Definition at line 16 of file ossimQuickbirdRpcHeader.cpp.

18 {
19  out << "theSatId = " << data.theSatId << std::endl
20  << "theBandId = " << data.theBandId << std::endl
21  << "theSpecId = " << data.theSpecId << std::endl
22  << "theErrBias = " << data.theErrBias << std::endl
23  << "theLineOffset = " << data.theLineOffset << std::endl
24  << "theSampOffset = " << data.theSampOffset << std::endl
25  << "theLatOffset = " << data.theLatOffset << std::endl
26  << "theLonOffset = " << data.theLonOffset << std::endl
27  << "theHeightOffset = " << data.theHeightOffset << std::endl
28  << "theLineScale = " << data.theLineScale << std::endl
29  << "theSampScale = " << data.theSampScale << std::endl
30  << "theLatScale = " << data.theLatScale << std::endl
31  << "theLonScale = " << data.theLonScale << std::endl
32  << "theHeightScale = " << data.theHeightScale << std::endl;
33 
34  out << "lineNumCoef = " << std::endl;
35  std::copy(data.theLineNumCoeff.begin(),
36  data.theLineNumCoeff.end(),
37  std::ostream_iterator<double>(out, "\n"));
38  out << "lineDenCoef = " << std::endl;
39  std::copy(data.theLineDenCoeff.begin(),
40  data.theLineDenCoeff.end(),
41  std::ostream_iterator<double>(out, "\n"));
42  out << "sampNumCoef = " << std::endl;
43  std::copy(data.theSampNumCoeff.begin(),
44  data.theSampNumCoeff.end(),
45  std::ostream_iterator<double>(out, "\n"));
46  out << "sampDenCoef = " << std::endl;
47  std::copy(data.theSampDenCoeff.begin(),
48  data.theSampDenCoeff.end(),
49  std::ostream_iterator<double>(out, "\n"));
50 
51  return out;
52 }
std::vector< double > theSampNumCoeff
std::vector< double > theLineNumCoeff
std::vector< double > theSampDenCoeff
std::vector< double > theLineDenCoeff

Member Data Documentation

◆ theBandId

ossimString ossimQuickbirdRpcHeader::theBandId

Definition at line 28 of file ossimQuickbirdRpcHeader.h.

Referenced by operator<<(), and parseNameValue().

◆ theErrBias

double ossimQuickbirdRpcHeader::theErrBias

Definition at line 30 of file ossimQuickbirdRpcHeader.h.

Referenced by operator<<(), and parseNameValue().

◆ theErrRand

double ossimQuickbirdRpcHeader::theErrRand

Definition at line 31 of file ossimQuickbirdRpcHeader.h.

Referenced by parseNameValue().

◆ theFilename

ossimString ossimQuickbirdRpcHeader::theFilename

Definition at line 25 of file ossimQuickbirdRpcHeader.h.

Referenced by open().

◆ theHeightOffset

double ossimQuickbirdRpcHeader::theHeightOffset

◆ theHeightScale

double ossimQuickbirdRpcHeader::theHeightScale

◆ theLatOffset

double ossimQuickbirdRpcHeader::theLatOffset

◆ theLatScale

double ossimQuickbirdRpcHeader::theLatScale

◆ theLineDenCoeff

std::vector<double> ossimQuickbirdRpcHeader::theLineDenCoeff

◆ theLineNumCoeff

std::vector<double> ossimQuickbirdRpcHeader::theLineNumCoeff

◆ theLineOffset

ossim_int32 ossimQuickbirdRpcHeader::theLineOffset

◆ theLineScale

double ossimQuickbirdRpcHeader::theLineScale

◆ theLonOffset

double ossimQuickbirdRpcHeader::theLonOffset

◆ theLonScale

double ossimQuickbirdRpcHeader::theLonScale

◆ theSampDenCoeff

std::vector<double> ossimQuickbirdRpcHeader::theSampDenCoeff

◆ theSampNumCoeff

std::vector<double> ossimQuickbirdRpcHeader::theSampNumCoeff

◆ theSampOffset

ossim_int32 ossimQuickbirdRpcHeader::theSampOffset

◆ theSampScale

double ossimQuickbirdRpcHeader::theSampScale

◆ theSatId

ossimString ossimQuickbirdRpcHeader::theSatId

Definition at line 27 of file ossimQuickbirdRpcHeader.h.

Referenced by operator<<(), and parseNameValue().

◆ theSpecId

ossimString ossimQuickbirdRpcHeader::theSpecId

Definition at line 29 of file ossimQuickbirdRpcHeader.h.

Referenced by operator<<(), and parseNameValue().


The documentation for this class was generated from the following files: