OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Functions
ossimLagrangeInterpolator.cpp File Reference
#include <iomanip>
#include <string>
#include "ossim/base/ossimLagrangeInterpolator.h"
#include "ossim/base/ossimTrace.h"

Go to the source code of this file.

Functions

ostream & operator<< (ostream &stream, const ossimLagrangeInterpolator &interpolator)
 
istream & operator>> (istream &stream, ossimLagrangeInterpolator &interpolator)
 

Function Documentation

◆ operator<<()

ostream& operator<< ( ostream &  stream,
const ossimLagrangeInterpolator interpolator 
)

Definition at line 124 of file ossimLagrangeInterpolator.cpp.

125 {
126  stream << "\n" << HEADER_LABEL
127  << " " << interpolator.theTeeArray.size()
128  << " " << interpolator.theNumElements << endl;
129 
130  for (ossim_uint32 i=0; i<interpolator.theTeeArray.size(); ++i)
131  {
132  stream << setprecision(20);
133  stream << interpolator.theTeeArray[i] << " "
134  << interpolator.theNormalizer[i] << endl
135  << "( "<<interpolator.theDataArray[i](0)
136  << interpolator.theDataArray[i](1)
137  << interpolator.theDataArray[2](1) << " )" << endl;
138  }
139 
140  return stream;
141 }
unsigned int ossim_uint32
std::vector< double > theNormalizer
std::vector< NEWMAT::ColumnVector > theDataArray

◆ operator>>()

istream& operator>> ( istream &  stream,
ossimLagrangeInterpolator interpolator 
)

Definition at line 148 of file ossimLagrangeInterpolator.cpp.

References ossimLagrangeInterpolator::theDataArray, ossimLagrangeInterpolator::theNormalizer, ossimLagrangeInterpolator::theNumElements, and ossimLagrangeInterpolator::theTeeArray.

149 {
150  // Start with ensuring we're at the right spot. Let it go a max of ten
151  // reads. If we go beyond that there's a problem...
152  string s;
153  int count = 0;
154  stream >> s;
155  while (s != "LAGRANGE_INTERP")
156  {
157  stream >> s;
158  ++count;
159  if (count == 10) break; // Avoid infinite loop...
160  }
161 
162  if (count == 10)
163  {
164  cerr << "ossimLagrangeInterpolator operator>> ERROR:"
165  << "\nStream seems to not contain LAGRANGE_INTERP header!"
166  << "\nReturning..." << endl;
167  return stream;
168  }
169 
170  ossim_uint32 numPoints;
171  stream >> numPoints >> interpolator.theNumElements;
172 
173  interpolator.theTeeArray.clear();
174  interpolator.theDataArray.clear();
175  interpolator.theNormalizer.clear();
176 
177  double tee, normalizer;
178  NEWMAT::ColumnVector v(3);
179  for (ossim_uint32 i=0; i<numPoints; i++)
180  {
181  stream >> tee >> v(0) >> v(1) >> v(2) >> normalizer;
182  if (!stream.fail())
183  {
184  interpolator.theTeeArray.push_back(tee);
185  interpolator.theDataArray.push_back(v);
186  interpolator.theNormalizer.push_back(normalizer);
187  }
188  }
189 
190  return stream;
191 }
unsigned int ossim_uint32
std::vector< double > theNormalizer
std::vector< NEWMAT::ColumnVector > theDataArray