29 #include <ossim/base/ossimTrace.h> 30 static ossimTrace traceExec (
"ossimDtedHandler:exec");
31 static ossimTrace traceDebug (
"ossimDtedHandler:debug");
33 static const char ENABLE_STATS_KW[] =
"elevation.compute_statistics.enabled";
42 m_dtedRecordSizeInBytes(0),
46 m_offsetToFirstDataRecord(0),
50 m_swapBytesFlag(false)
53 static const char MODULE[] =
"ossimDtedHandler (Filename) Constructor";
57 <<
"DEBUG " << MODULE <<
": entering..." << std::endl;
64 if (!
open(dted_file, memoryMapFlag))
71 <<
"FATAL " << MODULE <<
": " 72 <<
"\nCould not open file: " << dted_file.
c_str()
73 <<
"\nReturning..." << std::endl;
75 <<
"DEBUG " << MODULE <<
": returning with error..." << std::endl;
84 <<
"DEBUG " << MODULE <<
": Loading dted file: " << dted_file
93 <<
"DEBUG " << MODULE <<
": returning..." << std::endl;
132 std::string connectionString = file.
c_str();
134 createIstream( file.
c_str(), std::ios_base::in|std::ios_base::binary);
135 if(!str)
return false;
136 return open(str, connectionString, memoryMapFlag);
140 const std::string& connectionString,
143 static const char* MODULE =
"ossimDtedHandler::open";
145 if(!fileStr)
return false;
147 m_vol = std::make_shared<ossimDtedVol>();
148 m_hdr = std::make_shared<ossimDtedHdr>();
149 m_uhl = std::make_shared<ossimDtedUhl>();
150 m_dsi = std::make_shared<ossimDtedDsi>();
151 m_acc = std::make_shared<ossimDtedAcc>();
180 <<
"DEBUG " << MODULE <<
": " 182 <<
"\nPossibly not a dted file." 230 double south_boundary =
m_uhl->latOrigin();
231 double west_boundary =
m_uhl->lonOrigin();
237 ossimGpt(south_boundary, east_boundary, 0.0));
245 double center_lat = (south_boundary + north_boundary)/2.0;
273 int x0 =
static_cast<int>(xi);
274 int y0 =
static_cast<int>(yi);
289 if ( xi < 0.0 || yi < 0.0 ||
334 double wx1 = xi - x0;
335 double wy1 = yi - y0;
336 double wx0 = 1.0 - wx1;
337 double wy0 = 1.0 - wy1;
361 m_fileStr->seekg( offset, std::ios::beg );
389 static const char MODULE[] =
"ossimDtedHandler::getPostValue";
392 if ( gridPt.
x < 0.0 || gridPt.
y < 0.0 ||
399 <<
"WARNING " << MODULE <<
": No intersection..." << std::endl;
436 <<
"DEBUG ossimDtedHandler::gatherStatistics(): Looking for " 437 << stats_file <<
" statistics file..." << std::endl;
441 const char* min_str = NULL;
442 const char* max_str = NULL;
454 if (min_str && max_str)
464 <<
"NOTICE ossimDtedHandler::gatherStatistics():" 465 <<
" scanning for min/max" 466 <<
"\nThis may take a while..." << std::endl;
515 <<
"DEBUG ossimDtedHandler::gatherStatistics:" 564 double sum_weights = 0;
565 double sum_posts = 0;
568 if ( m_posts[i].m_height ==
NULL_POST || !m_posts[i].m_status )
570 m_posts[i].m_weight = 0.0;
576 sum_weights += m_posts[i].m_weight;
577 sum_posts += m_posts[i].m_height * m_posts[i].m_weight;
581 return sum_posts / sum_weights;
588 cout <<
"\np00: " << m_posts[0].m_height
589 <<
"\np01: " << m_posts[1].m_height
590 <<
"\np10: " << m_posts[2].m_height
591 <<
"\np11: " << m_posts[3].m_height
592 <<
"\nw00: " << m_posts[0].m_weight
593 <<
"\nw01: " << m_posts[1].m_weight
594 <<
"\nw10: " << m_posts[2].m_weight
595 <<
"\nw11: " << m_posts[3].m_weight
596 <<
"\ns00: " << m_posts[0].m_status
597 <<
"\ns01: " << m_posts[1].m_status
598 <<
"\ns10: " << m_posts[2].m_status
599 <<
"\ns11: " << m_posts[3].m_status
static const char * MIN_VALUE_KW
DtedHeight()
DtedHeight methods.
virtual bool open(const ossimFilename &file, bool memoryMapFlag=false)
opens a cell
std::shared_ptr< ossimDtedVol > m_vol
ossimString m_surfaceName
virtual double getPostValue(const ossimIpt &gridPt) const
ossimString edition() const
void readPostsFromFile(DtedHeight &postData, int offset)
read the height posts from the File
ossimString m_productLevel
Represents serializable keyword/value map.
bool addFile(const char *file)
double theNullHeightValue
const char * find(const char *key) const
ossim_int64 fileSize() const
bool hasValidAbsoluteError() const
double theMinHeightAboveMSL
Data members:
double nan()
Method to return ieee floating point double precision NAN.
std::shared_ptr< ossimDtedUhl > m_uhl
static const char * MAX_VALUE_KW
ossim_int32 m_numLonLines
virtual bool getAccuracyInfo(ossimElevationAccuracyInfo &info, const ossimGpt &gpt) const
OSSIM_DLL ossimByteOrder byteOrder()
static const ossimErrorCode OSSIM_ERROR
static StreamFactoryRegistry * instance()
std::vector< ossim_uint8 > m_memoryMap
unsigned short ossim_uint16
virtual bool write(const char *file, const char *comment=0) const
Methods to dump the ossimKeywordlist to a file on disk.
static const int NUM_POSTS_PER_BLOCK
ossimString productLevel() const
static const int TOTAL_POSTS
std::shared_ptr< ossimDtedHdr > m_hdr
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
std::shared_ptr< ossimDtedDsi > m_dsi
virtual bool isOpen() const
std::mutex m_fileStrMutex
DtedHeight is a class for storing DTED information.
ossimString m_compilationDate
signed short ossim_sint16
std::shared_ptr< ossim::istream > m_fileStr
ossimFilename theFilename
Virtual method for reading.
the DTED handler is an elevation source that allows for handling of a single cell of data...
ossimErrorCode theErrorStatus
virtual ~DtedPost()
DtedPost methods.
ossim_int32 m_numLatPoints
ossim_sint16 convertSignedMagnitude(ossim_uint16 &s) const
ossim_int32 m_offsetToFirstDataRecord
ossim_int32 m_dtedRecordSizeInBytes
ossimString compilationDate() const
std::shared_ptr< ossimDtedAcc > m_acc
virtual double getHeightAboveMSL(const ossimGpt &gpt)
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
const ossimDtedHandler & operator=(const ossimDtedHandler &rhs)
virtual ossimIpt getSizeOfElevCell() const
ossimDpt metersPerDegree() const
DtedPost m_posts[TOTAL_POSTS]
double theMaxHeightAboveMSL
#define RTTI_DEF1(cls, name, b1)
virtual ~ossimDtedHandler()
ossimDtedHandler()
Constructor.
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
std::string m_connectionString
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)