ossimErrorCode ossimVpfDatabaseHeader::open(const ossimFilename& databaseHeaderTable)
{
    vpf_table_type tableTypeData;

    if( is_vpf_table( databaseHeaderTable.c_str() ) )
    {
        tableTypeData = vpf_open_table(databaseHeaderTable.c_str(),
                                       (storage_type)DISK,
                                       "rb",
                                       NULL);
        if(isDatabaseHeaderTable(tableTypeData))
        {

        }
        else
        {
            return ossimErrorCodes::OSSIM_ERROR;
        }
    }
    else
    {
        return ossimErrorCodes::OSSIM_ERROR;
    }

    return ossimErrorCodes::OSSIM_OK;
}
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; 
   
}
Exemple #3
0
bool ossimVpfTable::openTable(const ossimFilename& tableName)
{
   closeTable();

   if(is_vpf_table(const_cast<char*>(tableName.c_str())))
   {
      if(theTableInformation)
      {
         delete theTableInformation;
         theTableInformation = NULL;
      }
      theTableInformation = new vpf_table_type;
      memset(theTableInformation, 0, sizeof(vpf_table_type));

      theTableName = tableName;
      *theTableInformation = vpf_open_table(const_cast<char*>(tableName.c_str()),
                                            disk,
                                            "rb",
                                            NULL);
   }
   else
   {
      delete theTableInformation;
      theTableInformation = NULL;

      return false;
   }

   return true;
}
Exemple #4
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;
}
Exemple #5
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
bool ossimplugins::ossimRadarSat2TiffReader::open(const ossimFilename& file)
{
   static const char MODULE[] = "ossimplugins::ossimRadarSat2TiffReader::open";
   
   if (traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << MODULE << " entered...\n"
         << "file: " << file << "\n";
   }

   bool result = false;
   
   if ( isOpen() )
   {
      close();
   }

   // Check extension to see if it's xml.
   if ( file.ext().downcase() == "xml" )
   {
      ossimXmlDocument* xdoc = new ossimXmlDocument();
      if ( xdoc->openFile(file) )
      {
         // See if it's a TerraSAR-X product xml file.
         if ( isRadarSat2ProductFile(xdoc) )
         {
            ossimString s;
            ossimRadarSat2ProductDoc helper;
            
            if ( helper.getImageFile(xdoc, s) )
            {
               ossimFilename imageFile = file.expand().path();
               imageFile = imageFile.dirCat(s);

               setFilename(imageFile);

               result = ossimTiffTileSource::open();
               if (result)
               {
                  theProductXmlFile = file;
                  completeOpen();
               }
            }
         }
      }
      delete xdoc;
      xdoc = 0;
      
   } // matches: if ( file.ext().downcase() == "xml" )

   if (traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << MODULE << " exit status = " << (result?"true":"false\n")
         << std::endl;
   }

   return result;
}
void ossimIndexToRgbLutFilter::setLut(const ossimFilename& file)
{
   theLutFile = file;
   if(file.exists())
   {
      ossimKeywordlist kwl(file.c_str());
      loadState(kwl);
   }
}
bool ossimMultiResLevelHistogram::importHistogram(const ossimFilename& file)
{
   if( file.fileSize() > 0 )
   {
      theHistogramFile = file;
      
      ifstream input(file.c_str());
      return importHistogram(input);
   }
   return false;
}
void ossimQtSingleImageWindow::displayImage(const ossimFilename& file)
{
    ossimRefPtr<ossimImageHandler> ih = ossimImageHandlerRegistry::instance()->open(file);
    if (!ih)
    {
        QString caption = "Sorry:";
        QString text = "Could not find the image handler for file:\n";
        text += file.c_str();
        QMessageBox::information( this,
                                  caption,
                                  text,
                                  QMessageBox::Ok );
        return;
    }

    if (ih->getNumberOfDecimationLevels() == 1)
    {
        QString caption("Question:");
        QString text = "Would you like to build reduced resolution data sets?\n";
        text += "Note:\n";
        text += "This can take some time depending on the size of your image.";
        text += "\nAlternatively use the command line application:  \"img2rr\"";

        int answer = QMessageBox::question( this,
                                            caption,
                                            text,
                                            QMessageBox::Yes,
                                            QMessageBox::No);
        if (answer == QMessageBox::Yes)
        {
            //---
            // We need to listen for the open overview signal to rebuild the
            // theResolutionLevelMenu.
            //---
            ih->addListener(this);
            buildOverViews( ih.get() );
        }
    }

    createImageChain( ih.get() );

    // Build the resolution level menu.
    buildResolutionLevelMenu();

    // Give it to the widget.
    theImageWidget->connectMyInputTo(theImageChain.get());
    theImageWidget->refresh();

    connectMyInputTo(theImageChain.get());
    QString caption = "iview : ";
    caption += file.file().c_str();
    setCaption(caption);
}
Exemple #10
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;
}
Exemple #11
0
bool ossimNitfInfo::open(const ossimFilename& file)
{
   bool result = false;
   
   std::string connectionString = file.c_str();
   std::shared_ptr<ossim::istream> str = ossim::StreamFactoryRegistry::instance()->
      createIstream( file.c_str(), std::ios_base::in|std::ios_base::binary);
   
   if ( str )
   {
      result = open(str, connectionString);
   }
   return result;
}
Exemple #12
0
//**************************************************************************
// 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();
   }
}
Exemple #13
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());
}
//*************************************************************************************************
//! Reads the TIL file for pertinent info. Returns TRUE if successful
//*************************************************************************************************
bool ossimQuickbirdRpcModel::parseTileData(const ossimFilename& image_file)
{
   ossimFilename tileFile (image_file);
   tileFile.setExtension("TIL");
   if (!findSupportFile(tileFile))
      return false;

   ossimQuickbirdTile tileHdr;
   if(!tileHdr.open(tileFile))
      return false;

   ossimQuickbirdTileInfo info;
   if(!tileHdr.getInfo(info, image_file.file()))
      return false;

   if((info.theUlXOffset != OSSIM_INT_NAN) && (info.theUlYOffset != OSSIM_INT_NAN) &&
      (info.theLrXOffset != OSSIM_INT_NAN) && (info.theLrYOffset != OSSIM_INT_NAN) &&
      (info.theLlXOffset != OSSIM_INT_NAN) && (info.theLlYOffset != OSSIM_INT_NAN) &&
      (info.theUrXOffset != OSSIM_INT_NAN) && (info.theUrYOffset != OSSIM_INT_NAN))
   {
      theImageClipRect = ossimIrect(ossimIpt(info.theUlXOffset, info.theUlYOffset),
                                    ossimIpt(info.theUrXOffset, info.theUrYOffset),
                                    ossimIpt(info.theLrXOffset, info.theLrYOffset),
                                    ossimIpt(info.theLlXOffset, info.theLlYOffset));
   }
   else if ((info.theUlXOffset != OSSIM_INT_NAN) && (info.theUlYOffset != OSSIM_INT_NAN) &&
      (theImageClipRect.width() != OSSIM_INT_NAN) && (theImageClipRect.height() != OSSIM_INT_NAN))
   {
      theImageClipRect = ossimIrect(info.theUlXOffset, info.theUlYOffset,
                                    info.theUlXOffset+theImageClipRect.width()-1, 
                                    info.theUlYOffset+theImageClipRect.height()-1);
   }

   return true;
}
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(...)
bool ossimXmlDocument::openFile(const ossimFilename& filename)
{
   
   theFilename = filename;

   if(theFilename == "")
   {
      return false;
   }

   //
   // Open XML File:
   // Note: Opening text document binary to overcome an apparent windows bug.
   //
   ifstream xml_stream (filename.c_str(), ios::binary);
   if (!xml_stream)
   {
      if (traceDebug())
      {
         ossimNotify(ossimNotifyLevel_DEBUG)
            << "DEBUG: ossimXmlDocument::ossimXmlDocument\n"
            << "encountered opening file <" << filename << "> for "
            << "reading. Aborting..." << endl;
      }
      return false;
   }

   return read(xml_stream);
}
Exemple #17
0
void outputTemplateKeywordlist(const ossimFilename &templateFilename)
{
   ofstream out(templateFilename.c_str());

   out << "file1.filename: <full path and file name>" << endl
       << "file2.filename: <full path and file name>" << endl
       << "// :\n"
       << "// :\n"
       << "// fileN: <full path and file name to the Nth file in the list>" << endl
       << "\n// currently this option has been tested\n"
       << "// with ossimTiffWriter and ossimJpegWriter\n"
       << "// writer.type: ossimTiffWriter"            << endl
       << "// writer.filename: <full path to output file>"  << endl
       << "\n// Currently, the mosaic application supports\n"
       << "// SIMPLE mosaics (ie. no blending algorithms)\n"
       << "// BLEND  for maps or layers that you want to blend together\n"
       << "// FEATHER for applying a spatial feaher along overlapped regions\n"
       << "// mosaic.type: SIMPLE"                     << endl
       << "\n// product type and projection information" << endl
       << "// is optional.  It will use the first images"<<endl
       << "// geometry information instead." << endl
       << "// product.type: "        << endl
       << "// product.meters_per_pixel_y: "       << endl
       << "// product.meters_per_pixel_x: "       << endl
       << "// product.central_meridian:   " << endl
       << "// product.origin_latitude:"    << endl;

   ossimNotify(ossimNotifyLevel_NOTICE)
      << "Wrote file: " << templateFilename << std::endl;
}
Exemple #18
0
void landsat_optimization(ossimFilename gcpFile, ossimFilename headerFile, ossimFilename elevationpath)
{

	ossimFilename workfold = headerFile.path();
	ossimFilename sourcefile = workfold + "\\header.dat";
	ossimFilename gcpfile = gcpFile;
	ossimFilename reportfile = workfold + "\\report.txt";

	ossimKeywordlist MapProjection;
	MyProject prj;
	prj.m_CtrlGptSet = new ossimTieGptSet;
	prj.m_ChkGptSet = new ossimTieGptSet;
	//vector < ossimTieLine > tieLineList;
	vector<ossimDFeature> imageFeatureList;
	vector<ossimGFeature> groundFeatureList;
	prj.ReadGcpAndProjection(ossimFilename(gcpfile));

	prj.theMgr = ossimElevManager::instance();
	//prj.theMgr->loadElevationPath(ossimFilename(elevationpath));//
	prj.m_DemPath=ossimFilename(elevationpath);

	prj.GetElevations(prj.m_CtrlGptSet);
	prj.GetElevations(prj.m_ChkGptSet);

	ossimMapProjection *MapPar = prj.m_MapPar;
	MapProjection = prj.m_MapProjection;

	prj.m_ImgFileNameUnc = sourcefile;
	prj.InitiateSensorModel(sourcefile);
	prj.UpdateSensorModel(*prj.m_CtrlGptSet, prj.m_sensorModel, prj.geom);
	prj.m_sensorModel->loadState(prj.geom);
	prj.OutputReport(reportfile, prj.m_sensorModel, prj.m_CtrlGptSet, prj.m_ChkGptSet);
}
Exemple #19
0
bool ossimElevManager::loadElevationPath(const ossimFilename& path)
{
   bool result = false;
   ossimElevationDatabase* database = ossimElevationDatabaseRegistry::instance()->open(path);
   
   if(!database&&path.isDir())
   {
      ossimDirectory dir;
      
      if(dir.open(path))
      {
         ossimFilename file;
         dir.getFirst(file, ossimDirectory::OSSIM_DIR_DIRS);
         do
         {
            database = ossimElevationDatabaseRegistry::instance()->open(file);
            if(database)
            {
               result = true;
               addDatabase(database);
            }
         }while(dir.getNext(file));
      }
   }
   else if(database)
   {
      result = true;
      addDatabase(database);
   }
   
   return result;
}
Exemple #20
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;
}
Exemple #21
0
bool ossimErsSarModel::isErsLeader(const ossimFilename& file) const
{
  std::ifstream candidate(file.c_str(), ios::in | ios::binary);
  char ersFileName[16];

  candidate.seekg(48);
  if (candidate.bad() || candidate.eof())
  {
    return false;
  }
  candidate.read(ersFileName, 16);
  if (candidate.bad() || candidate.eof())
  {
    return false;
  }
  candidate.close();

  ossimString ersString(ersFileName);

  if ((ersString.find("ERS") == 0)   &&
      (ersString.find(".SAR.") == 4) &&
      (ersString.find("LEAD") == 12))
  {
    return true;
  }
  else
  {
    return false;
  }

}
ossimDtedHandler::ossimDtedHandler(const ossimFilename& dted_file, bool memoryMapFlag)
   :
      ossimElevCellHandler(dted_file),
      m_fileStr(),
      m_numLonLines(0),
      m_numLatPoints(0),
      m_dtedRecordSizeInBytes(0),
      m_edition(),
      m_productLevel(),
      m_compilationDate(),
      m_offsetToFirstDataRecord(0),
      m_latSpacing(0.0),
      m_lonSpacing(0.0),
      m_swCornerPost(),
      m_swapBytesFlag(false)
{

   static const char MODULE[] = "ossimDtedHandler (Filename) Constructor";
   if (traceExec())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << "DEBUG " << MODULE <<": entering..." << std::endl;
   }
   
   m_swapBytesFlag = ossim::byteOrder() == OSSIM_LITTLE_ENDIAN ? true : false;
   //---
   //  Open the dted file for reading.
   //---
   if (!open(dted_file, memoryMapFlag))
   {
      theErrorStatus = ossimErrorCodes::OSSIM_ERROR;
      
      if (traceDebug())
      {
         ossimNotify(ossimNotifyLevel_FATAL)
            << "FATAL " << MODULE << ": "
            << "\nCould not open file:  " << dted_file.c_str()
            << "\nReturning..." << std::endl;
         ossimNotify(ossimNotifyLevel_DEBUG)
            << "DEBUG " << MODULE << ": returning with error..." << std::endl;
      }
      return;
   }
   else
   {
      if (traceDebug())
      {
         ossimNotify(ossimNotifyLevel_DEBUG)
            << "DEBUG " << MODULE <<": Loading dted file: " << dted_file
            << std::endl;
      }
   }

   // DTED is stored in big endian.
   if (traceExec())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << "DEBUG " << MODULE << ": returning..." << std::endl;
   }
}
//*******************************************************************
// 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;
}
Exemple #24
0
//*******************************************************************
// Private Method:
//*******************************************************************
bool ossimKeywordlist::parseFile(const ossimFilename& file,
                                 bool ignoreBinaryChars)
{
   std::ifstream is;
   is.open(file.c_str(), std::ios::in | std::ios::binary);

   if ( !is.is_open() )
   {
      // ESH 07/2008, Trac #234: OSSIM is case sensitive 
      // when using worldfile templates during ingest
      // -- If first you don't succeed with the user-specified
      // filename, try again with the results of a case insensitive search.
      ossimDirectory directory(file.path());
      ossimFilename filename(file.file());

      std::vector<ossimFilename> result;
      bool bSuccess = directory.findCaseInsensitiveEquivalents( filename, result );
      if ( bSuccess == true )
      {
         int numResults = (int)result.size();
         int i;
         for ( i=0; i<numResults && !is.is_open(); ++i )
         {
            is.open( result[i].c_str(), std::ios::in | std::ios::binary );
         }
      }

      if ( !is.is_open() )
      {
         if ( traceDebug() ) 
         {
            // report all errors that aren't existence problems.
            // we want to know about things like permissions, too many open files, etc.
            ossimNotify(ossimNotifyLevel_DEBUG)
            << "Error opening file: " << file.c_str() << std::endl;
         }
         return false;
      }
   }

   bool result = parseStream(is, ignoreBinaryChars);

   is.close();

   return result;
}
Exemple #25
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;
      }
   }
}
Exemple #26
0
   bool ossimTileMapModel::open(const ossimFilename& file)
   {
      static const char MODULE[] = "ossimTileMapModel::open";

      ossimString os = file.beforePos(4);
  
      if (traceDebug())
      {
         CLOG << " Entered..." << std::endl
              << " trying to open file " << file << std::endl;
      }
      if(os == "http" || file.ext() == "otb")
      {
         return true;
      }
  
      return false;
   }
Exemple #27
0
ossimGeneralRasterElevHandler::ossimGeneralRasterElevHandler(const ossimFilename& file)
   :ossimElevCellHandler(file.c_str()),
    m_streamOpen(false)
{
   if(!open(file))
   {
      setErrorStatus();
   }
}
Exemple #28
0
//**************************************************************************
// 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();
   }
}
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;
}
Exemple #30
0
ossimFilename ossimErsSarModel::findErsLeader(const ossimFilename& file) const
{
  ossimFilename leaFile = file;
  ossimString datString("DAT_01");
  ossimString nulString("NUL_DAT");
  ossimString vdfString("VDF_DAT");
  ossimString leaString("LEA_01");
  if ((file.fileNoExtension() == datString)
      || (file.fileNoExtension() == nulString)
      || (file.fileNoExtension() == leaString))
  {
    leaFile.setFile(leaString);
    if (leaFile.exists())
    {
      return leaFile;
    }
  }
  return file;
}