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


C++ ossimFilename::exists方法代码示例

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


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

示例1:

std::shared_ptr<ossim::ifstream> ossimStreamFactoryRegistry::createIFStream(
   const ossimFilename& file, std::ios_base::openmode openMode) const
{
   std::shared_ptr<ossim::ifstream>result(0);
   
   for(ossim_uint32 idx = 0; ((idx < theFactoryList.size())&&(!result)); ++idx)
   {
      result = theFactoryList[idx]->createIFStream(file, openMode);
   }

   if(!result)
   {
      if(file.exists())
      {
         // there is a bug in gcc < 5.0 and we can't use constructors in the 
         // C++11 build.  Will refactor to do a new ifstream then use open
         //

         result = std::make_shared<ossim::ifstream>();
         result->open(file.c_str(), openMode);
         if(!result->is_open())
         {
            result.reset();
         }
      }
   }
   
   return result; 
   
}
开发者ID:ossimlabs,项目名称:ossim,代码行数:30,代码来源:ossimStreamFactoryRegistry.cpp

示例2: getModelFromExtFile

ossimRefPtr<ossimNitfRsmModel> getModelFromExtFile( const ossimFilename& file )
{
   ossimRefPtr<ossimNitfRsmModel> result = 0;

   if ( file.exists() )
   {
      result = new ossimNitfRsmModel();
      if ( result->parseFile( file, 0 ) ) // Hard coded entry index of 0 for now.
      {
         cout << "Initialize from ext file success!" << endl;
      }
      else
      {
         result = 0;
         cerr << "Could not open: " << file << endl;
      }
   }
   else
   {
     cerr << "File does not exists: " << file << endl;
   }

   return result;
   
} // End: getModelFromExtFile(...)
开发者ID:LucHermitte,项目名称:ossim,代码行数:25,代码来源:ossim-nitf-rsm-model-test.cpp

示例3: findCoarseGrid

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
   }
}
开发者ID:Dukeke,项目名称:ossim,代码行数:46,代码来源:ossimSensorModelFactory.cpp

示例4: cmpFile

void cmpFile(const ossimFilename& wsa,
             const ossimFilename& wsb,
             const ossimFilename& file)
{
   ossimFilename bFile = file.substitute(wsa, wsb);

   if ( !file.exists() )
   {
      cout << "\nnotice: wsb file: " << bFile
           << "\nnotice: wsa file does not exists: " << file
           << "\nb -> a copy command:"
           << "\ncp " << bFile << " " << file << "\n"
           << endl;
   }
   if ( !bFile.exists() )
   {
      cout << "\nnotice: wsa file: " << file
           << "\nnotice: wsb file does not exists: " << bFile
           << "\na -> b copy command:"
           << "\ncp " << file << " " << bFile << "\n"
           << endl;
   }

   if ( file.exists() && bFile.exists() )
   {
      std::string command = "diff -w --ignore-matching-lines=\\$Id ";
      command += file.string();
      command += " ";
      command += bFile.string();
      
      int status = system( command.c_str() );
      
      if ( status != 0 )
      {
         cout << "\nnotice files differ:"
              << "\nwsa file: " << file
              << "\nwsb file: " << bFile
              << "\na -> b copy command:"
              << "\ncp " << file << " " << bFile
              << "\nb -> a copy command:"
              << "\ncp " << bFile << " " << file << "\n"
              << endl;
      }
   }
}
开发者ID:BJangeofan,项目名称:ossim,代码行数:45,代码来源:ossim-ws-cmp.cpp

示例5: setLut

void ossimIndexToRgbLutFilter::setLut(const ossimFilename& file)
{
   theLutFile = file;
   if(file.exists())
   {
      ossimKeywordlist kwl(theLutFile);
      loadState(kwl);
   }
}
开发者ID:LucHermitte,项目名称:ossim,代码行数:9,代码来源:ossimIndexToRgbLutFilter.cpp

示例6: in

//**************************************************************************
// CONSTRUCTOR
//**************************************************************************
ossimDtedUhl::ossimDtedUhl(const ossimFilename& dted_file, ossim_int32 offset)
   :
      theRecSen(),
      theField2(),
      theLonOrigin(),
      theLatOrigin(),
      theLonInterval(),
      theLatInterval(),
      theAbsoluteLE(),
      theSecurityCode(),
      theNumLonLines(),
      theNumLatPoints(),
      theMultipleAccuracy(),
      theStartOffset(0),
      theStopOffset(0)
{
   if(!dted_file.empty())
   {
      // Check to see that dted file exists.
      if(!dted_file.exists())
      {
         theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
         ossimNotify(ossimNotifyLevel_FATAL) << "FATAL ossimDtedUhl::ossimDtedUhl: The DTED file does not exist: " << dted_file << std::endl;
         return;
      }
      
      // Check to see that the dted file is readable.
      if(!dted_file.isReadable())
      {
         theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
         ossimNotify(ossimNotifyLevel_FATAL) << "FATAL ossimDtedUhl::ossimDtedUhl: The DTED file is not readable --> " << dted_file << std::endl;
         return;
      }
      
      std::ifstream in(dted_file.c_str());
      if(!in)
      {
         theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
         ossimNotify(ossimNotifyLevel_FATAL) << "FATAL ossimDtedUhl::ossimDtedUhl: Error opening the DTED file: " << dted_file << std::endl;
         
         return;
      }
      in.seekg(offset);
      parse(in);
      
      in.close();
   }
}
开发者ID:loongfee,项目名称:ossim-svn,代码行数:51,代码来源:ossimDtedUhl.cpp

示例7: parseFile

//*******************************************************************
// Private Method:
//*******************************************************************
bool ossimKeywordlist::parseFile(const ossimFilename& file,
                                 bool ignoreBinaryChars)
{
   if(!file.exists()) return false;
   bool result = false;
   std::ifstream is;
   is.open(file.c_str(), std::ios::in | std::ios::binary);
   
   if(!is.fail())
   {
      result = parseStream(is, ignoreBinaryChars);
   }
   
   is.close();
   
   return result;
}
开发者ID:harryjfowen,项目名称:ossim,代码行数:20,代码来源:ossimKeywordlist.cpp

示例8: in

//**************************************************************************
// CONSTRUCTOR
//**************************************************************************
ossimDtedVol::ossimDtedVol(const ossimFilename& dted_file,
                           ossim_int32 offset)
   :
      theStartOffset(0),
      theStopOffset(0)
{
   if(!dted_file.empty())
   {
      // Check to see that dted file exists.
      if(!dted_file.exists())
      {
         theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
         ossimNotify(ossimNotifyLevel_FATAL)
         << "FATAL ossimDtedVol::ossimDtedVol"
         << "\nThe DTED file does not exist: " << dted_file << std::endl;
         return;
      }
      
      // Check to see that the dted file is readable.
      if(!dted_file.isReadable())
      {
         theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
         ossimNotify(ossimNotifyLevel_FATAL)
         << "FATAL ossimDtedVol::ossimDtedVol"
         << "\nThe DTED file is not readable: " << dted_file << std::endl;
         return;
      }
      
      // Open the dted file for reading.
      std::ifstream in(dted_file.c_str());
      if(!in)
      {
         theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
         ossimNotify(ossimNotifyLevel_FATAL)
         << "FATAL ossimDtedVol::ossimDtedVol"
         << "\nUnable to open the DTED file: " << dted_file << std::endl;
         return;
      }
      in.seekg(offset);
      parse(in);
      
      in.close();
   }
}
开发者ID:LucHermitte,项目名称:ossim,代码行数:47,代码来源:ossimDtedVol.cpp

示例9: openGeneralRasterDirectory

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();
}
开发者ID:loongfee,项目名称:ossim-svn,代码行数:43,代码来源:ossimGeneralRasterElevationDatabase.cpp

示例10: result

std::shared_ptr<ossim::ifstream> ossimStreamFactory::createIFStream(
   const ossimFilename& file, std::ios_base::openmode openMode) const
{
   std::shared_ptr<ossim::ifstream> result(0);

   if ( file.exists() )
   {
      // there is a bug in gcc < 5.0 and we can't use constructors in the 
      // C++11 build.  Will refactor to do a new ifstream then use open
      //
      result = std::make_shared<ossim::ifstream>();
      result->open(file.c_str(), openMode);
      if ( result->is_open() == false )
      {
         result.reset();
      }
   }
   return result;
}
开发者ID:ossimlabs,项目名称:ossim,代码行数:19,代码来源:ossimStreamFactory.cpp

示例11: isAuxFile

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;
}
开发者ID:loongfee,项目名称:ossim-svn,代码行数:20,代码来源:ossimAuxFileHandler.cpp

示例12: createIstream

ossimRefPtr<ossimImageHandler> ossimImageHandlerRegistry::openOverview(
   const ossimFilename& file ) const
{
   ossimRefPtr<ossimImageHandler> result = 0;

   // See if we can open via the stream interface:
   std::shared_ptr<ossim::istream> str = ossim::StreamFactoryRegistry::instance()->
      createIstream( file, std::ios_base::in|std::ios_base::binary);
   
   if ( str )
   {
      std::vector<ossimImageHandlerFactoryBase*>::const_iterator factory = m_factoryList.begin();
      while( factory != m_factoryList.end() )
      {
         result = (*factory)->openOverview( str, file );
         if ( result.valid() )
         {
            break;
         }
         ++factory;
      }

      str = 0;
   }

   if ( (result.valid() == false) && file.exists() )
   {  
      vector<ossimImageHandlerFactoryBase*>::const_iterator factory = m_factoryList.begin();
      while( factory != m_factoryList.end() )
      {
         result = (*factory)->openOverview( file );
         if ( result.valid() )
         {
            break;
         }
         ++factory;
      }
   }
   return result;
}
开发者ID:ossimlabs,项目名称:ossim,代码行数:40,代码来源:ossimImageHandlerRegistry.cpp

示例13: parseHdrData

//*****************************************************************************
// PROTECTED METHOD: ossimIkonosRpcModel::parseHdrData()
//  
//  Parses the Ikonos hdr file.
//  
//*****************************************************************************
bool ossimIkonosRpcModel::parseHdrData(const ossimFilename& data_file)
{
   if (traceExec())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << "DEBUG ossimIkonosRpcModel::parseHdrData(data_file): entering..."
         << std::endl;
   }
   
   if( !data_file.exists() )
   {
      if (traceDebug())
      {
         ossimNotify(ossimNotifyLevel_WARN)
            << "ossimIkonosRpcModel::parseHdrData(data_file) WARN:"
            << "\nrpc data file <" << data_file << ">. "<< "doesn't exist..."
            << std::endl;
      }
      return false;
   }

   FILE* fptr = fopen (data_file, "r");
   if (!fptr)
   {
      ++theErrorStatus;
      
      if (traceDebug())
      { 
         ossimNotify(ossimNotifyLevel_WARN)
            << "ossimIkonosRpcModel::parseHdrData(data_file) WARN:"
            << "\nCould not open hdr data file <" << data_file << ">. "
            << "returning with error..." << std::endl;
      }
      return false;
   }

   char* strptr = 0;
   // char linebuf[80];
   char dummy[80];
   // , name[80];

   //***
   // Read the file into a buffer:
   //***
   char filebuf[5000];
   fread(filebuf, 1, 5000, fptr);

   //***
   // GSD:  NOTE - this will be recomputed by computeGsd method later.
   //***
   strptr = strstr(filebuf, "\nPixel Size X:");
   if (!strptr)
   {
      if(traceDebug())
      {
         ossimNotify(ossimNotifyLevel_WARN)
            << "ossimIkonosRpcModel::parseHdrData(data_file):"
            << "\n\tAborting construction. Error encountered parsing "
            << "presumed hdr file." << endl;
      }
      
      return false;
   }
      
   sscanf(strptr, "%14c %lf", dummy, &theGSD.samp);
   strptr = strstr(strptr, "\nPixel Size Y:");
   if (!strptr)
   {
      if(traceDebug())
      {
         ossimNotify(ossimNotifyLevel_WARN)
            << "ossimIkonosRpcModel::parseHdrData(data_file): "
            << "\n\tAborting construction. Error encountered parsing "
            << "presumed hdr file." << endl;
      }
         
      return false;
   }

   sscanf(strptr, "%14c %lf", dummy, &theGSD.line);

   //***
   // Image size:
   //***
   strptr = strstr(strptr, "\nColumns:");
   if (!strptr)
   {
      if(traceDebug())
      {
         ossimNotify(ossimNotifyLevel_WARN)
            << "ossimIkonosRpcModel::parseHdrData(data_file): "
            << "\n\tAborting construction. Error encountered parsing "
            << "presumed hdr file." << endl;
      }
//.........这里部分代码省略.........
开发者ID:loongfee,项目名称:ossim-svn,代码行数:101,代码来源:ossimIkonosRpcModel.cpp

示例14: open

bool ossimGeneralRasterInfo::open( const ossimFilename& imageFile )
{
   static const char MODULE[] = "ossimGeneralRasterInfo::open";
   if ( traceDebug() )
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << MODULE << " entered..." << "\nimageFile: " << imageFile << std::endl;
   }

   bool result = false;

   // Wipe any previous state slick.
   clear();

   ossimFilename copyFile = imageFile;
   if ( !imageFile.exists() )
   {
      copyFile = imageFile.expand();
   }

   // Look for the headrer of omd file as they are written out by img2rr.
   ossimFilename hdr = copyFile;
   hdr.setExtension("hdr"); // image.hdr
   if ( !hdr.exists() )
   {
      hdr = imageFile;
      hdr.string() += ".hdr"; // image.ras.hdr
      if ( ! hdr.exists() )
      {
         hdr = imageFile;
         hdr.setExtension("xml"); // image.xml
      }
   }

   if ( hdr.exists() )
   {
      if ( traceDebug() )
      {
         ossimNotify(ossimNotifyLevel_DEBUG) << "header file: " << hdr << std::endl;
      }
      
      ossimString ext = hdr.ext().downcase();
      
      if ( ext == "hdr" )
      {
         if ( ossimEnviHeader::isEnviHeader( hdr ) )
         {
            result = initializeFromEnviHdr( hdr );
         }
         else
         {
            result = initializeFromHdr( imageFile, hdr );
         }

         if ( !result )
         {
            // Could be an ossim meta data file:
            ossimKeywordlist kwl( hdr );
            result = loadState( kwl, 0 );
         }
      }
      else if ( ext == "xml" )
      {
         result = initializeFromXml( imageFile, hdr );
      }
   }
   
   //---
   // Set the file name.  Needed for ossimGeneralRasterTileSource::open.
   // Note set here above loadState call to stop loadState from returning
   // false if no image file found.
   //---
   if ( theImageFileList.empty() )
   {
      setImageFile( imageFile );
   }
   
   ossimFilename omd = imageFile;
   omd.setExtension("omd"); // image.omd
   if ( !omd.exists() )
   {
      omd.setExtension("kwl"); // image.kwl
   }

   if ( omd.exists() )
   {
      if ( traceDebug() )
      {
         ossimNotify(ossimNotifyLevel_DEBUG) << "omd file: " << omd << std::endl;
      }

      ossimKeywordlist kwl( omd );

      if ( result && theMetaData.getNumberOfBands() )
      {
         //---
         // Just update the band info in case it has min/max values from
         // a compute min/max scan.
         //---
         theMetaData.updateMetaData( kwl, std::string("") );
//.........这里部分代码省略.........
开发者ID:star-labs,项目名称:star_ossim,代码行数:101,代码来源:ossimGeneralRasterInfo.cpp

示例15: parseMetaData

//*****************************************************************************
// PROTECTED METHOD: ossimQuickbirdMetaData::parseMetaData()
//
//  Parses the Quickbird IMD file.
//
//*****************************************************************************
bool ossimQuickbirdMetaData::parseMetaData(const ossimFilename& data_file)
{
   if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimQuickbirdMetaData::parseMetaData(data_file): entering..." << std::endl;
   
   if( !data_file.exists() )
   {
      if (traceExec()) ossimNotify(ossimNotifyLevel_WARN) << "ossimQuickbirdMetaData::parseMetaData(data_file) WARN:" << "\nmetadate data file <" << data_file << ">. " << "doesn't exist..." << std::endl;
      return false;
   }
  

   FILE* fptr = fopen (data_file, "r");
   if (!fptr)
   {
      if (traceDebug())
      {
         ossimNotify(ossimNotifyLevel_DEBUG)
	    << "ossimQuickbirdRpcModel::parseMetaData(data_file) DEBUG:"
	    << "\nCould not open Meta data file:  " << data_file
	    << "\nreturning with error..." << std::endl;
      }
      return false;
   }

   char* strptr(NULL);

   //---
   // Read the file into a buffer:
   //---
   ossim_int32 fileSize = static_cast<ossim_int32>(data_file.fileSize());
   char* filebuf = new char[fileSize];
   fread(filebuf, 1, fileSize, fptr);
   strptr = filebuf;
   fclose(fptr);
   ossimString temp;

   //---
   // Generation time:
   //---
  
   if(getEndOfLine( strptr, ossimString("\ngenerationTime ="), "%17c %s", temp))
      theGenerationDate = ossimString(temp).before(";");
   else
   {
      if(traceDebug())
      {
         ossimNotify(ossimNotifyLevel_FATAL)
	    << "FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): "
	    << "\n\tAborting construction. Error encountered parsing "
	    << "presumed meta-data file." << std::endl;

         delete [] filebuf;
         return false;
      }
   }

   // Number of rows and columns in full image:
   if(getEndOfLine( strptr, ossimString("\nnumRows ="), "%10c %s", temp))
      theImageSize.line = ossimString(temp).before("\";").toInt();

   if(getEndOfLine( strptr, ossimString("\nnumColumns ="), "%13c %s", temp))
      theImageSize.samp = ossimString(temp).before("\";").toInt();

   //---
   // BandId:
   //---
   if(getEndOfLine( strptr, ossimString("\nbandId ="), "%9c %s", temp))
      theBandId = ossimString(temp).after("\"").before("\";");
   else
   {
      if(traceDebug())
      {
         ossimNotify(ossimNotifyLevel_FATAL)
	    << "FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): "
	    << "\n\tAborting construction. Error encountered parsing "
	    << "presumed meta-data file." << std::endl;

         delete [] filebuf;
         return false;
      }
   }
    
  
   //---
   // BitsPerPixel:
   //---
   if(getEndOfLine( strptr, ossimString("\nbitsPerPixel = "), "%16c %s", temp))
      theBitsPerPixel = ossimString(temp).before(";").toInt();
   else
   {
      if(traceDebug())
      {
         ossimNotify(ossimNotifyLevel_FATAL)
	    << "FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): "
//.........这里部分代码省略.........
开发者ID:ossimlabs,项目名称:ossim,代码行数:101,代码来源:ossimQuickbirdMetaData.cpp


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