Example #1
0
// Note: throws ossimException on error.
void ossimRpfUtil::writeDotRpfFiles( const ossimFilename& aDotTocFile,
                                     const ossimFilename& outputDir )
{
   static const char MODULE[] = "ossimRpfUtil::writeDotRpfFiles";

   if ( traceDebug() )
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << MODULE << " entered..."
         << "\na.toc file:        " << aDotTocFile
         << "\noutput directory:  " << outputDir
         << "\n";
   }
   
   // Parse the a.toc file:
   ossimRefPtr<ossimRpfToc> toc = new ossimRpfToc();
   
   if ( toc->parseFile(aDotTocFile) != ossimErrorCodes::OSSIM_OK )
   {
      std::string e = MODULE;
      e += " ERROR:\nCould not open: ";
      e+= aDotTocFile.string();
      throw ossimException(e);
   }

   if ( outputDir.expand().exists() == false )
   {
      if ( !outputDir.createDirectory(true, 0775) )
      {
         std::string e = MODULE;
         e += " ERROR:\nCould not create directory: ";
         e+= outputDir.c_str();
         throw ossimException(e);
      }
   }

   //---
   // Go through the entries...
   //---
   ossim_uint32 entries = toc->getNumberOfEntries();
   for (ossim_uint32 entry = 0; entry < entries; ++entry)
   {
      const ossimRpfTocEntry* tocEntry = toc->getTocEntry(entry);
      if (tocEntry)
      {
         if ( tocEntry->isEmpty() == false )
         {
            writeDotRpfFile(toc.get(), tocEntry, outputDir, entry);
         }
      }
      else
      {
         std::string e = MODULE;
         e += " ERROR:  Null entry: ";
         e += ossimString::toString(entry).string();
         throw ossimException(e);
      }
   }
   
} // End: ossimRpfUtil::writeDotRpfFiles
Example #2
0
bool genlas(const ossimFilename& fname)
{
   cout << "Generating file <"<<fname<<">"<<endl;

   FauxReader reader;
   Options roptions;
   BOX3D bbox(-0.001, -0.001, -100.0, 0.001, 0.001, 100.0);
   roptions.add("bounds", bbox);
   roptions.add("num_points", 11);
   roptions.add("mode", "ramp");
   reader.setOptions(roptions);

   LasWriter writer;
   Options woptions;
   woptions.add("filename", fname.string());
   woptions.add("a_srs", "EPSG:4326"); // causes core dump when ossimInit::initialize() called on startup
   woptions.add("scale_x", 0.0000001);
   woptions.add("scale_y", 0.0000001);
   writer.setOptions(woptions);
   writer.setInput(reader);

   PointTable wtable;
   writer.prepare(wtable);
   writer.execute(wtable);

   return true;
}
Example #3
0
static void move( const ossimFilename& in, const ossimFilename& out )
{
#if defined(WIN32) || defined(_MSC_VER) && !defined(__CYGWIN__) && !defined(__MWERKS__)
   std::string moveCommand = "ren";
#else
   std::string moveCommand = "mv";
#endif

   std::string command = moveCommand;
   command += " ";
   command += in.string();
   command += " ";
   command += out.string();
   cout << "Executing " << command << endl;
   system(command.c_str());
}
Example #4
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;
}
Example #5
0
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;
      }
   }
}