Commit bab429cd authored by Emmanuel Christophe's avatar Emmanuel Christophe

OSSIM: update ossim to r16861 (v1.8.1)

parent 8e2f7fa7
......@@ -2,7 +2,7 @@ PROJECT(otbossim)
SET(OSSIM_MAJOR_VERSION_NUMBER "1")
SET(OSSIM_MINOR_VERSION_NUMBER "8")
SET(OSSIM_PATCH_VERSION_NUMBER "3dev")
SET(OSSIM_PATCH_VERSION_NUMBER "4")
SET(OSSIM_RELEASE_NUMBER "?")
SET(OSSIM_VERSION "${OSSIM_MAJOR_VERSION_NUMBER}-${OSSIM_MINOR_VERSION_NUMBER}-${OSSIM_PATCH_VERSION_NUMBER}" )
......
......@@ -9,7 +9,7 @@
// Description: This class provides manipulation of filenames.
//
//*************************************************************************
// $Id: ossimFilename.h 16308 2010-01-09 02:45:54Z eshirschorn $
// $Id: ossimFilename.h 16815 2010-03-07 17:22:13Z dburken $
#ifndef ossimFilename_HEADER
#define ossimFilename_HEADER
......@@ -229,13 +229,10 @@ public:
*/
bool needsExpansion() const;
/**
* @brief Returns the path separator.
*/
const char getPathSeparator() const;
protected:
void convertToNative();
void convertToNative();
/*!
* since windows uses \ for path separation
* and unix / we need to be consistent.
......
......@@ -7,7 +7,7 @@
//
// Contains class declaration for ossimNotify
//-------------------------------------------------------------------
// $Id: ossimNotify.h 14789 2009-06-29 16:48:14Z dburken $
// $Id: ossimNotify.h 16636 2010-02-22 19:02:00Z dburken $
#ifndef ossimNotify_HEADER
#define ossimNotify_HEADER
#include <iostream>
......@@ -67,6 +67,10 @@ OSSIMDLLEXPORT std::ostream& ossimNotify(ossimNotifyLevel level = ossimNotifyLev
*/
OSSIMDLLEXPORT void ossimSetLogFilename(const ossimFilename& filename);
/** @brief Returns the log filename if set. */
/* OSSIMDLLEXPORT const char* ossimGetLogFilename(); */
OSSIMDLLEXPORT void ossimGetLogFilename(ossimFilename& logFile);
/**
*
......
......@@ -10,7 +10,7 @@
// parsing and accessing of an XML document file.
//
//*****************************************************************************
// $Id: ossimXmlDocument.h 12521 2008-02-28 20:09:25Z gpotts $
// $Id: ossimXmlDocument.h 16817 2010-03-07 17:25:44Z dburken $
#ifndef ossimXmlDocument_HEADER
#define ossimXmlDocument_HEADER
......@@ -32,7 +32,7 @@ public:
{
return new ossimXmlDocument(*this);
}
~ossimXmlDocument();
virtual ~ossimXmlDocument();
bool write(const ossimFilename& file);
bool openFile(const ossimFilename& filename);
......
......@@ -90,6 +90,19 @@ public:
{
return m_meanSpacing;
}
virtual void setGeoid(ossimGeoid* geoid)
{
m_geoid = geoid;
}
ossimGeoid* getGeoid()
{
return m_geoid.get();
}
const ossimGeoid* getGeoid()const
{
return m_geoid.get();
}
/**
* Open a connection to a database. In most cases this will be a pointer
* to a directory like in a Dted directory reader.
......@@ -122,6 +135,8 @@ protected:
{
m_geoid = 0;
}
virtual double getOffsetFromEllipsoid(const ossimGpt& gpt)const;
virtual void remove(ossim_uint64 id)
{
CellMap::iterator iter = m_cacheMap.find(id);
......
......@@ -12,7 +12,7 @@
// JpegTileSource is derived from ImageHandler which is derived from
// TileSource.
//*******************************************************************
// $Id: ossimJpegTileSource.h 16075 2009-12-10 15:46:43Z gpotts $
// $Id: ossimJpegTileSource.h 16860 2010-03-11 15:28:09Z gpotts $
#ifndef ossimJpegTileSource_HEADER
#define ossimJpegTileSource_HEADER
......@@ -143,6 +143,7 @@ public:
* Returns true if the image_file can be opened and is a valid tiff file.
*/
bool open(const ossimFilename& jpeg_file);
virtual void close();
/**
* @brief Gets a property for matching name.
......
......@@ -18,11 +18,10 @@
#include <ossim/base/ossimConstants.h> /* OSSIM_DLL */
#include <ossim/imaging/ossimImageChain.h>
#include <ossim/base/ossimFilename.h>
// Forward class declarations:
class ossimBandSelector;
class ossimCacheTileSource;
class ossimFilename;
class ossimHistogramRemapper;
class ossimImageHandler;
class ossimImageRenderer;
......@@ -70,6 +69,9 @@ public:
/** @brief close method to delete the image handler. */
void close();
/** @return The filename of the image. */
ossimFilename getFilename() const;
/**
* @brief Create a rendered image chain.
*
......@@ -220,10 +222,19 @@ public:
*/
void setBandSelection(const std::vector<ossim_uint32>& bandList);
private:
/**
* @brief Convenience method to return the scalar type of the image handler.
*
* @return Scalar type of the image handler.
*
* This can return OSSIM_SCALAR_UNKNOWN if the image handler has not been
* set yet. Also, this is NOT the same as calling getOutputScalarType
* which could have a different scalar type than the image if the
* m_remapToEightBitFlag has been set.
*/
ossimScalarType getImageHandlerScalarType() const;
/** The image file name. */
ossimFilename m_file;
private:
/** Pointers to links in chain. */
ossimImageHandler* m_handler;
......
......@@ -17,7 +17,7 @@
// Initial coding.
//<
//*****************************************************************************
// $Id: ossimInit.h 11959 2007-10-31 19:22:56Z gpotts $
// $Id: ossimInit.h 16636 2010-02-22 19:02:00Z dburken $
#ifndef ossimInit_HEADER
#define ossimInit_HEADER
......@@ -81,6 +81,16 @@ public:
void initializeDefaultFactories();
void initializeElevation();
/**
* @brief Initializes log file from preferences keyword lookup
* of "ossim.log.file" if log file has not already been set and
* keyword is set in preferences.
*
* So this should be called after parse options as the --ossim-logfile
* should override any preferences setting.
*/
void initializeLogFile();
/**
* @return The version in the form of:
* "version major.minor.release (yyyymmdd)"
......@@ -104,13 +114,6 @@ protected:
/** Hidden from use assignment operator. */
void operator=(const ossimInit& rhs) const;
/*!
* METHOD: parseOptions()
* Parses the command line as passed in initialize. The options string is
* modified:
*/
void parseOptions(int& argc, char** argv);
void parseOptions(ossimArgumentParser& parser);
void parseNotifyOption(ossimArgumentParser& parser);
......@@ -122,8 +125,6 @@ protected:
void removeOption(int& argc,
char** argv,
int argToRemove);
static ossimInit* theInstance;
bool theInitializedFlag;
......
......@@ -70,7 +70,7 @@ public:
* @param kwl The keyword list to initialize.
* @return true on success, false on error.
*/
bool getKeywordlist(ossimKeywordlist& kwl);
virtual bool getKeywordlist(ossimKeywordlist& kwl);
protected:
/** virtual destructor */
......
......@@ -7,7 +7,7 @@
//
// Contains class definition for ossimNotify.
//*******************************************************************
// $Id: ossimNotify.cpp 16278 2010-01-06 16:50:51Z dburken $
// $Id: ossimNotify.cpp 16636 2010-02-22 19:02:00Z dburken $
#include <iostream>
#include <cstdio>
......@@ -309,6 +309,18 @@ void ossimSetLogFilename(const ossimFilename& filename)
theLogFileStream.setLogFilename(filename);
}
/*
const char* ossimGetLogFilename()
{
return theLogFileStream.getLogFilename().c_str();
}
*/
void ossimGetLogFilename(ossimFilename& logFile)
{
logFile = theLogFileStream.getLogFilename();
}
ossimString ossimErrorV(const char *fmt, va_list args )
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(theMutex);
......
......@@ -24,9 +24,11 @@ double ossimDtedElevationDatabase::getHeightAboveMSL(const ossimGpt& gpt)
double ossimDtedElevationDatabase::getHeightAboveEllipsoid(const ossimGpt& gpt)
{
double h = getHeightAboveMSL(gpt);
if((h != ossim::nan())&&m_geoid.valid())
if(h != ossim::nan())
{
h += m_geoid->offsetFromEllipsoid(gpt);
double offset = getOffsetFromEllipsoid(gpt);
h += offset;
}
return h;
......
......@@ -9,7 +9,7 @@
// from disk. This elevation files are memory mapped.
//
//*****************************************************************************
// $Id: ossimDtedHandler.cpp 16341 2010-01-13 18:22:27Z gpotts $
// $Id: ossimDtedHandler.cpp 16826 2010-03-08 18:47:32Z gpotts $
#include <cstdlib>
#include <cstring> /* for memcpy */
......@@ -222,14 +222,14 @@ double ossimDtedHandler::getHeightAboveMSLFile(const ossimGpt& gpt)
int x0 = static_cast<int>(xi);
int y0 = static_cast<int>(yi);
// Check for right edge.
if (gpt.lon == theGroundRect.lr().lon)
if(x0 == (m_numLonLines-1))
{
--x0; // Move over one post.
}
// Check for top edge.
if (gpt.lat == theGroundRect.ul().lat)
// if (gpt.lat == theGroundRect.ul().lat)
if(y0 == (m_numLatPoints-1))
{
--y0; // Move down one post.
}
......
......@@ -13,6 +13,26 @@ void ossimElevationDatabase::getOpenCellList(std::vector<ossimFilename>& list) c
}
double ossimElevationDatabase::getOffsetFromEllipsoid(const ossimGpt& gpt)const
{
double result = 0.0;
if(m_geoid.valid())
{
result = m_geoid->offsetFromEllipsoid(gpt);
}
else
{
result = ossimGeoidManager::instance()->offsetFromEllipsoid(gpt);
}
if(ossim::isnan(result))
{
result = 0.0;
}
return result;
}
bool ossimElevationDatabase::loadState(const ossimKeywordlist& kwl, const char* prefix)
{
m_connectionString = kwl.find(prefix, "connection_string");
......
......@@ -20,9 +20,9 @@ double ossimGeneralRasterElevationDatabase::getHeightAboveMSL(const ossimGpt& gp
double ossimGeneralRasterElevationDatabase::getHeightAboveEllipsoid(const ossimGpt& gpt)
{
double h = getHeightAboveMSL(gpt);
if((h != ossim::nan())&&m_geoid.valid())
if(h != ossim::nan())
{
h += m_geoid->offsetFromEllipsoid(gpt);
h += getOffsetFromEllipsoid(gpt);
}
return h;
......
......@@ -36,9 +36,9 @@ double ossimSrtmElevationDatabase::getHeightAboveMSL(const ossimGpt& gpt)
double ossimSrtmElevationDatabase::getHeightAboveEllipsoid(const ossimGpt& gpt)
{
double h = getHeightAboveMSL(gpt);
if((h != ossim::nan())&&m_geoid.valid())
if(h != ossim::nan())
{
h += m_geoid->offsetFromEllipsoid(gpt);
h += getOffsetFromEllipsoid(gpt);
}
return h;
......@@ -107,7 +107,7 @@ bool ossimSrtmElevationDatabase::openSrtmDirectory(const ossimFilename& dir)
ossimNotify(ossimNotifyLevel_DEBUG) << "ossimSrtmElevationDatabase::open: Found file " << f << "\n";
if(!m_geoid.valid())
{
ossimNotify(ossimNotifyLevel_DEBUG) << "ossimSrtmElevationDatabase::open: Unable to load goeid grid 1996 for DTED database\n";
ossimNotify(ossimNotifyLevel_DEBUG) << "ossimSrtmElevationDatabase::open: Unable to load goeid grid 1996 for SRTM database\n";
}
}
return true;
......
......@@ -9,7 +9,7 @@
// Shuttle Radar Topography Mission (SRTM) elevation source.
//
//----------------------------------------------------------------------------
// $Id$
// $Id: ossimSrtmHandler.cpp 16826 2010-03-08 18:47:32Z gpotts $
#include <ossim/elevation/ossimSrtmHandler.h>
#include <ossim/base/ossimCommon.h>
......
......@@ -8,7 +8,7 @@
// Author: Garrett Potts
//
//*************************************************************************
// $Id: ossimImageChain.cpp 15833 2009-10-29 01:41:53Z eshirschorn $
// $Id: ossimImageChain.cpp 16816 2010-03-07 17:23:23Z dburken $
#include <algorithm>
#include <iostream>
#include <iterator>
......@@ -862,28 +862,25 @@ ossimRefPtr<ossimImageData> ossimImageChain::getTile(
{
if((theImageChainList.size() > 0)&&(isSourceEnabled()))
{
ossimImageSource* interface = PTR_CAST(ossimImageSource,
theImageChainList[0].get());
if(interface)
{
// make sure we initialize in reverse order.
// some source may depend on the initialization of
// its inputs
return interface->getTile(tileRect, resLevel);
}
ossimImageSource* interface = PTR_CAST(ossimImageSource,
theImageChainList[0].get());
if(interface)
{
// make sure we initialize in reverse order.
// some source may depend on the initialization of
// its inputs
return interface->getTile(tileRect, resLevel);
}
}
else
{
if(getInput(0))
{
ossimImageSource* interface = PTR_CAST(ossimImageSource,
getInput(0));
ossimImageSource* interface = PTR_CAST(ossimImageSource, getInput(0));
if(interface)
{
return interface->getTile(tileRect,
resLevel);
return interface->getTile(tileRect, resLevel);
}
}
}
......
......@@ -8,7 +8,7 @@
//
// Contains class definition for JpegTileSource.
//*******************************************************************
// $Id: ossimJpegTileSource.cpp 16075 2009-12-10 15:46:43Z gpotts $
// $Id: ossimJpegTileSource.cpp 16860 2010-03-11 15:28:09Z gpotts $
#if defined(__BORLANDC__)
#include <iostream>
using std::size_t;
......@@ -435,6 +435,11 @@ bool ossimJpegTileSource::loadState(const ossimKeywordlist& kwl,
return false;
}
void ossimJpegTileSource::close()
{
destroy();
}
//*******************************************************************
// Public method:
......
......@@ -67,21 +67,11 @@ void ossimNitfWriterBase::setProperty(ossimRefPtr<ossimProperty> property)
if (name == ENABLE_RPCB_KW)
{
ossimBooleanProperty* boolProperty = PTR_CAST(ossimBooleanProperty,
property.get());
if (boolProperty)
{
theEnableRpcbTagFlag = boolProperty->getBoolean();
}
theEnableRpcbTagFlag = property->valueToString().toBool();
}
else if (name == ENABLE_BLOCKA_KW)
{
ossimBooleanProperty* boolProperty = PTR_CAST(ossimBooleanProperty,
property.get());
if (boolProperty)
{
theEnableBlockaTagFlag = boolProperty->getBoolean();
}
theEnableBlockaTagFlag = property->valueToString().toBool();
}
else
{
......
......@@ -13,8 +13,9 @@
#include <ossim/imaging/ossimSingleImageChain.h>
#include <ossim/imaging/ossimCacheTileSource.h>
#include <ossim/base/ossimFilename.h>
#include <ossim/imaging/ossimBandSelector.h>
#include <ossim/imaging/ossimCacheTileSource.h>
#include <ossim/imaging/ossimHistogramRemapper.h>
#include <ossim/imaging/ossimImageHandler.h>
#include <ossim/imaging/ossimImageHandlerRegistry.h>
......@@ -24,7 +25,6 @@
ossimSingleImageChain::ossimSingleImageChain()
:
ossimImageChain(),
m_file(ossimFilename::NIL),
m_handler(0),
m_bandSelector(0),
m_histogramRemapper(0),
......@@ -51,7 +51,6 @@ void ossimSingleImageChain::reset()
result = deleteLast();
} while (result);
m_file = ossimFilename::NIL;
m_handler = 0;
m_bandSelector = 0;
m_histogramRemapper = 0;
......@@ -75,6 +74,16 @@ void ossimSingleImageChain::close()
}
}
ossimFilename ossimSingleImageChain::getFilename() const
{
ossimFilename result;
if (m_handler)
{
result = m_handler->getFilename();
}
return result;
}
bool ossimSingleImageChain::open(const ossimFilename& file)
{
return addImageHandler(file);
......@@ -388,3 +397,12 @@ void ossimSingleImageChain::setBandSelection(
m_histogramRemapper->initialize();
}
}
ossimScalarType ossimSingleImageChain::getImageHandlerScalarType() const
{
ossimScalarType result = OSSIM_SCALAR_UNKNOWN;
if (m_handler)
{
result = m_handler->getOutputScalarType();
}
return result;
}
......@@ -16,7 +16,7 @@
// 24Apr2001 Oscar Kramer
// Initial coding.
//*****************************************************************************
// $Id: ossimInit.cpp 16425 2010-01-27 20:09:13Z gpotts $
// $Id: ossimInit.cpp 16636 2010-02-22 19:02:00Z dburken $
#include <ossim/init/ossimInit.h>
......@@ -110,42 +110,11 @@ void ossimInit::addOptions(ossimArgumentParser& parser)
*****************************************************************************/
void ossimInit::initialize(int& argc, char** argv)
{
if(theInitializedFlag)
if( !theInitializedFlag )
{
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "DEBUG ossimInit::initialize(argc, argv): Already initialized, returning......"
<< std::endl;
}
return;
ossimArgumentParser argumentParser(&argc, argv);
theInstance->initialize(argumentParser);
}
theInstance->theAppName = argv[0];
theInstance->thePreferences = ossimPreferences::instance();
// Parse the command line:
theInstance->parseOptions(argc, argv);
theInstance->initializeDefaultFactories();
theInstance->initializeElevation();
if(thePluginLoaderEnabledFlag)
{
theInstance->initializePlugins();
}
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossim preferences file: "
<< theInstance->thePreferences->getPreferencesFilename()
<< "\nVersion: " << version()
<< "\nossimInit::initialize(argc, argv) leaving..."
<< std::endl;
}
theInitializedFlag = true;
}
void ossimInit::initialize(ossimArgumentParser& parser)
......@@ -171,6 +140,8 @@ void ossimInit::initialize(ossimArgumentParser& parser)
theInstance->initializeDefaultFactories();
theInstance->initializeElevation();
theInstance->initializeLogFile();
if(thePluginLoaderEnabledFlag)
{
theInstance->initializePlugins();
......@@ -211,6 +182,7 @@ void ossimInit::initialize()
theInstance->thePreferences = ossimPreferences::instance();
theInstance->initializeDefaultFactories();
theInstance->initializeElevation();
theInstance->initializeLogFile();
//---
// To do:
......@@ -299,7 +271,6 @@ void ossimInit::loadPlugins(const ossimFilename& plugin)
ossimSharedPluginRegistry::instance()->registerPlugin(plugin);
}
}
}
void ossimInit::parseOptions(ossimArgumentParser& parser)
......@@ -381,107 +352,6 @@ void ossimInit::parseOptions(ossimArgumentParser& parser)
}
}
/*!****************************************************************************
* METHOD: ossimInit::parseOptions()
*
* Parses the command line options.
*
*****************************************************************************/
void ossimInit::parseOptions(int& argc, char** argv)
{
if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG)
<< "DEBUG ossimInit::parseOptions(argc, argv): entering..." << std::endl;
int currArgc = 1;
while (currArgc < argc)
{
if(argv[currArgc][0] == '-')
{
switch (argv[currArgc][1])
{
case 'P':
{
/*!
* OPTION_SYNTAX: -P<pref_filename>
* This option permits replacing the default preferences file
* with a different, user-specified keyword preference file:
*/
ossimFilename pref_file = (&argv[currArgc][2]);
thePreferences->loadPreferences(pref_file);
removeOption (argc, argv, currArgc--);
break;
}
case 'K':
{
/*!
* OPTION SYNTAX: -K<keyword>[=<value>]
* This option used to add a keyword to the already loaded
* preferences KWL:
*/
ossimString option = (&argv[currArgc][2]);
if (option.contains("=") )
{
ossimString delimiter = "=";
ossimString key (option.before(delimiter));
ossimString value = option.after(delimiter);
thePreferences->addPreference(key.c_str(), value.c_str());
}
else
{
ossimString key (option);
thePreferences->addPreference(key, "");
}
removeOption (argc, argv, currArgc--);
break;
}
case 'T':
{
/*!
* OPTION SYNTAX: -T<trace_tag>
* Turns on the trace flag for all trace objects matching
* the trace_tag:
*/
ossimString tag = (&argv[currArgc][2]);
if (tag.empty())
{
// Someone did -T "some_tag" instead of -T"some_tag"