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

#include <ossimGeoidNgs.h>

Inheritance diagram for ossimGeoidNgs:
ossimGeoid ossimObject ossimErrorStatusInterface ossimReferenced

Public Member Functions

 ossimGeoidNgs ()
 
 ossimGeoidNgs (const ossimFilename &dir, ossimByteOrder byteOrder=OSSIM_LITTLE_ENDIAN)
 
virtual ~ossimGeoidNgs ()
 
virtual ossimString getShortName () const
 
virtual bool open (const ossimFilename &dir, ossimByteOrder byteOrder=OSSIM_LITTLE_ENDIAN)
 
virtual bool addFile (const ossimFilename &file, ossimByteOrder byteOrder=OSSIM_LITTLE_ENDIAN)
 
virtual double offsetFromEllipsoid (const ossimGpt &)
 
double geoidToEllipsoidHeight (double lat, double lon, double geoidHeight) const
 
double ellipsoidToGeoidHeight (double lat, double lon, double ellipsoidHeight) const
 
- Public Member Functions inherited from ossimGeoid
 ossimGeoid ()
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getLongName () const
 
virtual ossimString getDescription () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual std::ostream & print (std::ostream &out) const
 Generic print method. More...
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
virtual void accept (ossimVisitor &visitor)
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- 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...
 

Protected Member Functions

void fixLatLon (double &lat, double &lon) const
 
double deltaHeight (double lat, double lon) const
 
- Protected Member Functions inherited from ossimGeoid
virtual ~ossimGeoid ()
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Protected Attributes

std::vector< ossimGeoidNgsHeadertheGridVector
 
ossimString theShortName
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 

Detailed Description

Definition at line 17 of file ossimGeoidNgs.h.

Constructor & Destructor Documentation

◆ ossimGeoidNgs() [1/2]

ossimGeoidNgs::ossimGeoidNgs ( )

Definition at line 30 of file ossimGeoidNgs.cpp.

31  :theShortName("")
32 {
33 }
ossimString theShortName
Definition: ossimGeoidNgs.h:59

◆ ossimGeoidNgs() [2/2]

ossimGeoidNgs::ossimGeoidNgs ( const ossimFilename dir,
ossimByteOrder  byteOrder = OSSIM_LITTLE_ENDIAN 
)

Definition at line 35 of file ossimGeoidNgs.cpp.

References open().

37 {
38  open(dir);
39 }
virtual bool open(const ossimFilename &dir, ossimByteOrder byteOrder=OSSIM_LITTLE_ENDIAN)

◆ ~ossimGeoidNgs()

ossimGeoidNgs::~ossimGeoidNgs ( )
virtual

Definition at line 169 of file ossimGeoidNgs.cpp.

170 {
171 }

Member Function Documentation

◆ addFile()

bool ossimGeoidNgs::addFile ( const ossimFilename file,
ossimByteOrder  byteOrder = OSSIM_LITTLE_ENDIAN 
)
virtual

Definition at line 174 of file ossimGeoidNgs.cpp.

References ossim::byteOrder(), ossimFilename::exists(), ossimGeoidNgsHeader::initialize(), and theGridVector.

Referenced by open().

175 {
176  bool result = false;
177  if(file.exists())
178  {
179  ossim_uint32 idx = 0;
180  for(idx = 0; idx < theGridVector.size();++idx)
181  {
182  if(file == theGridVector[idx].filename())
183  {
184  result = true;
185  return result;
186  }
187  }
189  result = h.initialize(file, byteOrder);
190  if(result)
191  {
192  theGridVector.push_back(h);
193  }
194  }
195 
196  if(traceDebug())
197  {
198  ossimNotify(ossimNotifyLevel_DEBUG) << "ossimGeoidNgs::addFile: Adding file = " << file << std::endl;
199  }
200  return result;
201 }
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
std::vector< ossimGeoidNgsHeader > theGridVector
Definition: ossimGeoidNgs.h:58
bool exists() const
unsigned int ossim_uint32
bool initialize(const ossimFilename &fileName, ossimByteOrder byteOrder=OSSIM_LITTLE_ENDIAN)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ deltaHeight()

double ossimGeoidNgs::deltaHeight ( double  lat,
double  lon 
) const
protected

Definition at line 257 of file ossimGeoidNgs.cpp.

References ossim::nan(), and theGridVector.

Referenced by ellipsoidToGeoidHeight(), geoidToEllipsoidHeight(), and offsetFromEllipsoid().

258 {
259  ossim_uint32 idx = 0;
260  for(idx = 0; idx < theGridVector.size();++idx)
261  {
262  if( theGridVector[idx].pointWithin(lat, lon) )
263  {
264  return theGridVector[idx].getHeightDelta(lat,
265  lon);
266  }
267  }
268  return ossim::nan();
269 }
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
std::vector< ossimGeoidNgsHeader > theGridVector
Definition: ossimGeoidNgs.h:58
unsigned int ossim_uint32

◆ ellipsoidToGeoidHeight()

double ossimGeoidNgs::ellipsoidToGeoidHeight ( double  lat,
double  lon,
double  ellipsoidHeight 
) const
Returns
Ellipsoid to geoid height or ossim::nan() if grid does not contain the point.

Definition at line 231 of file ossimGeoidNgs.cpp.

References deltaHeight(), fixLatLon(), and ossim::isnan().

234 {
235 
236  fixLatLon(lat, lon);
237  double delta = deltaHeight(lat, lon);
238  if (!ossim::isnan(delta))
239  {
240  return (ellipsoidHeight - delta);
241  }
242  return delta; // nan
243 }
void fixLatLon(double &lat, double &lon) const
double deltaHeight(double lat, double lon) const
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ fixLatLon()

void ossimGeoidNgs::fixLatLon ( double &  lat,
double &  lon 
) const
protected

Definition at line 245 of file ossimGeoidNgs.cpp.

Referenced by ellipsoidToGeoidHeight(), geoidToEllipsoidHeight(), and offsetFromEllipsoid().

246 {
247  if(lat < 0)
248  {
249  lat += 180;
250  }
251  if(lon < 0)
252  {
253  lon += 360;
254  }
255 }

◆ geoidToEllipsoidHeight()

double ossimGeoidNgs::geoidToEllipsoidHeight ( double  lat,
double  lon,
double  geoidHeight 
) const
Returns
Geoid to ellipsoid height or ossim::nan() if grid does not contain the point.

Definition at line 217 of file ossimGeoidNgs.cpp.

References deltaHeight(), fixLatLon(), and ossim::isnan().

220 {
221 
222  fixLatLon(lat, lon);
223  double delta = deltaHeight(lat, lon);
224  if (!ossim::isnan(delta))
225  {
226  return (geoidHeight + delta);
227  }
228  return delta; // nan
229 }
void fixLatLon(double &lat, double &lon) const
double deltaHeight(double lat, double lon) const
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ getShortName()

ossimString ossimGeoidNgs::getShortName ( ) const
virtual

Reimplemented from ossimObject.

Definition at line 271 of file ossimGeoidNgs.cpp.

References theShortName.

272 {
273  return theShortName;
274 }
ossimString theShortName
Definition: ossimGeoidNgs.h:59

◆ offsetFromEllipsoid()

double ossimGeoidNgs::offsetFromEllipsoid ( const ossimGpt gpt)
virtual
Returns
The offset from the ellipsoid to the geoid or ossim::nan() if grid does not contain the point.

Implements ossimGeoid.

Definition at line 203 of file ossimGeoidNgs.cpp.

References ossimGpt::changeDatum(), deltaHeight(), fixLatLon(), ossimDatumFactory::instance(), ossimGpt::latd(), and ossimGpt::lond().

204 {
205  ossimGpt savedGpt = gpt;
206  if(ossimDatumFactory::instance()->wgs84())
207  {
208  savedGpt.changeDatum(ossimDatumFactory::instance()->wgs84());
209  }
210  double lat = savedGpt.latd();
211  double lon = savedGpt.lond();
212  fixLatLon(lat, lon);
213 
214  return deltaHeight(lat, lon);
215 }
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
void changeDatum(const ossimDatum *datum)
This will actually perform a shift.
Definition: ossimGpt.cpp:316
static ossimDatumFactory * instance()
void fixLatLon(double &lat, double &lon) const
double deltaHeight(double lat, double lon) const

◆ open()

bool ossimGeoidNgs::open ( const ossimFilename dir,
ossimByteOrder  byteOrder = OSSIM_LITTLE_ENDIAN 
)
virtual

Implements ossimGeoid.

Definition at line 42 of file ossimGeoidNgs.cpp.

References addFile(), ossim::byteOrder(), ossimFilename::dirCat(), ossimFilename::exists(), ossimFilename::isDir(), and theShortName.

Referenced by ossimGeoidNgs().

44 {
45  if (!dir.isDir())
46  {
47  return false;
48  }
49 
50  if(dir.isDir())
51  {
53 
54  if(dir.dirCat("g2003u01.bin").exists())
55  {
56  theShortName = "geoid2003";
57  addFile(dir.dirCat("g2003u01.bin"), byteOrder);
58  }
59  if(dir.dirCat("g2003u02.bin").exists())
60  {
61  theShortName = "geoid2003";
62  addFile(dir.dirCat("g2003u02.bin"), byteOrder);
63  }
64  if(dir.dirCat("g2003u03.bin").exists())
65  {
66  theShortName = "geoid2003";
67  addFile(dir.dirCat("g2003u03.bin"), byteOrder);
68  }
69  if(dir.dirCat("g2003u04.bin").exists())
70  {
71  theShortName = "geoid2003";
72  addFile(dir.dirCat("g2003u04.bin"), byteOrder);
73  }
74  if(dir.dirCat("g2003u05.bin").exists())
75  {
76  theShortName = "geoid2003";
77  addFile(dir.dirCat("g2003u05.bin"), byteOrder);
78  }
79  if(dir.dirCat("g2003u06.bin").exists())
80  {
81  theShortName = "geoid2003";
82  addFile(dir.dirCat("g2003u06.bin"), byteOrder);
83  }
84 
85  if(dir.dirCat("g1999u01.bin").exists())
86  {
87  theShortName = "geoid1999";
88  addFile(dir.dirCat("g1999u01.bin"), byteOrder);
89  }
90  if(dir.dirCat("g1999u02.bin").exists())
91  {
92  theShortName = "geoid1999";
93  addFile(dir.dirCat("g1999u02.bin"), byteOrder);
94  }
95  if(dir.dirCat("g1999u03.bin").exists())
96  {
97  theShortName = "geoid1999";
98  addFile(dir.dirCat("g1999u03.bin"), byteOrder);
99  }
100  if(dir.dirCat("g1999u04.bin").exists())
101  {
102  theShortName = "geoid1999";
103  addFile(dir.dirCat("g1999u04.bin"), byteOrder);
104  }
105  if(dir.dirCat("g1999u05.bin").exists())
106  {
107  theShortName = "geoid1999";
108  addFile(dir.dirCat("g1999u05.bin"), byteOrder);
109  }
110  if(dir.dirCat("g1999u06.bin").exists())
111  {
112  theShortName = "geoid1999";
113  addFile(dir.dirCat("g1999u06.bin"), byteOrder);
114  }
115  if(dir.dirCat("g1999u07.bin").exists())
116  {
117  theShortName = "geoid1999";
118  addFile(dir.dirCat("g1999u07.bin"), byteOrder);
119  }
120  if(dir.dirCat("g1999u08.bin").exists())
121  {
122  theShortName = "geoid1999";
123  addFile(dir.dirCat("g1999u08.bin"), byteOrder);
124  }
125  if(dir.dirCat("g1999a01.bin").exists())
126  {
127  theShortName = "geoid1999";
128  addFile(dir.dirCat("g1999a01.bin"), byteOrder);
129  }
130  if(dir.dirCat("g1999a02.bin").exists())
131  {
132  theShortName = "geoid1999";
133  addFile(dir.dirCat("g1999a02.bin"), byteOrder);
134  }
135  if(dir.dirCat("g1999a03.bin").exists())
136  {
137  theShortName = "geoid1999";
138  addFile(dir.dirCat("g1999a03.bin"), byteOrder);
139  }
140  if(dir.dirCat("g1999a04.bin").exists())
141  {
142  theShortName = "geoid1999";
143  addFile(dir.dirCat("g1999a04.bin"), byteOrder);
144  }
145  if(dir.dirCat("g1999h01.bin"))
146  {
147  theShortName = "geoid1999";
148  addFile(dir.dirCat("g1999h01.bin"), byteOrder);
149  }
150  if(dir.dirCat("g1999p01.bin").exists())
151  {
152  theShortName = "geoid1999";
153  addFile(dir.dirCat("g1999p01.bin"), byteOrder);
154  }
155  }
156  else
157  {
158  addFile(dir, byteOrder);
159  }
160  if (traceDebug())
161  {
163  << "Opened geoid grids from: " << dir.c_str() << endl;
164  }
165 
166  return true;
167 }
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
bool isDir() const
bool exists() const
ossimString theShortName
Definition: ossimGeoidNgs.h:59
virtual bool addFile(const ossimFilename &file, ossimByteOrder byteOrder=OSSIM_LITTLE_ENDIAN)
ossimFilename dirCat(const ossimFilename &file) const
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
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

Member Data Documentation

◆ theGridVector

std::vector<ossimGeoidNgsHeader> ossimGeoidNgs::theGridVector
protected

Definition at line 58 of file ossimGeoidNgs.h.

Referenced by addFile(), and deltaHeight().

◆ theShortName

ossimString ossimGeoidNgs::theShortName
protected

Definition at line 59 of file ossimGeoidNgs.h.

Referenced by getShortName(), and open().


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