OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Functions
ossimTDpt.cpp File Reference
#include <iostream>
#include <iomanip>
#include <ossim/base/ossimTDpt.h>
#include <ossim/base/ossimString.h>

Go to the source code of this file.

Functions

std::ostream & operator<< (std::ostream &os, const ossimTDpt &pt)
 
std::istream & operator>> (std::istream &is, ossimTDpt &pt)
 

Function Documentation

◆ operator<<()

std::ostream& operator<< ( std::ostream &  os,
const ossimTDpt pt 
)

Definition at line 42 of file ossimTDpt.cpp.

References ossimTDpt::print().

43 {
44  return pt.print(os);
45 }
std::ostream & print(std::ostream &os) const
Definition: ossimTDpt.cpp:9

◆ operator>>()

std::istream& operator>> ( std::istream &  is,
ossimTDpt pt 
)

Expected format: ( ( ossimDpt ), ( ossimDpt ), 0.50000000000000 ) –*this-— , -—tie--—, —score-----—

Definition at line 47 of file ossimTDpt.cpp.

References ossimTDpt::makeNan(), ossim::nan(), ossimTDpt::score, and ossimTDpt::tie.

48 {
49  //---
50  // Expected input format:
51  // ( (ossimDPt), (ossimDpt), score )
52  // score is real or nan
53  //---
54 
55  // Start with a nan point.
56  pt.makeNan();
57  // Check the stream.
58  if (!is) return is;
59 
60  ossimString tempString;
61 
62  // Gobble the "(".
63  is >> tempString;
64 
65  //get the first point
66  is>>dynamic_cast<ossimDpt&>(pt);
67 
68  // Eat the ",".
69  char c;
70  is.get(c);
71 
72  //get the second point
73  is>>pt.tie;
74 
75  // Eat the second ",".
76  is.get(c);
77 
78  // Get the score
79  const int SZ = 64; // real number buffer size
80  char tempChars[SZ];
81  is.get(tempChars, SZ, ',');
82  if (!is) return is;
83  tempChars[SZ-1] = '\0';
84  tempString = tempChars;
85  tempString.trim();
86  if (tempString == "nan")
87  {
88  pt.score = ossim::nan();
89  }
90  else
91  {
92  pt.score = tempString.toDouble();
93  }
94 
95  // Gobble the trailing ")".
96  is >> tempString;
97 
98  // Finished
99  return is;
100 }
ossimDpt tie
Definition: ossimTDpt.h:74
ossim_float64 score
Definition: ossimTDpt.h:75
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
void makeNan()
Definition: ossimTDpt.h:38