OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimEcefPoint.cpp
Go to the documentation of this file.
1 //*****************************************************************************
2 // FILE: ossimEcefPoint.cpp
3 //
4 // License: See top level LICENSE.txt file.
5 //
6 // DESCRIPTION:
7 // Contains declaration of a 3D point object in the Earth-centered, earth
8 // fixed (ECEF) coordinate system.
9 //
10 // SOFTWARE HISTORY:
11 //>
12 // 08Aug2001 Oscar Kramer (http://www.oscarkramer.com)
13 // Initial coding.
14 //<
15 //*****************************************************************************
16 // $Id: ossimEcefPoint.cpp 11399 2007-07-26 13:39:54Z dburken $
17 
18 #include <ostream>
19 
21 #include <ossim/base/ossimGpt.h>
23 #include <ossim/base/ossimDpt3d.h>
24 #include <ossim/base/ossimDatum.h>
27 
28 //*****************************************************************************
29 // CONSTRUCTOR: ossimEcefPoint(const ossimGpt& convert_this)
30 //
31 //*****************************************************************************
33 {
34  if(!gpt.isHgtNan())
35  {
36  gpt.datum()->ellipsoid()->latLonHeightToXYZ(gpt.latd(),
37  gpt.lond(),
38  gpt.height(),
39  theData[0],
40  theData[1],
41  theData[2]);
42  }
43  else
44  {
45  gpt.datum()->ellipsoid()->latLonHeightToXYZ(gpt.latd(),
46  gpt.lond(),
47  0.0,
48  theData[0],
49  theData[1],
50  theData[2]);
51  }
52 }
53 
55  :theData(pt.x, pt.y, pt.z)
56 {
57 }
58 
59 //*****************************************************************************
60 // METHOD: ossimEcefPoint::operator-(ossimEcefPoint)
61 //*****************************************************************************
63 {
64  return ossimEcefVector(theData - p.theData);
65 }
66 
67 //*****************************************************************************
68 // METHOD: ossimEcefPoint::operator+(ossimEcefVector)
69 //*****************************************************************************
71 {
72  return ossimEcefPoint(theData + v.data());
73 }
74 
75 //*****************************************************************************
76 // METHOD: ossimEcefPoint::operator-(ossimEcefVector)
77 //*****************************************************************************
79 {
80  return ossimEcefPoint(theData - v.data());
81 }
82 
84 {
85  return theData.toString(precision);
86 }
87 
88 void ossimEcefPoint::toPoint(const std::string& s)
89 {
90  theData.toPoint(s);
91 }
92 
94 {
95  if(isNan())
96  {
97  os << "(ossimEcefPoint) " << "nan nan nan";
98  }
99 
100  os << "(ossimEcefPoint) " << theData;
101 }
102 
104 {
105  instance.print(os); return os;
106 }
ossim_uint32 x
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
ossim_uint32 y
std::ostream & operator<<(std::ostream &os, const ossimEcefPoint &instance)
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
void toPoint(const std::string &s)
Initializes this point from string.
bool isHgtNan() const
Definition: ossimGpt.h:143
void print(std::ostream &os=ossimNotify(ossimNotifyLevel_INFO)) const
const ossimDatum * datum() const
datum().
Definition: ossimGpt.h:196
unsigned int ossim_uint32
virtual const ossimEllipsoid * ellipsoid() const
Definition: ossimDatum.h:60
double height() const
Definition: ossimGpt.h:107
void latLonHeightToXYZ(double lat, double lon, double height, double &x, double &y, double &z) const
bool isNan() const
const ossimColumnVector3d & data() const
ossimString toString(ossim_uint32 precision=15) const
To string method.
ossimEcefVector operator-(const ossimEcefPoint &) const
ossimEcefPoint operator+(const ossimEcefVector &) const
void toPoint(const std::string &s)
Initializes this point from string.
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
ossimColumnVector3d theData
ossimString toString(ossim_uint32 precision=15) const
To string method.