bool ossimElevManager::loadElevationPath(const ossimFilename& path) { bool result = false; ossimElevationDatabase* database = ossimElevationDatabaseRegistry::instance()->open(path); if(!database&&path.isDir()) { ossimDirectory dir; if(dir.open(path)) { ossimFilename file; dir.getFirst(file, ossimDirectory::OSSIM_DIR_DIRS); do { database = ossimElevationDatabaseRegistry::instance()->open(file); if(database) { result = true; addDatabase(database); } }while(dir.getNext(file)); } } else if(database) { result = true; addDatabase(database); } return result; }
bool ossimDtedElevationDatabase::openDtedDirectory(const ossimFilename& dir) { if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimDtedElevationDatabase::open entered ...\n"; } bool result = dir.isDir(); if(result) { if ( !m_extension.size() ) { //--- // This sets extension by doing a directory scan and is now depricated. // Use "extension" key in preferences to avoid this. Example: // elevation_manager.elevation_source0.extension: dt2 //--- result = inititializeExtension( dir ); if ( !result && traceDebug() ) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimDtedElevationDatabase::open: WARNING " << "Scan for dted extension failed!\n" << "Can be set in ossim preferences. Example:\n" << "elevation_manager.elevation_source0.extension: .dt2"; } } // Set the geoid: if( !m_geoid.valid() ) { m_geoid = ossimGeoidManager::instance()->findGeoidByShortName("geoid1996", false); if(!m_geoid.valid()&&traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimDtedElevationDatabase::open: WARNING " << "Unable to load goeid grid 1996 for DTED database\n"; } } } if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimDtedElevationDatabase::open result:" << (result?"true":"false") << "\n"; } return result; }
bool ossimGeneralRasterElevationDatabase::openGeneralRasterDirectory(const ossimFilename& dir) { m_cellHandler = new ossimGeneralRasterElevHandler; bool foundOne = false; if(dir.exists()) { if(dir.isDir()) { ossimDirectory d(dir); ossimFilename file; ossim_uint32 maxCount = 10; // search at least the first 10 files to see if there are any here ossim_uint32 count = 0; if(d.getFirst(file)) { do { ++count; ossimString ext = file.ext(); ext = ext.downcase(); if(ext == "ras") { if(m_cellHandler->open(file, m_memoryMapCellsFlag)) { m_meanSpacing = m_cellHandler->getMeanSpacingMeters(); foundOne = true; } } } while(d.getNext(file) && (foundOne || (!foundOne && (count < maxCount)))); } } } if(!foundOne) { m_cellHandler = 0; } return m_cellHandler.valid(); }
bool ossimDtedElevationDatabase::openDtedDirectory(const ossimFilename& dir) { if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimDtedElevationDatabase::open entered ...\n"; } bool result = dir.isDir(); if(result) { ossim_uint32 count = 0; ossim_uint32 maxCount = 10; ossimDirectory od; result = od.open(dir); if(result) { result = false; ossimFilename f; // Get the first directory. od.getFirst(f, ossimDirectory::OSSIM_DIR_DIRS); do { ++count; // Must be a directory. if (f.isDir()) { // Discard any full path. ossimFilename fileOnly = f.file(); // Downcase it. fileOnly.downcase(); // Must start with 'e' or 'w'. bool foundCell = ( ((fileOnly.c_str()[0] == 'e') || ( fileOnly.c_str()[0] == 'w')) && (fileOnly.size() == 4)); if(foundCell) { ossim_uint32 maxCount2 = 10; ossim_uint32 count2 = 0; ossimDirectory d2; if(d2.open(f)) { d2.getFirst(f, ossimDirectory::OSSIM_DIR_FILES); do { ossimRefPtr<ossimDtedHandler> dtedHandler = new ossimDtedHandler(); if(dtedHandler->open(f, false)) { if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimDtedElevationDatabase::open: Found dted file " << f << "\n"; } result = true; m_extension = "."+f.ext(); m_connectionString = dir; m_meanSpacing = dtedHandler->getMeanSpacingMeters(); } dtedHandler->close(); dtedHandler = 0; ++count2; }while(!result&&d2.getNext(f)&&(count2 < maxCount2)); } } } }while(!result&&(od.getNext(f))&&(count < maxCount)); } } if(result) { if(!m_geoid.valid()) { m_geoid = ossimGeoidManager::instance()->findGeoidByShortName("geoid1996", false); } if(!m_geoid.valid()&&traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimDtedElevationDatabase::open: Unable to load goeid grid 1996 for DTED database\n"; } } if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimDtedElevationDatabase::open leaving ...\n"; } return result; }
bool isIgnoredFile(const ossimFilename& file) { bool status = false; if (trace) { cout << "file: " << file << endl; } if ( file.size() ) { ossimFilename f = file.file(); ossimFilename e = file.ext(); if ( ( f == ".moc" ) || ( f == ".svn" ) || ( f == "CMakeCache.txt" ) || ( f == "CMakeFiles" ) || ( f == "cmake_install.cmake" ) || ( f == "cmake_uninstall.cmake" ) || ( f == "CVS" ) || ( f == "doc" ) || ( f == ".cvsignore" ) || ( f == "bin" ) || ( f == "build" ) || ( f == "builds" ) || ( f == "configure") || ( f == "config.log" ) || ( f == "config.status") || ( f == "lib" ) || ( f == "Makefile" ) || ( f == "Makefile.common" ) || ( f == "make.out" ) || ( f == "projects") || ( f == "wxmac.icns") || ( f == "xcode" ) || ( e == "d" ) || // dot d file ( e == "o" ) || // object file ( e == "obj" ) || ( e == "exe" ) || ( e == "tmp" ) ) { status = true; } else if ( file.contains("apps") || file.contains("test") ) { if ( file.isDir() ) // Go into apps and test dir. { status = false; } else if ( (e != "h") && (e != "cpp") ) { // Ignore binary files. Only diff headers and source files. status = true; } } if ( file[file.size()-1] == '~' ) { status = true; // xemacs } } // if ( file.size() ) else { status = true; // empty } if ( trace && (status == true) ) { cout << "ignoring file: " << file << endl; } return status; }
bool ossimSrtmElevationDatabase::openSrtmDirectory(const ossimFilename& dir) { if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimSrtmElevationDatabase::open: Entered....\n"; } if(!m_geoid.valid()) { m_geoid = ossimGeoidManager::instance()->findGeoidByShortName("geoid1996", false); } //--- // Sample format: // dir // | | // N35W121.hgt N35W121.hgt //--- ossim_uint32 count = 0; ossim_uint32 maxCount = 25; if (!dir.isDir()) { if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimSrtmElevationDatabase::open: Not a directory, leaving ... " << dir << "\n"; } return false; } ossimDirectory od(dir); if (od.isOpened() == false) { if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimSrtmElevationDatabase::open: Unable to open directory " << dir << ", Leaving ... \n"; } return false; } ossimFilename f; //ossimSrtmSupportData sd; ossimRefPtr<ossimSrtmHandler> handler = new ossimSrtmHandler; if(od.getFirst(f, ossimDirectory::OSSIM_DIR_FILES)) { do { ++count; if(handler->open(f)) { m_meanSpacing = handler->getMeanSpacingMeters(); if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimSrtmElevationDatabase::open: Found file " << f << "\n"; if(!m_geoid.valid()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimSrtmElevationDatabase::open: Unable to load goeid grid 1996 for SRTM database\n"; } } return true; } }while((od.getNext(f)) &&(count < maxCount)); } if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimSrtmElevationDatabase::open: Leaving ... \n"; } return false; }