35 static ossimTrace traceDebug(
"ossimElevManager:debug");
53 m_connectionString(value),
66 m_database = databsase;
67 m_stopTraversalFlag =
true;
111 result = elevDbList[idx]->getHeightAboveEllipsoid(gpt);
146 result = elevDbList[idx]->getHeightAboveMSL(gpt);
179 userDir = userDir.
dirCat(
"elevation");
180 installDir = installDir.
dirCat(
"elevation");
186 std::vector<ossimString> pathArray;
188 #if defined(WIN32) && !defined(CYGWIN) 194 paths.
split(pathArray, pathSeparator);
195 if(!pathArray.empty())
198 for(idx = 0; idx < pathArray.size(); ++idx)
216 if(!database && path.
isDir())
249 for(
ossim_uint32 idx = 0; idx < elevDbList.size(); ++idx)
267 std::vector<ossimFilename>& cells,
278 if ( cellDatabase.
valid() == false )
291 if ( cellDatabase.
valid() )
293 cellDatabase->
getCellsForBounds( minLat, minLon, maxLat, maxLon, cells, maxNumberOfCells );
306 std::vector<ossimFilename>& cells,
321 for (gpt.
lat=minLat; gpt.
lat<=maxLat; gpt.
lat+=DELTA_DEG)
323 for (gpt.
lon=minLon; gpt.
lon<=maxLon; gpt.
lon+=DELTA_DEG)
331 std::vector<ossimFilename> open_cells;
333 std::vector<ossimFilename>::iterator iter = open_cells.begin();
334 while ((iter != open_cells.end()) && (cells.size() < limitCells))
336 cells.push_back(*iter);
343 std::vector<ossimFilename>& cells,
351 std::vector<ElevationDatabaseListType>::iterator i =
m_dbRoundRobin.begin();
361 std::vector<ElevationDatabaseListType>::iterator rri =
m_dbRoundRobin.begin();
366 ossimElevManager::ElevationDatabaseListType::iterator i = elevDbList.begin();
367 while ( i != elevDbList.end() )
371 (*i)->accept( visitor );
387 for(
ossim_uint32 idx = 0;(idx < elevDbList.size()); ++idx)
403 for(
ossim_uint32 idx = 0;(idx < elevDbList.size()); ++idx)
434 <<
"DEBUG ossimElevManager::loadState: Entered..." 442 ossimString elevationOffset = kwl.
find(copyPrefix,
"elevation_offset");
443 ossimString defaultHeightAboveEllipsoid = kwl.
find(copyPrefix,
"default_height_above_ellipsoid");
449 if(!elevationOffset.
empty())
452 if(!defaultHeightAboveEllipsoid.
empty())
456 if(!elevRndRbnSize.
empty())
464 numThreads = elevRndRbnSize.
toUInt32();
465 numThreads = numThreads > 0 ? numThreads : 1;
472 long numberOfSources = (long)keys.size();
475 std::vector<int> theNumberList(numberOfSources);
476 for(idx = 0; idx < theNumberList.size();++idx)
480 theNumberList[idx] = numberStr.
toInt();
482 std::sort(theNumberList.begin(), theNumberList.end());
484 for(idx=0;idx < theNumberList.size();++idx)
492 <<
"DEBUG ossimElevManager::loadState:" 493 <<
"\nLooking for key: " << newPrefix
502 std::string key = newPrefix.
string();
505 std::string value = kwl.
findKey( key );
521 <<
"DEBUG ossimElevManager::loadState:" 522 <<
"\nadding elevation database: " 554 #ifdef DYNAMICALLY_ALLOCATE_ROUND_ROBIN 573 std::lock_guard<std::mutex> lock (
m_mutex);
584 ElevationDatabaseListType::iterator iter =
m_dbRoundRobin[0].begin();
608 std::vector<ElevationDatabaseListType>::iterator rri =
m_dbRoundRobin.begin();
609 if (std::find(rri->begin(), rri->end(), database) == rri->end())
612 rri->insert(rri->begin(), database);
614 rri->push_back(database);
622 rri->insert(rri->begin(), dupDb);
624 rri->push_back(dupDb);
636 for(
ossim_uint32 idx = 0;(idx < elevDbList.size()); ++idx)
638 double d_idx = elevDbList[idx]->getMeanSpacingMeters();
658 out<<
"\nm_dbRoundRobin["<<i<<
"].size = "<<
m_dbRoundRobin[i].size()<<endl;
661 out<<
"m_dbRoundRobin["<<i<<
"]["<<j<<
"] = ";
ossimElevationDatabase * getElevationDatabase()
virtual double getMeanSpacingMeters() const
Returns the mean post spacing (in meters) for the highest resolution DEM in the list or NaN if no DEM...
virtual bool isSourceEnabled() const
static ossimElevationDatabaseRegistry * instance()
virtual void accept(ossimVisitor &visitor)
We will add a visitor interface for all connectable objects.
ossim_float64 m_elevationOffset
virtual bool getAccuracyInfo(ossimElevationAccuracyInfo &info, const ossimGpt &gpt) const
virtual bool pointHasCoverage(const ossimGpt &) const
METHOD: pointHasCoverage(gpt) Returns TRUE if coverage exists over gpt:
void getOpenCellList(std::vector< ossimFilename > &list) const
virtual void visit(ossimObject *obj)
Represents serializable keyword/value map.
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
bool getFirst(ossimFilename &filename, int flags=OSSIM_DIR_DEFAULT)
ossimFilename getInstalledOssimSupportDir() const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
const char * find(const char *key) const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
double nan()
Method to return ieee floating point double precision NAN.
This code was derived from https://gist.github.com/mshockwave.
bool contains(char aChar) const
static ossimString toString(bool aValue)
Numeric to string methods.
bool m_useGeoidIfNullFlag
void loadStandardElevationPaths()
void split(std::vector< ossimString > &result, const ossimString &separatorList, bool skipBlankFields=false) const
Splits this string into a vector of strings (fields) using the delimiter list specified.
virtual ossimString getClassName() const
ossim_uint32 toUInt32() const
static ossimElevManager * instance()
METHOD: instance() Implements singelton pattern.
virtual std::ostream & print(std::ostream &out) const
Outputs theErrorStatus as an ossimErrorCode and an ossimString.
bool dbSort(ossimRefPtr< ossimElevationDatabase > a, ossimRefPtr< ossimElevationDatabase > b)
bool getNext(ossimFilename &filename) const
ossim_uint32 m_maxRoundRobinSize
void getCellsForBounds(const std::string &connectionString, const ossim_float64 &minLat, const ossim_float64 &minLon, const ossim_float64 &maxLat, const ossim_float64 &maxLon, std::vector< ossimFilename > &cells, ossim_uint32 maxNumberOfCells=0)
Gets a list of elevation cells needed to cover bounding box.
OSSIM_DLL ossim_uint32 getNumberOfThreads()
Get the number threads to use from ossimPreferences or ossim::Thread.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual double getMeanSpacingMeters() const
METHOD: meanSpacingMeters() This method returns the post spacing in the region of gpt: ...
ConnectionStringVisitor(const ossimString &value)
virtual std::ostream & print(std::ostream &out) const
Outputs theErrorStatus as an ossimErrorCode and an ossimString.
virtual double getHeightAboveEllipsoid(const ossimGpt &gpt)
bool toBool() const
String to numeric methods.
std::vector< ossimRefPtr< ossimElevationDatabase > > ElevationDatabaseListType
unsigned long long ossim_uint64
unsigned int ossim_uint32
const char * chars() const
For backward compatibility.
static ossimGeoidManager * instance()
Implements singelton pattern:
const ossimGpt & ul() const
void setRoundRobinMaxSize(ossim_uint32 size)
virtual ~ossimElevManager()
bool loadElevationPath(const ossimFilename &path, bool set_as_first=false)
Adds a new elevation file (or multiple files if path is a directory) to the collection.
bool getBoolKeywordValue(bool &rtn_val, const char *keyword, const char *prefix=0) const
[OLK, Aug/2008] Sets the boolean <rtn_val> depending on value associated with keyword for values = (y...
static const char * ENABLED_KW
std::mutex m_mutex
I have tried the readwrite lock interfaces but have found it unstable.
bool open(const ossimFilename &dir)
virtual void getOpenCellList(std::vector< ossimFilename > &list) const
std::vector< ossimString > getSubstringKeyList(const ossimString ®ularExpression) const
static ossimEnvironmentUtility * instance()
virtual double getHeightAboveMSL(const ossimGpt &gpt)
Height access methods:
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...
void getCellsForBounds(const ossim_float64 &minLat, const ossim_float64 &minLon, const ossim_float64 &maxLat, const ossim_float64 &maxLon, std::vector< ossimFilename > &cells, ossim_uint32 maxNumberOfCells=0)
Gets a list of elevation cells needed to cover bounding box.
bool stopTraversal() const
ossimString getEnvironmentVariable(const ossimString &variable) const
virtual ossimObject * dup() const =0
void addDatabase(ossimElevationDatabase *database, bool set_as_first=false)
Adds a new elevation database to the collection.
ossimFilename getUserOssimSupportDir() const
ossimElevationDatabase * open(const ossimString &connectionString)
ossim_float64 m_defaultHeightAboveEllipsoid
std::vector< ElevationDatabaseListType > m_dbRoundRobin
virtual double offsetFromEllipsoid(const ossimGpt &gpt)
static const char * FILENAME_KW
const ossimGpt & lr() const
ElevationDatabaseListType & getNextElevDbList() const
const ossimString & getConnectionString() const
ossimElevationDatabase * createDatabase(const ossimString &typeName) const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_uint32 m_currentDatabaseIdx
std::basic_ostream< char > ostream
Base class for char output streams.
const std::string & string() const
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.