Пример #1
0
bool ossimImageUtil::isFiltered(const ossimFilename& file) const
{
   bool result = false;
   if ( file.size() )
   {
      // Strip full path to base name.
      std::string baseName = file.file().string();
      if ( baseName.size() )
      {
         std::vector<std::string>::const_iterator i = m_filteredImages.begin();
         while ( i != m_filteredImages.end() )
         {
            if ( baseName == (*i) )
            {
               result = true;
               break;
            }
            ++i;
         }
      }
   }
#if 0 /* Please leave for debug. (drb) */
   if(traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << "ossimFileWalker::isFiltered file " << (result?"filtered: ":"not filtered: ")
         << file << "\n";
   }
#endif
   
   return result;
}
ossim_int32 ossimGeneralRasterInfo::getBitsPerPixel( const ossimFilename& imageFile ) const
{
   // Note currently does not consider header size.
   ossim_int32 result = 0;
   
   ossim_int64 fileSize = imageFile.size();
   ossimIpt rectSize = theRawImageRect.size();
   if ( fileSize && rectSize.x && rectSize.y && numberOfBands() )
   {
      result = ( fileSize / rectSize.x / rectSize.y / numberOfBands() ) * 8;
   }
   return result;
}
Пример #3
0
bool ossimH5Info::open(const ossimFilename& file)
{
   bool result = false;

   // Check for empty filename.
   if (file.size())
   {
      try
      {
         //--
         // Turn off the auto-printing when failure occurs so that we can
         // handle the errors appropriately
         //---
         H5::Exception::dontPrint();
         
         if ( H5::H5File::isHdf5( file.string() ) )
         {
            m_file = file;
            result = true;
         }
      }
      catch( const H5::FileIException& error )
      {
         error.printError();
      }
      
      // catch failure caused by the DataSet operations
      catch( const H5::DataSetIException& error )
      {
         error.printError();
      }
      
      // catch failure caused by the DataSpace operations
      catch( const H5::DataSpaceIException& error )
      {
         error.printError();
      }
      
      // catch failure caused by the DataSpace operations
      catch( const H5::DataTypeIException& error )
      {
         error.printError();
      }
      catch( ... )
      {
         
      }
   }

   return result;
}
Пример #4
0
ossimRefPtr<ossimImageHandler> ossimImageHandlerFactory::openOverview(
   const ossimFilename& file ) const
{
   ossimRefPtr<ossimImageHandler> result = 0;
   if ( file.size() )
   {
      result = new ossimTiffTileSource;
      
      result->setOpenOverviewFlag( false ); // Always false.

      if ( result->open( file ) == false )
      {
         result = 0;
      }
   }
   return result;
}
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;
}
Пример #6
0
bool ossimFgdcXmlDoc::open(const ossimFilename& xmlFileName)
{
   bool result = false;
   if ( isOpen() )
   {
      close();
   }
   
   if (xmlFileName.size())
   {
      m_xmlDocument = new ossimXmlDocument(xmlFileName);
      if ( m_xmlDocument.valid() )
      {
         // May want to add a test for valid FGDC here??? (drb)
         m_xmlFilename = xmlFileName;
         result = true;
      }
   }
   return result;
}
Пример #7
0
bool ossimGpkgInfo::open(const ossimFilename& file)
{
   bool result = false;
   
   if ( file.size() ) // Check for empty filename.
   {
      std::ifstream str;
      str.open( file.c_str(), std::ios_base::in | std::ios_base::binary);

      if ( str.good() ) // Open good...
      {
         if ( ossim_gpkg::checkSignature( str ) ) // Has "SQLite format 3" signature.
         {
            m_file = file;
            result = true;
         }
      }
   }

   return result;
}
bool ossimImageElevationHandler::open(const ossimFilename& file)
{
   static const char M[] = "ossimImageElevationHandler::open";
   
   bool result = false;

   if ( isOpen() ) close();
   
   if ( file.size() )
   {
      //---
      // NOTE: The false passed to open is flag to NOT open overviews. If code is ever changed
      // to go between reduced resolution levels this should be changed.
      //---
      m_ih = ossimImageHandlerRegistry::instance()->open(file, true, false);
      if ( m_ih.valid() )
      {
         m_geom = m_ih->getImageGeometry();
         if ( m_geom.valid() )
         {
            result = true;

            //---
            // Image rect stored as a drect for ossimImageElevationHandler::pointHasCoverage
            // method.
            //---
            m_rect = ossimDrect(0.0, 0.0,
                                m_ih->getNumberOfSamples()-1, m_ih->getNumberOfLines()-1);

            // Initialize base class stuff.
            theFilename = file;

            theMeanSpacing = (m_geom->getMetersPerPixel().x + m_geom->getMetersPerPixel().y) / 2.0;

            // Set the ossimElevSource::theGroundRect
            std::vector<ossimGpt> corner(4);
            if ( m_geom->getCornerGpts(corner[0], corner[1], corner[2], corner[3]) )
            {
               ossimGpt ulGpt(corner[0]);
               ossimGpt lrGpt(corner[0]);
               for ( ossim_uint32 i = 1; i < 4; ++i )
               {
                  if ( corner[i].lon < ulGpt.lon ) ulGpt.lon = corner[i].lon;
                  if ( corner[i].lat > ulGpt.lat ) ulGpt.lat = corner[i].lat;
                  if ( corner[i].lon > lrGpt.lon ) lrGpt.lon = corner[i].lon;
                  if ( corner[i].lat < lrGpt.lat ) lrGpt.lat = corner[i].lat;
               }
               theGroundRect = ossimGrect(ulGpt, lrGpt);
            }
            else
            {
               theGroundRect.makeNan();
            }
         }
         // theAbsLE90 ???
         // theAbsCE90 ???
      }
   }

   if ( traceDebug() )
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << M << " DEBUG:"
         << "\nmean spacing(meters): " << theMeanSpacing
         << "\nunding rect: " << theGroundRect
         << "\nreturn status: " << (result?"true\n":"false\n");
   }
         
   return result;
}
Пример #9
0
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;
}