ossimFilename ossimErsSarModel::findErsLeader(const ossimFilename& file) const { ossimFilename leaFile = file; ossimString datString("DAT_01"); ossimString nulString("NUL_DAT"); ossimString vdfString("VDF_DAT"); ossimString leaString("LEA_01"); if ((file.fileNoExtension() == datString) || (file.fileNoExtension() == nulString) || (file.fileNoExtension() == leaString)) { leaFile.setFile(leaString); if (leaFile.exists()) { return leaFile; } } return file; }
QuickbirdRpcModel::QuickbirdRpcModel(const ossimFilename& imgFileName) { m_imageFileName = imgFileName; // 结果文件名 m_resultName = imgFileName.fileNoExtension(); vector<ossimString> strList = ossimString(m_resultName).split('-'); if(3 == strList.size()) { m_resultName = strList[0] + "-" + strList[2]; } if(init(m_imageFileName)) { m_bInitState = true; } }
void ossimSensorModelFactory::findCoarseGrid(ossimFilename& result, const ossimFilename& geomFile)const { result = geomFile; result.setFile(result.fileNoExtension()+"_ocg"); result.setExtension("dat"); if(!result.exists()) { result = geomFile; result.setExtension("dat"); } // let's find a .dat file in the current directory // if(!result.exists()) { result = ""; ossimDirectory directoryList(geomFile.path()); ossimFilename file; if(directoryList.getFirst(file, ossimDirectory::OSSIM_DIR_FILES)) { ossimString testString = "OSSIM_DBL_GRID"; char tempBuf[14]; do { if(file.ext().downcase() == "dat") { std::ifstream in(file.c_str()); if(in) { in.read((char*)tempBuf, 14); in.close(); if(ossimString(tempBuf, tempBuf+14) == testString) { result = file; } } } }while((directoryList.getNext(file))&&(result == "")); } // try to find it } }