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


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

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


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

示例1: importHistogram

bool ossimMultiResLevelHistogram::importHistogram(const ossimFilename& file)
{
   if( file.fileSize() > 0 )
   {
      theHistogramFile = file;
      
      ifstream input(file.c_str());
      return importHistogram(input);
   }
   return false;
}
开发者ID:LucHermitte,项目名称:ossim,代码行数:11,代码来源:ossimMultiResLevelHistogram.cpp

示例2: initializeFromXml

bool ossimGeneralRasterInfo::initializeFromXml( const ossimFilename& imageFile,
                                                const ossimFilename& headerFile )
{
   bool result = false;

   ossimFgdcXmlDoc file;
   if (file.open( headerFile ))
   {
      while( 1 ) 
      {
         //---
         // Go through the data members in order.
         // If a required item is not found break from loop.
         //--
         theMetaData.clear();

         // scalar ( default ) - adjusted below :
         theMetaData.setScalarType( OSSIM_UINT8 );

         // Image file name:
         theImageFileList.clear();
         theImageFileList.push_back( imageFile );

         // interleave ( defaulted ):
         theInterleaveType = OSSIM_BIL;

         // bands ( required ):
         if ( !file.getNumberOfBands() )
         {
            break;
         }
         theMetaData.setNumberOfBands( file.getNumberOfBands() );
         
         ossimIpt size;
         if ( file.getImageSize(size) ) // Lines, samples not image file size.
         {
            // lines, samples ( required ):
            if ( !size.x || !size.y )
            {
               break;
            }
         }
         else
         {
            break;
         }

         // Set the rectangles:
         theRawImageRect   = ossimIrect( 0, 0, size.x - 1, size.y - 1 );
         theValidImageRect = theRawImageRect;
         theImageRect      = theRawImageRect;         

         // sample start ( not required ):
         theSubImageOffset.x = 0;

         // line start ( not required ):
         theSubImageOffset.y = 0;

         // header offset ( not required ):
         theHeaderSize = 0;

         // null mode:
         theSetNullsMode = ossimGeneralRasterInfo::NONE;

         // pixels to chop:
         thePixelsToChop = 0; 

         // Byte order *** need this ***, defaulting to system for now:
         theImageDataByteOrder = ossim::byteOrder();

         // Adjust scalar if needed, note defaulted to 8 bit above:
         ossimString eainfo;
         file.getPath("/metadata/eainfo/detailed/enttyp/enttypd", eainfo);
         ossim_int32 numBits = 0;
         ossim_int64 fileSize = imageFile.fileSize(); // Image file size.
         ossim_int32 numBytes = fileSize / size.x / size.y / numberOfBands();
         if( numBytes > 0 && numBytes != 3 )
         {
            numBits = numBytes*8;
         }
         if( numBits == 16 )
         {
            theMetaData.setScalarType( OSSIM_UINT16 );
         }
         else if( numBits == 32 )
         {
            if(eainfo.contains("float"))
            {
               theMetaData.setScalarType( OSSIM_FLOAT32 );
            }
            else
            {
               theMetaData.setScalarType( OSSIM_UINT32 );
            }
         }

         result = true;
         break; // Trailing break to get out.
      }
   }
//.........这里部分代码省略.........
开发者ID:star-labs,项目名称:star_ossim,代码行数:101,代码来源:ossimGeneralRasterInfo.cpp

示例3: 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

示例4: getMapProjectionKwl

bool ossimQuickbirdMetaData::getMapProjectionKwl( const ossimFilename& imd_file,
                                                  ossimKeywordlist& kwl )
{
   static const char MODULE[] = "ossimQuickbirdMetaData::getMapProjectionKwl";
   if(traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n";
   }
   
   bool result = false;
   
   if( imd_file.exists() )
   {
      FILE* fptr = fopen (imd_file.c_str(), "r");
      if (fptr)
      {

         char* strptr(NULL);
         
         //---
         // Read the file into a buffer:
         //---
         ossim_int32 fileSize = static_cast<ossim_int32>(imd_file.fileSize());
         char* filebuf = new char[fileSize];
         fread(filebuf, 1, fileSize, fptr);
         strptr = filebuf;
         fclose(fptr);
         ossimString imd_key;
         ossimString tempStr;
         std::string key;
         std::string value;


         // Loop until we find all our keys or bust out with error.
         while ( 1 )
         {
            // Verify map projected.
            imd_key = "BEGIN_GROUP = MAP_PROJECTED_PRODUCT";
            if ( strstr( filebuf, imd_key.c_str() ) == NULL )
            {
               break; // Not a map projected product.
            }

            // Get datum:
            if( getEndOfLine( strptr, ossimString("\n\tdatumName = "), "%13c %s", tempStr) )
            {
               if ( tempStr.contains("WE") )
               {
                  key = "dataum";
                  value   = "WGE";
                  kwl.addPair(key, value);
               }
               else
               {
                  if(traceDebug())
                  {
                     ossimNotify(ossimNotifyLevel_WARN)
                        << "Unhandled datum: " << tempStr << "\n";
                  }
               }
            }

            // Get projection:
            if( getEndOfLine( strptr, ossimString("\n\tmapProjName = "), "%15c %s", tempStr) )
            {
               if ( tempStr.contains("UTM") )
               {
                  key = "type";
                  value   = "ossimUtmProjection";
                  kwl.addPair(key, value);
               }
               else
               {
                  if(traceDebug())
                  {
                     ossimNotify(ossimNotifyLevel_WARN)
                        << "Unhandled projection name: " << tempStr << "\n";
                  }
               }
            }

             // Get projection:
            if( getEndOfLine( strptr, ossimString("\n\tmapProjName = "), "%15c %s", tempStr) )
            {
               if ( tempStr.contains("UTM") )
               {
                  key = "type";
                  value   = "ossimUtmProjection";
                  kwl.addPair(key, value);

                  // Get UTM zone:
                  if( getEndOfLine( strptr, ossimString("\n\tmapZone = "), "%11c %s", tempStr) )
                  {
                     key = "zone";
                     value = tempStr.trim(";").string();
                     kwl.addPair(key, value);
                  }
                  else
                  {
                     break;
//.........这里部分代码省略.........
开发者ID:ossimlabs,项目名称:ossim,代码行数:101,代码来源:ossimQuickbirdMetaData.cpp

示例5: parseFile

bool ossimNitfFile::parseFile(const ossimFilename& file)
{
   if (traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << "DEBUG ossimNitfFile::parseFile: "
         << "endtered......"
         << std::endl;
   }
   std::ifstream in(file.c_str(), std::ios::in|std::ios::binary);
   if (in.fail())
   {
      if (traceDebug())
      {
         ossimNotify(ossimNotifyLevel_DEBUG)
            << "DEBUG ossimNitfFile::parseFile: "
            << "Could not open file:  " << file.c_str()
            << "\nReturning..." << std::endl;
      }
      return false;
   }
      
   if(theNitfFileHeader.valid())
   {
      theNitfFileHeader = 0;
   }

   char temp[10];
   in.read(temp, 9);
   in.seekg(0, std::ios::beg);
   temp[9] ='\0';
   
   theFilename = file;

   ossimString s(temp);
   if(s == "NITF02.00")
   {
      if(traceDebug())
      {
         ossimNotify(ossimNotifyLevel_DEBUG)
            << "DEBUG: NITF Version 2.0"
            << std::endl;
      }
      theNitfFileHeader = new ossimNitfFileHeaderV2_0;
   }
   else if ( (s == "NITF02.10") || (s == "NSIF01.00") )
   {
      if(traceDebug())
      {
         ossimNotify(ossimNotifyLevel_DEBUG)
            << "DEBUG: NITF Version 2.1"
            << std::endl;
      }
      theNitfFileHeader = new ossimNitfFileHeaderV2_1;
   }
   else
   {
      if (traceDebug())
      {
         ossimNotify(ossimNotifyLevel_DEBUG)
            << "DEBUG ossimNitfFile::parseFile: "
            << "Not an NITF file!"
            << std::endl;
         ossimNotify(ossimNotifyLevel_DEBUG)
            << "DEBUG ossimNitfFile::parseFile: returning...........false"
            << "endtered......"
            << std::endl;
      }
      return false;
   }

   if(theNitfFileHeader.valid())
   {
      try
      {
         theNitfFileHeader->parseStream(in);

         // Sanity check the size before going on:
         if ( file.fileSize() < theNitfFileHeader->getFileSize() )
         {
            if (traceDebug())
            {
               ossimNotify(ossimNotifyLevel_WARN)
                  << "ossimNitfFile::parseFile ERROR:\n"
                  << "File size is less than file length in header!"
                  << "\nNITF FL field: " << theNitfFileHeader->getFileSize()
                  << "\nActual file length: " << file.fileSize()
                  << std::endl;
            }
            return false;
         }
      }
      catch( const ossimException& e )
      {
         if (traceDebug())
         {
            ossimNotify(ossimNotifyLevel_WARN)
               << "ossimNitfFile::parseFile caught exception:\n"
               << e.what()
               << std::endl;
//.........这里部分代码省略.........
开发者ID:boussaffawalid,项目名称:OTB,代码行数:101,代码来源:ossimNitfFile.cpp


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