bool ossimplugins::ossimRadarSat2TiffReader::open(const ossimFilename& file) { static const char MODULE[] = "ossimplugins::ossimRadarSat2TiffReader::open"; if (traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n" << "file: " << file << "\n"; } bool result = false; if ( isOpen() ) { close(); } // Check extension to see if it's xml. if ( file.ext().downcase() == "xml" ) { ossimXmlDocument* xdoc = new ossimXmlDocument(); if ( xdoc->openFile(file) ) { // See if it's a TerraSAR-X product xml file. if ( isRadarSat2ProductFile(xdoc) ) { ossimString s; ossimRadarSat2ProductDoc helper; if ( helper.getImageFile(xdoc, s) ) { ossimFilename imageFile = file.expand().path(); imageFile = imageFile.dirCat(s); setFilename(imageFile); result = ossimTiffTileSource::open(); if (result) { theProductXmlFile = file; completeOpen(); } } } } delete xdoc; xdoc = 0; } // matches: if ( file.ext().downcase() == "xml" ) if (traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " exit status = " << (result?"true":"false\n") << std::endl; } return result; }
bool ossimGeoPdfReaderFactory::hasExcludedExtension( const ossimFilename& file) const { bool result = true; ossimString ext = file.ext().downcase(); if (ext == "pdf") //only include the file with .pdf extension and exclude any other files { result = false; } return result; }
bool ossimHdfReaderFactory::hasExcludedExtension( const ossimFilename& file) const { bool result = true; ossimString ext = file.ext().downcase(); //only include the file with those extension and exclude any other files if ( ext == "hdf" || ext == "h4" || ext == "hdf4" || ext == "he4" || ext == "hdf5" || ext == "he5" || ext == "h5" || ext == "l1r") { result = false; } return result; }
bool ossimOpjReaderFactory::hasExcludedExtension( const ossimFilename& file) const { bool result = false; ossimString ext = file.ext().downcase(); if ( (ext == "tif") || (ext == "tiff") || (ext == "jpg") || (ext == "jpeg") || (ext == "png") ) { result = true; } return result; }
bool ossimTileMapModel::open(const ossimFilename& file) { static const char MODULE[] = "ossimTileMapModel::open"; ossimString os = file.beforePos(4); if (traceDebug()) { CLOG << " Entered..." << std::endl << " trying to open file " << file << std::endl; } if(os == "http" || file.ext() == "otb") { return true; } return false; }
ossimRefPtr<ossimNitfRsmModel> getModel( const ossimFilename& file ) { ossimRefPtr<ossimNitfRsmModel> result = 0; if ( file.size() ) { // Get downcased extension: std::string ext = file.ext().downcase().string(); if ( ext == "ext" ) { result = getModelFromExtFile( file ); } else if ( ( ext == "ntf" ) || ( ext == "nitf" ) ) { result = getModelFromImage( file ); } } return result; }
ossimRefPtr<ossimImageHandler> ossimImageHandlerRegistry::openBySuffix(const ossimFilename& file, bool openOverview)const { std::vector<ossimRefPtr<ossimImageHandler> > handlers; getImageHandlersBySuffix(handlers, file.ext()); ossim_uint32 idx = 0; ossim_uint32 size = (ossim_uint32) handlers.size(); for(idx = 0; idx < size; ++idx) { handlers[idx]->setOpenOverviewFlag(openOverview); if(handlers[idx]->open(file)) { return handlers[idx]; } } return ossimRefPtr<ossimImageHandler>(0); }
bool ossimAuxFileHandler::isAuxFile(const ossimFilename& file) { bool result = false; if ( file.exists() ) { ossimString ext = file.ext(); ext.downcase(); if (ext == "aux") { result = true; } else { result = false; } } return result; }
bool ossimplugins::ossimRadarSat2TiffReader::isRadarSat2ProductFile( const ossimFilename& file) const { bool result = false; // Check extension to see if it's xml. if ( file.ext().downcase() == "xml" ) { ossimXmlDocument* xdoc = new ossimXmlDocument(); if ( xdoc->openFile(file) ) { result = isRadarSat2ProductFile(xdoc); } delete xdoc; xdoc = 0; } return result; }
void ossimGeneralRasterElevHandler::initializeList(const ossimFilename& file) { close(); theFilename = file; theBoundingRectInfoList.clear(); if(theFilename.exists()) { if(theFilename.isDir()) { ossimDirectory dir(theFilename); ossimFilename file; ossim_uint32 maxCount = 10; ossim_uint32 count = 0; bool foundOne = false; if(dir.getFirst(file)) { do { ++count; ossimString ext = file.ext(); ext = ext.downcase(); if(ext == "ras") { ossimGeneralRasterElevHandler::BoundingRectInfo info; if(initializeInfo(info, file)) { foundOne = true; addInfo(info); } } } while(dir.getNext(file) && (!foundOne && (count < maxCount))); } #if 0 std::vector<ossimFilename> result; dir.findAllFilesThatMatch(result, ".*\\.ras"); if(result.size()) { ossimGeneralRasterElevHandler::BoundingRectInfo info; ossim_uint32 idx = 0; for(idx = 0; idx < result.size(); ++idx) { if(initializeInfo(info, ossimFilename(result[idx]))) { addInfo(info); } } } #endif if(theBoundingRectInfoList.size()>0) { theNullHeightValue = theBoundingRectInfoList[0].theNullHeightValue; } } else { ossimGeneralRasterElevHandler::BoundingRectInfo info; if(initializeInfo(info, theFilename)) { addInfo(info); } } } }
bool ossimHdfInfo::open(const ossimFilename& file) { static const char MODULE[] = "ossimHdfInfo::open"; if (traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n" << "file: " << file << "\n"; } bool result = false; ossimString ext = file.ext(); ext.downcase(); if ( ext == "hdf" || ext == "h4" || ext == "hdf4" || ext == "he4" || ext == "hdf5" || ext == "he5" || ext == "h5" || ext == "l1r") { m_metaInfos.clear(); m_bandVector.clear(); m_hdf4Reader = new ossimHdf4Reader; m_hdf4Reader->setFilename(file); if ( m_hdf4Reader->open() ) { m_metaInfos = m_hdf4Reader->getGlobalMeta(); ossim_uint32 entryNum = m_hdf4Reader->getNumberOfEntries(); for (ossim_uint32 i = 0; i < entryNum; i++) { m_hdf4Reader->setCurrentEntry(i); m_bandVector.push_back(m_hdf4Reader->getNumberOfOutputBands()); m_subMetaInfos[i] = m_hdf4Reader->getSubDatasetMeta(); } m_driverName = "hdf4"; theFile = file; result = true; } else { m_hdf4Reader = 0; } //try hdf5 reader if (m_hdf4Reader == 0) { m_hdf5Reader = new ossimHdf5Reader; m_hdf5Reader->setFilename(file); if (m_hdf5Reader->open()) { m_driverName = "hdf5"; m_metaInfos = m_hdf5Reader->getGlobalMeta(); ossim_uint32 entryNum = m_hdf5Reader->getNumberOfEntries(); for (ossim_uint32 i = 0; i < entryNum; i++) { m_hdf5Reader->setCurrentEntry(i); m_bandVector.push_back(m_hdf5Reader->getNumberOfOutputBands()); m_subMetaInfos[i] = m_hdf5Reader->getSubDatasetMeta(); } theFile = file; result = true; } } } if (traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " exit status = " << (result?"true\n":"false\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; }