当前位置: 首页>>代码示例>>C++>>正文


C++ FactoryResource::getFileName方法代码示例

本文整理汇总了C++中FactoryResource::getFileName方法的典型用法代码示例。如果您正苦于以下问题:C++ FactoryResource::getFileName方法的具体用法?C++ FactoryResource::getFileName怎么用?C++ FactoryResource::getFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FactoryResource的用法示例。


在下文中一共展示了FactoryResource::getFileName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: readHeader

bool LandsatEtmPlusImporter::readHeader(const string& strInFstHeaderFileName)
{
   if (strInFstHeaderFileName.empty())
   {
      return false;
   }

   //The HTM header file contains information for Band 6 Channel 1 and 2. 
   //This set extracts the info needed to process HTM(band 6) header
   mFieldHTM.clear();
   string baseFileName = strInFstHeaderFileName.substr(0, strInFstHeaderFileName.length() - 7);
   FactoryResource<Filename> filename;
   filename->setFullPathAndName(baseFileName);
   FactoryResource<FileFinder> fileFinder;
   string htmFileName = filename->getFileName() + "HTM.FST";
   if (fileFinder->findFile(filename->getPath(), htmFileName))
   {
      fileFinder->findNextFile();
      fileFinder->getFullPath(htmFileName);
   }

   LargeFileResource htmFile;
   if (htmFile.open(htmFileName, O_RDONLY, S_IREAD))
   {
      //process HTM header
      vector<char> buf(5120);
      size_t count = static_cast<size_t>(htmFile.read(&buf.front(), 5120));
      VERIFY(htmFile.eof());
      string htmHeaderFull(&buf.front(), count);
      vector<string> htmHeaderLines = StringUtilities::split(htmHeaderFull, '\n');

      if (!parseHeader(htmHeaderLines, mFieldHTM)) //parse band 6 header
      {
         mFieldHTM.clear();
      }
   }
   htmFile.close();

   // The HRF Header file contains the parameters for Bands 1-5 and 7.  
   mFieldHRF.clear();
   string hrfFileName = filename->getFileName() + "HRF.FST";
   if (fileFinder->findFile(filename->getPath(), hrfFileName))
   {
      fileFinder->findNextFile();
      fileFinder->getFullPath(hrfFileName);
   }

   LargeFileResource hrfFile;
   if (hrfFile.open(hrfFileName, O_RDONLY, S_IREAD))
   {
      //process HRF header
      vector<char> buf(5120);
      size_t count = static_cast<size_t>(hrfFile.read(&buf.front(), 5120));
      VERIFY(hrfFile.eof());
      string hrfHeaderFull(&buf.front(), count);
      vector<string> hrfHeaderLines = StringUtilities::split(hrfHeaderFull, '\n');

      if (!parseHeader(hrfHeaderLines, mFieldHRF)) //parse bands 1-5 and 7 header
      {
         mFieldHRF.clear();
      }
   }
   hrfFile.close();

   // The HPN Header file contains the parameters for Band 8.
   mFieldHPN.clear();
   string hpnFileName = filename->getFileName() + "HPN.FST";
   if (fileFinder->findFile(filename->getPath(), hpnFileName))
   {
      fileFinder->findNextFile();
      fileFinder->getFullPath(hpnFileName);
   }

   LargeFileResource hpnFile;
   if (hpnFile.open(hpnFileName, O_RDONLY, S_IREAD))
   {
      //process HPN header
      vector<char> buf(5120);
      size_t count = static_cast<size_t>(hpnFile.read(&buf.front(), 5120));
      VERIFY(hpnFile.eof());
      string hpnHeaderFull(&buf.front(), count);
      vector<string> hpnHeaderLines = StringUtilities::split(hpnHeaderFull, '\n');

      if (!parseHeader(hpnHeaderLines, mFieldHPN)) //parse band 8 header
      {
         mFieldHPN.clear();
      }
   }
   hpnFile.close();

   return (!mFieldHRF.empty() || !mFieldHTM.empty() || !mFieldHPN.empty());
}
开发者ID:tclarke,项目名称:opticks-extras-Spectral,代码行数:92,代码来源:LandsatEtmPlusImporter.cpp


注:本文中的FactoryResource::getFileName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。