20 static ossimTrace traceDebug (
"ossimGeoidEgm96:debug");
23 #define NumbGeoidCols 1441 24 #define NumbGeoidRows 721 25 #define NumbHeaderItems 6 27 #define NumbGeoidElevs NumbGeoidCols * NumbGeoidRows 34 :theGeoidHeightBufferPtr(0)
40 :theGeoidHeightBufferPtr(0)
61 static const char MODULE[] =
"ossimGeoidEgm96::open";
75 long ElevationsRead = 0;
80 if (grid_file.
isDir())
82 grid = grid_file.
dirCat(
"egm96.grd");
94 if ( gridHeightFile.fail())
99 << grid.
c_str() <<
"\n";
111 gridHeightFile.read( (
char*)(&f), 4);
112 if (swap_bytes) oe.
swap(f);
123 gridHeightFile.fail())
128 << grid.
c_str() <<
"\n";
142 gridHeightFile.read( (
char*)(&f), 4);
143 if (swap_bytes) oe.
swap(f);
157 "Bad grid file...%s", grid.
c_str());
164 <<
"Opened geoid grid: " << grid.
c_str() << std::endl;
184 <<
"ossimGeoidEgm96::offsetFromEllipsoid, " 185 <<
"Object not initialized!\n";
192 double DeltaX, DeltaY;
193 double ElevationSE, ElevationSW, ElevationNE, ElevationNW;
194 double LatitudeDD, LongitudeDD;
195 double OffsetX, OffsetY;
197 double UpperY, LowerY;
199 LatitudeDD = savedGpt.
latd();
202 if (LatitudeDD < -90.0)
204 LatitudeDD = -180.0 - LatitudeDD;
206 else if (LatitudeDD > 90.0)
208 LatitudeDD = 180.0 - LatitudeDD;
211 if ( (LatitudeDD < -90.0) || LatitudeDD > 90.0)
217 <<
"FATAL: " <<
"ossimGeoidEgm96::offsetFromEllipsoid, " 218 <<
"Point out of range: " << savedGpt <<
"\n";
223 LongitudeDD = savedGpt.
lond();
226 if (LongitudeDD < -180)
228 LongitudeDD = LongitudeDD + 360.0;
230 else if (LongitudeDD > 180.0)
232 LongitudeDD = LongitudeDD - 360.0;
235 if ( (LongitudeDD < -180.0) || (LongitudeDD > 180.0) )
241 <<
"FATAL: " <<
"ossimGeoidEgm96::offsetFromEllipsoid, " 242 <<
"Point out of range: " << savedGpt <<
"\n";
249 if (LongitudeDD < 0.0)
264 PostX = floor( OffsetX );
267 PostY = floor( OffsetY );
280 DeltaX = OffsetX - PostX;
281 DeltaY = OffsetY - PostY;
283 UpperY = ElevationNW + DeltaX * ( ElevationNE - ElevationNW );
284 LowerY = ElevationSW + DeltaX * ( ElevationSE - ElevationSW );
286 offset = UpperY + DeltaY * ( LowerY - UpperY );
299 height += geoidHeight;
306 double ellipsoidHeight)
312 return (ellipsoidHeight - height);
OSSIMDLLEXPORT void ossimSetError(const char *className, ossim_int32 error, const char *fmtString=0,...)
double lond() const
Will convert the radian measure to degrees.
static const ossimErrorCode OSSIM_OK
std::basic_ifstream< char > ifstream
Class for char input file streams.
bool almostEqual(T x, T y, T tolerance=FLT_EPSILON)
double nan()
Method to return ieee floating point double precision NAN.
OSSIM_DLL ossimByteOrder byteOrder()
static const ossimErrorCode OSSIM_ERROR
virtual double offsetFromEllipsoid(const ossimGpt &gpt)
double latd() const
Will convert the radian measure to degrees.
virtual ossimString getShortName() const
void changeDatum(const ossimDatum *datum)
This will actually perform a shift.
virtual ~ossimGeoidEgm96()
static ossimDatumFactory * instance()
std::vector< float > theGeoidHeightBuffer
virtual ossimErrorCode getErrorStatus() const
double geoidToEllipsoidHeight(double lat, double lon, double geoidHeight)
virtual void setErrorStatus() const
ossimFilename dirCat(const ossimFilename &file) const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
double ellipsoidToGeoidHeight(double lat, double lon, double ellipsoidHeight)
#define RTTI_DEF1(cls, name, b1)
float * theGeoidHeightBufferPtr
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
virtual bool open(const ossimFilename &grid_file, ossimByteOrder byteOrder=OSSIM_BIG_ENDIAN)
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.