OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ossimElevManager Class Reference

#include <ossimElevManager.h>

Inheritance diagram for ossimElevManager:
ossimElevSource ossimSource ossimConnectableObject ossimErrorStatusInterface ossimObject ossimListenerManager ossimPropertyInterface ossimReferenced

Classes

class  ConnectionStringVisitor
 

Public Types

typedef std::vector< ossimRefPtr< ossimElevationDatabase > > ElevationDatabaseListType
 
- Public Types inherited from ossimConnectableObject
enum  ossimConnectableObjectDirectionType { CONNECTABLE_DIRECTION_NONE = 0, CONNECTABLE_DIRECTION_INPUT = 1, CONNECTABLE_DIRECTION_OUTPUT = 2 }
 
typedef std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
 

Public Member Functions

virtual ~ossimElevManager ()
 
virtual double getHeightAboveEllipsoid (const ossimGpt &gpt)
 
virtual double getHeightAboveMSL (const ossimGpt &gpt)
 Height access methods: More...
 
virtual bool pointHasCoverage (const ossimGpt &) const
 METHOD: pointHasCoverage(gpt) Returns TRUE if coverage exists over gpt: More...
 
virtual double getMeanSpacingMeters () const
 Returns the mean post spacing (in meters) for the highest resolution DEM in the list or NaN if no DEMs have been loaded. More...
 
virtual bool getAccuracyInfo (ossimElevationAccuracyInfo &info, const ossimGpt &gpt) const
 
ossim_uint32 getNumberOfElevationDatabases () const
 
ossimElevationDatabasegetElevationDatabase (ossim_uint32 idx)
 
const ossimElevationDatabasegetElevationDatabase (ossim_uint32 idx) const
 
void addDatabase (ossimElevationDatabase *database, bool set_as_first=false)
 Adds a new elevation database to the collection. More...
 
bool loadElevationPath (const ossimFilename &path, bool set_as_first=false)
 Adds a new elevation file (or multiple files if path is a directory) to the collection. More...
 
void setDefaultHeightAboveEllipsoid (double meters)
 
void setElevationOffset (double meters)
 
double getElevationOffset () const
 
void getOpenCellList (std::vector< ossimFilename > &list) const
 
void getCellsForBounds (const std::string &connectionString, const ossim_float64 &minLat, const ossim_float64 &minLon, const ossim_float64 &maxLat, const ossim_float64 &maxLon, std::vector< ossimFilename > &cells, ossim_uint32 maxNumberOfCells=0)
 Gets a list of elevation cells needed to cover bounding box. More...
 
void getCellsForBounds (const ossim_float64 &minLat, const ossim_float64 &minLon, const ossim_float64 &maxLat, const ossim_float64 &maxLon, std::vector< ossimFilename > &cells, ossim_uint32 maxNumberOfCells=0)
 Gets a list of elevation cells needed to cover bounding box. More...
 
void getCellsForBounds (const ossimGrect &bounds, std::vector< ossimFilename > &cells, ossim_uint32 maxNumberOfCells=0)
 
void setUseGeoidIfNullFlag (bool flag)
 
bool getUseGeoidIfNullFlag () const
 
void setRoundRobinMaxSize (ossim_uint32 size)
 
void clear ()
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Method to save the state of an object to a keyword list. More...
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 Method to the load (recreate) the state of an object from a keyword list. More...
 
virtual void accept (ossimVisitor &visitor)
 We will add a visitor interface for all connectable objects. More...
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
- Public Member Functions inherited from ossimElevSource
bool intersectRay (const ossimEcefRay &ray, ossimGpt &gpt, double defaultElevValue=0.0)
 METHOD: intersectRay() More...
 
virtual double getMinHeightAboveMSL () const
 Access methods for the bounding elevations: More...
 
virtual double getMaxHeightAboveMSL () const
 
double getNullHeightValue () const
 Special numeric quantities as defined by this source: More...
 
double getSeaLevelValue () const
 
virtual const ossimGrectgetBoundingGndRect () const
 METHODS: accuracyLE90(), accuracyCE90() Returns the vertical and horizontal accuracy (90% confidence) in the region of gpt: More...
 
virtual bool canConnectMyInputTo (ossim_int32 inputIndex, const ossimConnectableObject *object) const
 required to be overriden by derived classes More...
 
virtual void initialize ()
 Implement ossimSource base-class pure virtuals: More...
 
virtual bool getComputeStatisticsFlag () const
 Opens a stream to an elevation cell. More...
 
virtual void setComputeStatisticsFlag (bool flag)
 Sets the flag which controls whether or not statistics will be computed upon opening a cell and not finding a corresponding statistics file. More...
 
- Public Member Functions inherited from ossimSource
 ossimSource (ossimObject *owner=0)
 
 ossimSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimSource ()
 
virtual bool isSourceEnabled () const
 
virtual void enableSource ()
 
virtual void disableSource ()
 
virtual bool getEnableFlag () const
 
virtual void setEnableFlag (bool flag)
 
virtual bool isInitialized () const
 
virtual void setInitializedFlag (bool flag)
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 
- Public Member Functions inherited from ossimConnectableObject
 ossimConnectableObject (ossimObject *owner=0)
 Base constructor of this object. More...
 
 ossimConnectableObject (ossimObject *owner, ossim_int32 inputListSize, ossim_int32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimConnectableObject ()
 
void setId (const ossimId &id)
 All connectable objects will have id's. More...
 
const ossimIdgetId () const
 Will allow us to get this object's id. More...
 
const ossimObjectgetOwner () const
 Fetches the current owner, most likely a container but not limited to one. More...
 
virtual void changeOwner (ossimObject *owner)
 Permits changing the object's owner. More...
 
virtual void setDescription (const ossimString &description)
 
virtual ossimString getDescription () const
 
virtual bool isConnected (ossimConnectableObjectDirectionType direction=CONNECTABLE_DIRECTION_INPUT) const
 will check the direction specified to see if all slots are full. More...
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findConnectableObject(const ossimId &id))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(RTTItypeid typeId, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(const ossimString &obj, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findInputObjectOfType(const ossimString &className))
 
virtual ossim_int32 findInputIndex (const ossimConnectableObject *object)
 Return a valid index of the input list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findInputIndex (const ossimId &id)
 Return a valid index of the input list if the passed id is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimConnectableObject *object)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimId &id)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 getMyInputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual ossim_int32 getMyOutputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual bool canConnectMyOutputTo (ossim_int32 myOutputIndex, const ossimConnectableObject *object) const
 default implementation is to allow anyone to connect to us. More...
 
virtual void disconnect (ossimConnectableObject *object=0)
 Will disconnect the object passed in. More...
 
virtual void disconnect (const ossimId &id)
 Will disconnect the object passed in. More...
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyInput (ossim_int32 inputIndex, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given input index and generate a connection event. More...
 
virtual void disconnectMyInput (ossimConnectableObject *input, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Finds the index of the passed in input and calls disconnectMyInput(inputIndex, disconnectOutputFlag, createEventFlag);. More...
 
virtual void disconnectMyInputs (ConnectableObjectList &inputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyOutput (ossim_int32 outputIndex, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given output index and generate a connection event. More...
 
virtual void disconnectMyOutput (ossimConnectableObject *output, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the output object. More...
 
virtual void disconnectMyOutputs (ConnectableObjectList &outputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual void disconnectAllInputs ()
 Will disconnect all of the input objects. More...
 
virtual void disconnectAllOutputs ()
 Will disconnect all of the output objects. More...
 
virtual ossim_int32 connectMyInputTo (ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will try to connect this objects input to the passed in object. More...
 
virtual ossim_int32 connectMyInputTo (ossim_int32 inputIndex, ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will connect the specified input to the passed in object. More...
 
virtual bool connectMyInputTo (ConnectableObjectList &inputList, bool makeOutputConnection=true, bool createEventFlag=true)
 
virtual ossim_int32 connectMyOutputTo (ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
 Will try to connect this objects output to the passed in object. More...
 
virtual bool connectMyOutputTo (ConnectableObjectList &outputList, bool makeInputConnection=true, bool createEventFlag=true)
 
virtual bool connectInputList (ConnectableObjectList &inputList)
 Will disconnect itself from all inputs and reset to the passed in input list. More...
 
virtual bool connectOutputList (ConnectableObjectList &outputList)
 Will disconnect itself from all outputs and reset to the passed in output list. More...
 
virtual ossim_uint32 getNumberOfInputs () const
 Returns the number of input objects. More...
 
virtual ossim_uint32 getNumberOfOutputs () const
 Return the number of output objects. More...
 
ossimConnectableObjectgetInput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetInput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
ossimConnectableObjectgetOutput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetOutput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
virtual void setNumberOfInputs (ossim_int32 numberOfInputs)
 Will set the number of inputs. More...
 
virtual bool getInputListIsFixedFlag () const
 
virtual bool getOutputListIsFixedFlag () const
 
virtual void setNumberOfOutputs (ossim_int32 numberOfInputs)
 Will set the number of outputs. More...
 
const ConnectableObjectListgetInputList () const
 
const ConnectableObjectListgetOutputList () const
 
ConnectableObjectListgetInputList ()
 
ConnectableObjectListgetOutputList ()
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const RTTItypeid &typeInfo, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const ossimString &className, bool recurse=true))
 
virtual void propagateEventToOutputs (ossimEvent &event)
 
virtual void propagateEventToInputs (ossimEvent &event)
 
virtual void setProperty (const ossimString &name, const ossimString &value)
 
virtual ossim_uint32 saveStateOfAllInputs (ossimKeywordlist &kwl, bool saveThisStateFlag=true, ossim_uint32 objectIndex=1, const char *prefix=0) const
 Save the state of all inputs to a keyword list. More...
 
virtual bool fillContainer (ossimConnectableContainer &container)
 Inserts this object and all of its children and inputs into the container provided. More...
 
bool moveInputUp (const ossimId &id)
 Moves the input connection matching id up one in the connection list. More...
 
bool moveInputDown (const ossimId &id)
 Moves the input connection matching id down one in the connection list. More...
 
bool moveInputToTop (const ossimId &id)
 Moves the input connection matching id to the top of the connection list. More...
 
bool moveInputToBottom (const ossimId &id)
 Moves the input connection matching id to the bottom of the connection list. More...
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimListenerManager
 ossimListenerManager ()
 
virtual ~ossimListenerManager ()
 
virtual void fireEvent (ossimEvent &event)
 
virtual bool addListener (ossimListener *listener)
 
virtual bool removeListener (ossimListener *listener)
 
virtual bool findListener (ossimListener *listener)
 
- Public Member Functions inherited from ossimPropertyInterface
 ossimPropertyInterface ()
 
virtual ~ossimPropertyInterface ()
 
virtual ossimString getPropertyValueAsString (const ossimString &name) const
 
void getPropertyList (std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
 
void setProperties (std::vector< ossimRefPtr< ossimProperty > > &propertyList)
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 

Static Public Member Functions

static ossimElevManagerinstance ()
 METHOD: instance() Implements singelton pattern. More...
 

Protected Member Functions

virtual ossimObjectdup () const
 
 ossimElevManager ()
 
void loadStandardElevationPaths ()
 
ElevationDatabaseListTypegetNextElevDbList () const
 
- Protected Member Functions inherited from ossimElevSource
virtual ~ossimElevSource ()
 
 ossimElevSource ()
 Constructors/Destructors: More...
 
 ossimElevSource (const ossimElevSource &src)
 
- Protected Member Functions inherited from ossimSource
 ossimSource (const ossimSource &rhs)
 
const ossimSourceoperator= (const ossimSource &rhs)
 
- Protected Member Functions inherited from ossimConnectableObject
ossimConnectableObjectfindObjectOfType (ConnectableObjectList *connectableList, ossimVisitor &visitor)
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimListenerManager
 ossimListenerManager (const ossimListenerManager &rhs)
 

Protected Attributes

std::vector< ElevationDatabaseListTypem_dbRoundRobin
 
ossim_uint32 m_maxRoundRobinSize
 
ossim_float64 m_defaultHeightAboveEllipsoid
 
ossim_float64 m_elevationOffset
 
bool m_useGeoidIfNullFlag
 
bool m_useStandardPaths
 
ossim_uint32 m_currentDatabaseIdx
 
std::mutex m_mutex
 I have tried the readwrite lock interfaces but have found it unstable. More...
 
- Protected Attributes inherited from ossimElevSource
double theMinHeightAboveMSL
 Data members: More...
 
double theMaxHeightAboveMSL
 
double theNullHeightValue
 
double theSeaLevelValue
 
ossimGrect theGroundRect
 
bool theComputeStatsFlag
 
- Protected Attributes inherited from ossimSource
bool theEnableFlag
 
bool theInitializedFlag
 
- Protected Attributes inherited from ossimConnectableObject
ossimId theId
 
ossimString theDescription
 
ossimObjecttheOwner
 
bool theInputListIsFixedFlag
 Indicates whether the theInputObjectList is fixed. More...
 
bool theOutputListIsFixedFlag
 Indicates whether the theOutputObjectList is fixed. More...
 
ConnectableObjectList theInputObjectList
 Holds a list of input objects. More...
 
ConnectableObjectList theOutputObjectList
 Holds a list of output objects. More...
 
- Protected Attributes inherited from ossimListenerManager
std::list< ossimListener * > theListenerList
 
bool theEnabledFlag
 
std::list< ossimListener * > theDelayedAdd
 
std::list< ossimListener * > theDelayedRemove
 
bool theFireEventFlag
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 

Detailed Description

Definition at line 30 of file ossimElevManager.h.

Member Typedef Documentation

◆ ElevationDatabaseListType

Definition at line 33 of file ossimElevManager.h.

Constructor & Destructor Documentation

◆ ~ossimElevManager()

ossimElevManager::~ossimElevManager ( )
virtual

Definition at line 96 of file ossimElevManager.cpp.

References clear().

97 {
98  clear();
99 }

◆ ossimElevManager()

ossimElevManager::ossimElevManager ( )
protected

Definition at line 79 of file ossimElevManager.cpp.

80  :ossimElevSource(),
84  m_useGeoidIfNullFlag(false),
85  m_useStandardPaths(false),
87  m_mutex()
88 {
89  //---
90  // Auto load removed to avoid un-wanted directory scanning.
91  // Use ossim preferences. drb - 28 March 2016.
92  //---
93  // loadStandardElevationPaths();
94 }
ossim_float64 m_elevationOffset
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
ossim_uint32 m_maxRoundRobinSize
ossimElevSource()
Constructors/Destructors:
std::mutex m_mutex
I have tried the readwrite lock interfaces but have found it unstable.
ossim_float64 m_defaultHeightAboveEllipsoid
ossim_uint32 m_currentDatabaseIdx

Member Function Documentation

◆ accept()

void ossimElevManager::accept ( ossimVisitor visitor)
virtual

We will add a visitor interface for all connectable objects.

Reimplemented from ossimConnectableObject.

Definition at line 359 of file ossimElevManager.cpp.

References m_dbRoundRobin, and ossimVisitor::stopTraversal().

Referenced by getCellsForBounds().

360 {
361  std::vector<ElevationDatabaseListType>::iterator rri = m_dbRoundRobin.begin();
362  while ( rri != m_dbRoundRobin.end() )
363  {
364  ElevationDatabaseListType& elevDbList = *rri;
365 
366  ossimElevManager::ElevationDatabaseListType::iterator i = elevDbList.begin();
367  while ( i != elevDbList.end() )
368  {
369  if ( (*i).valid() )
370  {
371  (*i)->accept( visitor );
372 
373  if ( visitor.stopTraversal() )
374  {
375  break;
376  }
377  }
378  ++i;
379  }
380  ++rri;
381  }
382 }
std::vector< ossimRefPtr< ossimElevationDatabase > > ElevationDatabaseListType
bool stopTraversal() const
std::vector< ElevationDatabaseListType > m_dbRoundRobin

◆ addDatabase()

void ossimElevManager::addDatabase ( ossimElevationDatabase database,
bool  set_as_first = false 
)

Adds a new elevation database to the collection.

Normally pushed on to the tail of the list, unless set_as_first=true, in which case this database will receive the first requests.

Definition at line 600 of file ossimElevManager.cpp.

References ossimElevSource::dup(), and m_dbRoundRobin.

Referenced by ossimPointCloudTool::loadDem(), and loadElevationPath().

601 {
602  if(!database)
603  return;
604 
605  if (m_dbRoundRobin.empty())
606  m_dbRoundRobin.resize(1);
607 
608  std::vector<ElevationDatabaseListType>::iterator rri = m_dbRoundRobin.begin();
609  if (std::find(rri->begin(), rri->end(), database) == rri->end())
610  {
611  if (set_as_first)
612  rri->insert(rri->begin(), database);
613  else
614  rri->push_back(database);
615 
616  // Populate the parallel lists in the round-robin with duplicates:
617  ++rri;
618  while ( rri != m_dbRoundRobin.end() )
619  {
621  if (set_as_first)
622  rri->insert(rri->begin(), dupDb);
623  else
624  rri->push_back(dupDb);
625  ++rri;
626  }
627  }
628 }
virtual ossimObject * dup() const =0
std::vector< ElevationDatabaseListType > m_dbRoundRobin

◆ clear()

void ossimElevManager::clear ( )

Definition at line 349 of file ossimElevManager.cpp.

References m_dbRoundRobin.

Referenced by ossimPointCloudTool::loadDem(), and ~ossimElevManager().

350 {
351  std::vector<ElevationDatabaseListType>::iterator i = m_dbRoundRobin.begin();
352  while ( i != m_dbRoundRobin.end() )
353  {
354  i->clear();
355  ++i;
356  }
357 }
std::vector< ElevationDatabaseListType > m_dbRoundRobin

◆ dup()

virtual ossimObject* ossimElevManager::dup ( ) const
inlineprotectedvirtual

Implements ossimElevSource.

Definition at line 169 of file ossimElevManager.h.

169 { return 0; } // required to implement but not permitted to call

◆ getAccuracyInfo()

bool ossimElevManager::getAccuracyInfo ( ossimElevationAccuracyInfo info,
const ossimGpt gpt 
) const
virtual

Implements ossimElevSource.

Definition at line 384 of file ossimElevManager.cpp.

References getNextElevDbList().

Referenced by ossimHgtRef::getSurfaceCovMatrix().

385 {
387  for(ossim_uint32 idx = 0;(idx < elevDbList.size()); ++idx)
388  {
389  if(elevDbList[idx]->getAccuracyInfo(info, gpt))
390  {
391  return true;
392  }
393  }
394 
395  return false;
396 }
virtual bool getAccuracyInfo(ossimElevationAccuracyInfo &info, const ossimGpt &gpt) const
std::vector< ossimRefPtr< ossimElevationDatabase > > ElevationDatabaseListType
unsigned int ossim_uint32
ElevationDatabaseListType & getNextElevDbList() const

◆ getCellsForBounds() [1/3]

void ossimElevManager::getCellsForBounds ( const std::string &  connectionString,
const ossim_float64 minLat,
const ossim_float64 minLon,
const ossim_float64 maxLat,
const ossim_float64 maxLon,
std::vector< ossimFilename > &  cells,
ossim_uint32  maxNumberOfCells = 0 
)

Gets a list of elevation cells needed to cover bounding box.

Parameters
connectionStringTypically elevation repository, e.g.: "/data1/elevation/srtm/1arc"
minLatMinimum latitude of bounding box.
minLonMinimum longitude of bounding box.
maxLatMaximum latitude of bounding box.
maxLonMaximum longitude of bounding box.
cellsInitialized by this.
maxNumberOfCellsValue of 0 indicates return as many as you can. Any positive number will only return that number of cells.

Definition at line 262 of file ossimElevManager.cpp.

References accept(), ossimRefPtr< T >::get(), ossimElevationCellDatabase::getCellsForBounds(), ossimElevManager::ConnectionStringVisitor::getElevationDatabase(), ossimElevationDatabaseRegistry::instance(), ossimElevationDatabaseRegistry::open(), and ossimRefPtr< T >::valid().

Referenced by getCellsForBounds(), ossimSlopeTool::initProcessingChain(), and ossimChipProcTool::mosaicDemSources().

269 {
271 
272  // See if the connectionString is already opened:
273  ossimString os = connectionString;
275  accept( visitor );
276  cellDatabase = dynamic_cast<ossimElevationCellDatabase*>( visitor.getElevationDatabase() );
277 
278  if ( cellDatabase.valid() == false )
279  {
280  // Try to open it:
283 
284  if ( db.valid() )
285  {
286  cellDatabase = dynamic_cast<ossimElevationCellDatabase*>( db.get() );
287  }
288  }
289 
290  // Lastly get the files:
291  if ( cellDatabase.valid() )
292  {
293  cellDatabase->getCellsForBounds( minLat, minLon, maxLat, maxLon, cells, maxNumberOfCells );
294  }
295  else
296  {
297  // Bummer:
298  cells.clear();
299  }
300 }
static ossimElevationDatabaseRegistry * instance()
virtual void accept(ossimVisitor &visitor)
We will add a visitor interface for all connectable objects.
bool valid() const
Definition: ossimRefPtr.h:75
void getCellsForBounds(const ossim_float64 &minLat, const ossim_float64 &minLon, const ossim_float64 &maxLat, const ossim_float64 &maxLon, std::vector< ossimFilename > &cells, ossim_uint32 maxNumberOfCells=0)
Gets a list of elevation cells needed to cover bounding box.
ossimElevationDatabase * open(const ossimString &connectionString)

◆ getCellsForBounds() [2/3]

void ossimElevManager::getCellsForBounds ( const ossim_float64 minLat,
const ossim_float64 minLon,
const ossim_float64 maxLat,
const ossim_float64 maxLon,
std::vector< ossimFilename > &  cells,
ossim_uint32  maxNumberOfCells = 0 
)

Gets a list of elevation cells needed to cover bounding box.

This implementation sorts elevation repositories by resolution, best first, then searches cells for bounds. Search is stopped on the first repository that has cells.

Parameters
minLatMinimum latitude of bounding box.
minLonMinimum longitude of bounding box.
maxLatMaximum latitude of bounding box.
maxLonMaximum longitude of bounding box.
cellsInitialized by this.
maxNumberOfCellsValue of 0 indicates return as many as you can. Any positive number will only return that number of cells.

Definition at line 302 of file ossimElevManager.cpp.

References getHeightAboveMSL(), getOpenCellList(), ossimGpt::lat, and ossimGpt::lon.

308 {
309  //TODO: Presently incrementing by 0.1 deg. If an elev cell
310  // is smaller than this, it may be missed. Need to generalize to support arbitrary cell sizes.
311 
312  //TODO: This method relies on the caching of open cells. If the bounds are too large too permit
313  // all cells to remain open, this method will incorrectly return a subset of all cells providing
314  // coverage.
315 
316  // Ping the collection of databases for elevation values at regular intervals inside the bounds.
317  // This will autoload the best cells:
318  cells.clear();
319  const ossim_float64 DELTA_DEG = 0.1; // degree
320  ossimGpt gpt;
321  for (gpt.lat=minLat; gpt.lat<=maxLat; gpt.lat+=DELTA_DEG)
322  {
323  for (gpt.lon=minLon; gpt.lon<=maxLon; gpt.lon+=DELTA_DEG)
324  {
325  getHeightAboveMSL(gpt);
326  }
327  }
328 
329  // Convert filename list to string list (why are they different)?
330  ossim_uint32 limitCells = maxNumberOfCells>0?maxNumberOfCells:static_cast<ossim_uint32>(9999999999);
331  std::vector<ossimFilename> open_cells;
332  getOpenCellList(open_cells);
333  std::vector<ossimFilename>::iterator iter = open_cells.begin();
334  while ((iter != open_cells.end()) && (cells.size() < limitCells))
335  {
336  cells.push_back(*iter);
337  ++iter;
338  }
339 }
void getOpenCellList(std::vector< ossimFilename > &list) const
double ossim_float64
ossim_float64 lon
Definition: ossimGpt.h:266
unsigned int ossim_uint32
virtual double getHeightAboveMSL(const ossimGpt &gpt)
Height access methods:
ossim_float64 lat
Definition: ossimGpt.h:265

◆ getCellsForBounds() [3/3]

void ossimElevManager::getCellsForBounds ( const ossimGrect bounds,
std::vector< ossimFilename > &  cells,
ossim_uint32  maxNumberOfCells = 0 
)

Definition at line 342 of file ossimElevManager.cpp.

References getCellsForBounds(), ossimGpt::lat, ossimGpt::lon, ossimGrect::lr(), and ossimGrect::ul().

345 {
346  getCellsForBounds(bbox.lr().lat, bbox.ul().lon, bbox.ul().lat, bbox.lr().lon, cells, maxCells);
347 }
void getCellsForBounds(const std::string &connectionString, const ossim_float64 &minLat, const ossim_float64 &minLon, const ossim_float64 &maxLat, const ossim_float64 &maxLon, std::vector< ossimFilename > &cells, ossim_uint32 maxNumberOfCells=0)
Gets a list of elevation cells needed to cover bounding box.

◆ getElevationDatabase() [1/2]

ossimElevationDatabase* ossimElevManager::getElevationDatabase ( ossim_uint32  idx)
inline

Definition at line 74 of file ossimElevManager.h.

75  {
76  return m_dbRoundRobin[0][idx].get();
77  }
std::vector< ElevationDatabaseListType > m_dbRoundRobin

◆ getElevationDatabase() [2/2]

const ossimElevationDatabase* ossimElevManager::getElevationDatabase ( ossim_uint32  idx) const
inline

Definition at line 78 of file ossimElevManager.h.

79  {
80  return m_dbRoundRobin[0][idx].get();
81  }
std::vector< ElevationDatabaseListType > m_dbRoundRobin

◆ getElevationOffset()

double ossimElevManager::getElevationOffset ( ) const
inline

Definition at line 98 of file ossimElevManager.h.

98 { return m_elevationOffset; }
ossim_float64 m_elevationOffset

◆ getHeightAboveEllipsoid()

double ossimElevManager::getHeightAboveEllipsoid ( const ossimGpt gpt)
virtual

Reimplemented from ossimElevSource.

Definition at line 101 of file ossimElevManager.cpp.

References getNextElevDbList(), ossimGeoidManager::instance(), ossim::isnan(), ossimSource::isSourceEnabled(), m_defaultHeightAboveEllipsoid, m_elevationOffset, m_useGeoidIfNullFlag, ossim::nan(), and ossimGeoidManager::offsetFromEllipsoid().

Referenced by ATP::AtpTileSource::computeParallax(), ossimHgtRef::getLocalTerrainNormal(), ossimHgtRef::getRefHeight(), ossimPointCloudUtilityFilter::getTile(), ATP::AtpGenerator::initialize(), ossimViewshedTool::initializeProjectionGsd(), ossimViewshedTool::initProcessingChain(), ossimSonomaSensor::intersectRay(), ossimQuadProjection::lineSampleHeightToWorld(), ossimMapProjection::lineSampleHeightToWorld(), ossimEquDistCylProjection::lineSampleHeightToWorld(), ossimLlxyProjection::lineSampleToWorld(), ossimInfo::outputHeight(), and ossimImageGeometry::worldToLocal().

102 {
103  double result = ossim::nan();
104 
105  if (!isSourceEnabled())
106  return result;
107 
109  for (ossim_uint32 idx = 0; (idx < elevDbList.size()) && ossim::isnan(result); ++idx)
110  {
111  result = elevDbList[idx]->getHeightAboveEllipsoid(gpt);
112  }
113 
114  if (ossim::isnan(result))
115  {
116  // No elevation value was returned from the database, so try next best alternatives depending
117  // on ossim_preferences settings. Priority goes to default ellipsoid height if available:
119  {
121  }
122  else if (m_useGeoidIfNullFlag)
123  {
125  }
126  }
127 
128  // Next, ossim_preferences may have indicated an elevation offset to use (top of trees, error
129  // bias, etc):
130  if (!ossim::isnan(m_elevationOffset) && !ossim::isnan(result))
131  result += m_elevationOffset;
132 
133  return result;
134 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
ossim_float64 m_elevationOffset
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
std::vector< ossimRefPtr< ossimElevationDatabase > > ElevationDatabaseListType
unsigned int ossim_uint32
static ossimGeoidManager * instance()
Implements singelton pattern:
ossim_float64 m_defaultHeightAboveEllipsoid
virtual double offsetFromEllipsoid(const ossimGpt &gpt)
ElevationDatabaseListType & getNextElevDbList() const
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ getHeightAboveMSL()

double ossimElevManager::getHeightAboveMSL ( const ossimGpt )
virtual

Height access methods:

Implements ossimElevSource.

Definition at line 136 of file ossimElevManager.cpp.

References getNextElevDbList(), ossimGeoidManager::instance(), ossim::isnan(), ossimSource::isSourceEnabled(), m_defaultHeightAboveEllipsoid, m_elevationOffset, m_useGeoidIfNullFlag, ossim::nan(), and ossimGeoidManager::offsetFromEllipsoid().

Referenced by getCellsForBounds(), and ossimInfo::outputHeight().

137 {
138  double result = ossim::nan();
139 
140  if (!isSourceEnabled())
141  return result;
142 
144  for (ossim_uint32 idx = 0; (idx < elevDbList.size()) && ossim::isnan(result); ++idx)
145  {
146  result = elevDbList[idx]->getHeightAboveMSL(gpt);
147  }
148 
149  if (ossim::isnan(result) && m_useGeoidIfNullFlag)
150  {
151  // No elevation value was returned from the database, so try next best alternatives depending
152  // on ossim_preferences settings. First default to height at MSL itself:
153  result = 0.0; // MSL
155  {
156  // Use the default height above ellipsoid corrected for best guess of MSL above ellipsoid
157  // (i.e., the geoid):
159  if (!ossim::isnan(dh))
160  result = m_defaultHeightAboveEllipsoid - dh;
161  }
162  }
163 
164  // ossim_preferences may have indicated an elevation offset to use (top of trees, error bias, etc)
165  if (!ossim::isnan(result) && (!ossim::isnan(m_elevationOffset)))
166  result += m_elevationOffset;
167 
168  return result;
169 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
ossim_float64 m_elevationOffset
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
std::vector< ossimRefPtr< ossimElevationDatabase > > ElevationDatabaseListType
unsigned int ossim_uint32
static ossimGeoidManager * instance()
Implements singelton pattern:
ossim_float64 m_defaultHeightAboveEllipsoid
virtual double offsetFromEllipsoid(const ossimGpt &gpt)
ElevationDatabaseListType & getNextElevDbList() const
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ getMeanSpacingMeters()

double ossimElevManager::getMeanSpacingMeters ( ) const
virtual

Returns the mean post spacing (in meters) for the highest resolution DEM in the list or NaN if no DEMs have been loaded.

Recommended to perform a getHeight() call for a central ground pt first to load the relevant cells before calling this method.

Implements ossimElevSource.

Definition at line 630 of file ossimElevManager.cpp.

References ossim::isnan(), m_dbRoundRobin, and ossim::nan().

Referenced by ossimViewshedTool::initializeProjectionGsd().

631 {
632  double spacing = ossim::nan();
633  if ( m_dbRoundRobin.size() )
634  {
635  ElevationDatabaseListType& elevDbList = m_dbRoundRobin[0];
636  for(ossim_uint32 idx = 0;(idx < elevDbList.size()); ++idx)
637  {
638  double d_idx = elevDbList[idx]->getMeanSpacingMeters();
639  if (ossim::isnan(spacing) || (d_idx < spacing))
640  {
641  spacing = d_idx;
642  }
643  }
644  }
645  return spacing;
646 }
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
std::vector< ossimRefPtr< ossimElevationDatabase > > ElevationDatabaseListType
unsigned int ossim_uint32
std::vector< ElevationDatabaseListType > m_dbRoundRobin
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ getNextElevDbList()

ossimElevManager::ElevationDatabaseListType & ossimElevManager::getNextElevDbList ( ) const
inlineprotected

Definition at line 571 of file ossimElevManager.cpp.

References ossimElevSource::dup(), m_currentDatabaseIdx, m_dbRoundRobin, m_maxRoundRobinSize, and m_mutex.

Referenced by getAccuracyInfo(), getHeightAboveEllipsoid(), and getHeightAboveMSL().

572 {
573  std::lock_guard<std::mutex> lock (m_mutex);
574 
575  // Quickly grab the DB to be used by this thread and increment DB index to be used by next thread
576  // May need to grow the list round robin as it is dynamically set as needed):
577  if (m_currentDatabaseIdx >= m_dbRoundRobin.size())
578  {
579  ossim_uint32 index = m_dbRoundRobin.size();
580  m_dbRoundRobin.resize(index+1);
581 
582  // An entry existed prior, duplicate its contents for all Db lists in the round robin. Only
583  // duplicate as needed beyond what already existed:
584  ElevationDatabaseListType::iterator iter = m_dbRoundRobin[0].begin();
585  while (iter != m_dbRoundRobin[0].end())
586  {
588  m_dbRoundRobin[index].push_back(dupDb);
589  ++iter;
590  }
591  }
592 
596 
597  return m_dbRoundRobin[index];
598 }
ossim_uint32 m_maxRoundRobinSize
unsigned int ossim_uint32
std::mutex m_mutex
I have tried the readwrite lock interfaces but have found it unstable.
virtual ossimObject * dup() const =0
std::vector< ElevationDatabaseListType > m_dbRoundRobin
ossim_uint32 m_currentDatabaseIdx

◆ getNumberOfElevationDatabases()

ossim_uint32 ossimElevManager::getNumberOfElevationDatabases ( ) const
inline

Definition at line 70 of file ossimElevManager.h.

71  {
72  return (ossim_uint32) m_dbRoundRobin[0].size();
73  }
unsigned int ossim_uint32
std::vector< ElevationDatabaseListType > m_dbRoundRobin

◆ getOpenCellList()

void ossimElevManager::getOpenCellList ( std::vector< ossimFilename > &  list) const

Definition at line 244 of file ossimElevManager.cpp.

References ossimElevationCellDatabase::getOpenCellList(), m_dbRoundRobin, and ossimRefPtr< T >::valid().

Referenced by getCellsForBounds(), and ossimInfo::outputHeight().

245 {
246  if ( m_dbRoundRobin.size() )
247  {
248  ElevationDatabaseListType& elevDbList = m_dbRoundRobin[0];
249  for(ossim_uint32 idx = 0; idx < elevDbList.size(); ++idx)
250  {
251  // If this is a cell based database get the files:
253  dynamic_cast<const ossimElevationCellDatabase*>( elevDbList[idx].get() );
254  if ( db.valid() )
255  {
256  db->getOpenCellList(list);
257  }
258  }
259  }
260 }
bool valid() const
Definition: ossimRefPtr.h:75
std::vector< ossimRefPtr< ossimElevationDatabase > > ElevationDatabaseListType
unsigned int ossim_uint32
virtual void getOpenCellList(std::vector< ossimFilename > &list) const
std::vector< ElevationDatabaseListType > m_dbRoundRobin

◆ getUseGeoidIfNullFlag()

bool ossimElevManager::getUseGeoidIfNullFlag ( ) const
inline

Definition at line 148 of file ossimElevManager.h.

148 { return m_useGeoidIfNullFlag; }

◆ instance()

ossimElevManager * ossimElevManager::instance ( )
static

◆ loadElevationPath()

bool ossimElevManager::loadElevationPath ( const ossimFilename path,
bool  set_as_first = false 
)

Adds a new elevation file (or multiple files if path is a directory) to the collection.

Normally pushed on to the tail of the list, unless set_as_first=true, in which case this source will receive the first requests.

Definition at line 211 of file ossimElevManager.cpp.

References addDatabase(), ossimDirectory::getFirst(), ossimDirectory::getNext(), ossimElevationDatabaseRegistry::instance(), ossimFilename::isDir(), ossimElevationDatabaseRegistry::open(), ossimDirectory::open(), and ossimDirectory::OSSIM_DIR_DIRS.

Referenced by ossimChipProcTool::loadDemFiles(), and loadStandardElevationPaths().

212 {
213  bool result = false;
215 
216  if(!database && path.isDir())
217  {
218  ossimDirectory dir;
219 
220  if(dir.open(path))
221  {
222  ossimFilename file;
224  do
225  {
227  if(database)
228  {
229  result = true;
230  addDatabase(database, set_as_first);
231  }
232  }while(dir.getNext(file));
233  }
234  }
235  else if(database)
236  {
237  result = true;
238  addDatabase(database, set_as_first);
239  }
240 
241  return result;
242 }
static ossimElevationDatabaseRegistry * instance()
bool getFirst(ossimFilename &filename, int flags=OSSIM_DIR_DEFAULT)
bool isDir() const
bool getNext(ossimFilename &filename) const
bool open(const ossimFilename &dir)
void addDatabase(ossimElevationDatabase *database, bool set_as_first=false)
Adds a new elevation database to the collection.
ossimElevationDatabase * open(const ossimString &connectionString)

◆ loadStandardElevationPaths()

void ossimElevManager::loadStandardElevationPaths ( )
protected

Definition at line 171 of file ossimElevManager.cpp.

References ossimFilename::dirCat(), ossimString::empty(), ossimFilename::exists(), ossimEnvironmentUtility::getEnvironmentVariable(), ossimEnvironmentUtility::getInstalledOssimSupportDir(), ossimEnvironmentUtility::getUserOssimSupportDir(), ossimEnvironmentUtility::instance(), loadElevationPath(), m_useStandardPaths, and ossimString::split().

172 {
173  if (!m_useStandardPaths)
174  return;
175 
178 
179  userDir = userDir.dirCat("elevation");
180  installDir = installDir.dirCat("elevation");
181 
182  loadElevationPath(userDir);
183  loadElevationPath(installDir);
184 
185  ossimString paths = ossimEnvironmentUtility::instance()->getEnvironmentVariable("OSSIM_ELEVATION_PATH");
186  std::vector<ossimString> pathArray;
187  ossimString pathSeparator = ":";
188 #if defined(WIN32) && !defined(CYGWIN)
189  pathSeparator = ";";
190 #endif
191 
192  if(!paths.empty())
193  {
194  paths.split(pathArray, pathSeparator);
195  if(!pathArray.empty())
196  {
197  ossim_uint32 idx = 0;
198  for(idx = 0; idx < pathArray.size(); ++idx)
199  {
200  ossimFilename file(pathArray[idx]);
201 
202  if(file.exists())
203  {
204  loadElevationPath(file);
205  }
206  }
207  }
208  }
209 }
ossimFilename getInstalledOssimSupportDir() const
void split(std::vector< ossimString > &result, const ossimString &separatorList, bool skipBlankFields=false) const
Splits this string into a vector of strings (fields) using the delimiter list specified.
unsigned int ossim_uint32
bool loadElevationPath(const ossimFilename &path, bool set_as_first=false)
Adds a new elevation file (or multiple files if path is a directory) to the collection.
static ossimEnvironmentUtility * instance()
ossimFilename dirCat(const ossimFilename &file) const
bool empty() const
Definition: ossimString.h:411
ossimString getEnvironmentVariable(const ossimString &variable) const
ossimFilename getUserOssimSupportDir() const

◆ loadState()

bool ossimElevManager::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
virtual

Method to the load (recreate) the state of an object from a keyword list.

Return true if ok or false on error.

Reimplemented from ossimSource.

Definition at line 429 of file ossimElevManager.cpp.

430 {
431  if (traceDebug())
432  {
434  << "DEBUG ossimElevManager::loadState: Entered..."
435  << std::endl;
436  }
437  if(!ossimElevSource::loadState(kwl, prefix))
438  {
439  return false;
440  }
441  ossimString copyPrefix(prefix);
442  ossimString elevationOffset = kwl.find(copyPrefix, "elevation_offset");
443  ossimString defaultHeightAboveEllipsoid = kwl.find(copyPrefix, "default_height_above_ellipsoid");
444  ossimString elevRndRbnSize = kwl.find(copyPrefix, "threads");
445 
446  kwl.getBoolKeywordValue(m_useGeoidIfNullFlag, "use_geoid_if_null", copyPrefix.chars());
447  kwl.getBoolKeywordValue(m_useStandardPaths, "use_standard_elev_paths", copyPrefix.chars());
448 
449  if(!elevationOffset.empty())
450  m_elevationOffset = elevationOffset.toDouble();
451 
452  if(!defaultHeightAboveEllipsoid.empty())
453  m_defaultHeightAboveEllipsoid = defaultHeightAboveEllipsoid.toDouble();
454 
455  ossim_uint32 numThreads = 1;
456  if(!elevRndRbnSize.empty())
457  {
458  if (elevRndRbnSize.contains("yes") || elevRndRbnSize.contains("true"))
459  numThreads = ossim::getNumberOfThreads();
460  else if (elevRndRbnSize.contains("no") || elevRndRbnSize.contains("false"))
461  numThreads = 1;
462  else
463  {
464  numThreads = elevRndRbnSize.toUInt32();
465  numThreads = numThreads > 0 ? numThreads : 1;
466  }
467  }
468  setRoundRobinMaxSize(numThreads);
469 
470  ossimString regExpression = ossimString("^(") + copyPrefix + "elevation_source[0-9]+.)";
471  vector<ossimString> keys = kwl.getSubstringKeyList( regExpression );
472  long numberOfSources = (long)keys.size();
473  ossim_uint32 offset = (ossim_uint32)(copyPrefix+"elevation_source").size();
474  ossim_uint32 idx = 0;
475  std::vector<int> theNumberList(numberOfSources);
476  for(idx = 0; idx < theNumberList.size();++idx)
477  {
478  ossimString numberStr(keys[idx].begin() + offset,
479  keys[idx].end());
480  theNumberList[idx] = numberStr.toInt();
481  }
482  std::sort(theNumberList.begin(), theNumberList.end());
483 
484  for(idx=0;idx < theNumberList.size();++idx)
485  {
486  ossimString newPrefix = copyPrefix;
487  newPrefix += ossimString("elevation_source");
488  newPrefix += ossimString::toString(theNumberList[idx]);
489  if (traceDebug())
490  {
492  << "DEBUG ossimElevManager::loadState:"
493  << "\nLooking for key: " << newPrefix
494  << std::endl;
495  }
496 
497  //---
498  // Check for enabled key first. Default, if not found is true for
499  // legacy compatibility.
500  //---
501  bool enabled = true;
502  std::string key = newPrefix.string();
503  key += ".";
505  std::string value = kwl.findKey( key );
506  if ( value.size() )
507  {
508  enabled = ossimString(value).toBool();
509  }
510 
511  if ( enabled )
512  {
513  // first check if new way is supported
516  if(database.valid())
517  {
518  if (traceDebug())
519  {
521  << "DEBUG ossimElevManager::loadState:"
522  << "\nadding elevation database: "
523  << database->getClassName()
524  << ": " << database->getConnectionString()
525  << std::endl;
526  }
527  addDatabase(database.get());
528  }
529  else
530  {
531  // if not new elevation load verify the old way by
532  // looking at the filename
533  //
534  ossimString fileKey = newPrefix;
535  fileKey += ".";
537  ossimString lookup = kwl.find(prefix, fileKey.c_str());
538  if (!lookup.empty())
539  {
541  } // end if lookup
542  }
543  }
544 
545  } // end for loop
546 
547  return true;
548 }
static ossimElevationDatabaseRegistry * instance()
ossim_float64 m_elevationOffset
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
bool valid() const
Definition: ossimRefPtr.h:75
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Definition: ossimSource.cpp:66
const char * find(const char *key) const
bool contains(char aChar) const
Definition: ossimString.h:58
static ossimString toString(bool aValue)
Numeric to string methods.
virtual ossimString getClassName() const
Definition: ossimObject.cpp:64
ossim_uint32 toUInt32() const
OSSIM_DLL ossim_uint32 getNumberOfThreads()
Get the number threads to use from ossimPreferences or ossim::Thread.
bool toBool() const
String to numeric methods.
unsigned int ossim_uint32
double toDouble() const
void setRoundRobinMaxSize(ossim_uint32 size)
bool loadElevationPath(const ossimFilename &path, bool set_as_first=false)
Adds a new elevation file (or multiple files if path is a directory) to the collection.
bool getBoolKeywordValue(bool &rtn_val, const char *keyword, const char *prefix=0) const
[OLK, Aug/2008] Sets the boolean <rtn_val> depending on value associated with keyword for values = (y...
static const char * ENABLED_KW
std::vector< ossimString > getSubstringKeyList(const ossimString &regularExpression) const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
bool empty() const
Definition: ossimString.h:411
void addDatabase(ossimElevationDatabase *database, bool set_as_first=false)
Adds a new elevation database to the collection.
ossim_float64 m_defaultHeightAboveEllipsoid
static const char * FILENAME_KW
const ossimString & getConnectionString() const
ossimElevationDatabase * createDatabase(const ossimString &typeName) const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
const std::string & string() const
Definition: ossimString.h:414

◆ pointHasCoverage()

bool ossimElevManager::pointHasCoverage ( const ossimGpt ) const
virtual

METHOD: pointHasCoverage(gpt) Returns TRUE if coverage exists over gpt:

Implements ossimElevSource.

Definition at line 398 of file ossimElevManager.cpp.

References m_dbRoundRobin.

399 {
400  if ( m_dbRoundRobin.size() )
401  {
402  ElevationDatabaseListType& elevDbList = m_dbRoundRobin[0];
403  for(ossim_uint32 idx = 0;(idx < elevDbList.size()); ++idx)
404  {
405  if(elevDbList[idx]->pointHasCoverage(gpt))
406  {
407  return true;
408  }
409  }
410  }
411  return false;
412 }
virtual bool pointHasCoverage(const ossimGpt &) const
METHOD: pointHasCoverage(gpt) Returns TRUE if coverage exists over gpt:
std::vector< ossimRefPtr< ossimElevationDatabase > > ElevationDatabaseListType
unsigned int ossim_uint32
std::vector< ElevationDatabaseListType > m_dbRoundRobin

◆ print()

std::ostream & ossimElevManager::print ( std::ostream &  out) const
virtual

Outputs theErrorStatus as an ossimErrorCode and an ossimString.

Returns
std::ostream&
Note
Derived classes should only have to implement a virtual print, not an operator<< funtion as it's implemented here.

Reimplemented from ossimElevSource.

Definition at line 648 of file ossimElevManager.cpp.

References m_currentDatabaseIdx, m_dbRoundRobin, m_defaultHeightAboveEllipsoid, m_elevationOffset, m_useGeoidIfNullFlag, and ossimElevSource::print().

649 {
650  out << "\nossimElevManager @ "<< (ossim_uint64) this
651  << "\nm_defaultHeightAboveEllipsoid = "<<m_defaultHeightAboveEllipsoid
652  << "\nm_elevationOffset = "<<m_elevationOffset
653  << "\nm_useGeoidIfNullFlag = "<<m_useGeoidIfNullFlag
654  << "\nm_currentDatabaseIdx = "<<m_currentDatabaseIdx
655  << "\nm_dbRoundRobin.size = "<<m_dbRoundRobin.size();
656  for (ossim_uint32 i=0; i<m_dbRoundRobin.size(); ++i)
657  {
658  out<<"\nm_dbRoundRobin["<<i<<"].size = "<<m_dbRoundRobin[i].size()<<endl;
659  for (ossim_uint32 j=0; j<m_dbRoundRobin[i].size(); ++j)
660  {
661  out<<"m_dbRoundRobin["<<i<<"]["<<j<<"] = ";
662  // GP: We have to separate this line. On MS it will not compile
663  // otherwise
664  m_dbRoundRobin[i][j]->print(out);
665 
666  }
667  out<<endl;
668  }
669  out<<"\n";
671  return out;
672 }
ossim_float64 m_elevationOffset
virtual std::ostream & print(std::ostream &out) const
Outputs theErrorStatus as an ossimErrorCode and an ossimString.
unsigned long long ossim_uint64
unsigned int ossim_uint32
ossim_float64 m_defaultHeightAboveEllipsoid
std::vector< ElevationDatabaseListType > m_dbRoundRobin
ossim_uint32 m_currentDatabaseIdx

◆ saveState()

bool ossimElevManager::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

Method to save the state of an object to a keyword list.

Return true if ok or false on error.

Reimplemented from ossimSource.

Definition at line 414 of file ossimElevManager.cpp.

References ossimKeywordlist::add(), m_defaultHeightAboveEllipsoid, m_elevationOffset, m_maxRoundRobinSize, m_useGeoidIfNullFlag, m_useStandardPaths, ossimSource::saveState(), and ossimString::toString().

415 {
416  kwl.add(prefix, "elevation_offset", m_elevationOffset, true);
417  kwl.add(prefix, "default_height_above_ellipsoid", m_defaultHeightAboveEllipsoid, true);
418  kwl.add(prefix, "use_geoid_if_null", m_useGeoidIfNullFlag, true);
419  kwl.add(prefix, "use_standard_elev_paths", m_useStandardPaths, true);
420  kwl.add(prefix, "threads", ossimString::toString(m_maxRoundRobinSize), true);
421 
422  return ossimElevSource::saveState(kwl, prefix);
423 }
ossim_float64 m_elevationOffset
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Definition: ossimSource.cpp:55
static ossimString toString(bool aValue)
Numeric to string methods.
ossim_uint32 m_maxRoundRobinSize
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
ossim_float64 m_defaultHeightAboveEllipsoid

◆ setDefaultHeightAboveEllipsoid()

void ossimElevManager::setDefaultHeightAboveEllipsoid ( double  meters)
inline

Definition at line 96 of file ossimElevManager.h.

Referenced by ATP::AtpGenerator::initialize(), and ossimPointCloudTool::loadDem().

ossim_float64 m_defaultHeightAboveEllipsoid

◆ setElevationOffset()

void ossimElevManager::setElevationOffset ( double  meters)
inline

Definition at line 97 of file ossimElevManager.h.

97 {m_elevationOffset=meters;}
ossim_float64 m_elevationOffset

◆ setRoundRobinMaxSize()

void ossimElevManager::setRoundRobinMaxSize ( ossim_uint32  size)

Definition at line 550 of file ossimElevManager.cpp.

References m_dbRoundRobin, and m_maxRoundRobinSize.

551 {
552  m_maxRoundRobinSize = new_size;
553 
554 #ifdef DYNAMICALLY_ALLOCATE_ROUND_ROBIN
555  // Resize the round robin, preserves at least the first entry if any:
556  if (new_size < m_dbRoundRobin.size())
557  m_dbRoundRobin.resize(new_size);
558 #else
559  // OLK 02/2015 -- Was hoping to dynamically allocate the round robin as needed but was running
560  // into issues, so just allocating full set here (containing empty lists at this point). The
561  // heavy lifting is in addDatabase() where copies are made for each entry in the round robin. It
562  // would have been best to keep the size of the round robin to an as-needed basis to avoid
563  // unnecessary duplicate lists. However, this is only relevant for small apps (like ossim-info)
564  // where minimal number of elevation look-ups are done. TODO: Figure out why MT run core dumps
565  // when dynamically sizing m_dbRoundRobin.
566  m_dbRoundRobin.resize(new_size);
567 #endif
568 
569 }
ossim_uint32 m_maxRoundRobinSize
std::vector< ElevationDatabaseListType > m_dbRoundRobin

◆ setUseGeoidIfNullFlag()

void ossimElevManager::setUseGeoidIfNullFlag ( bool  flag)
inline

Definition at line 147 of file ossimElevManager.h.

Referenced by ATP::AtpGenerator::initialize(), and ossimPointCloudTool::loadDem().

147 { m_useGeoidIfNullFlag = flag; }

Member Data Documentation

◆ m_currentDatabaseIdx

ossim_uint32 ossimElevManager::m_currentDatabaseIdx
mutableprotected

Definition at line 186 of file ossimElevManager.h.

Referenced by getNextElevDbList(), and print().

◆ m_dbRoundRobin

std::vector<ElevationDatabaseListType> ossimElevManager::m_dbRoundRobin
mutableprotected

◆ m_defaultHeightAboveEllipsoid

ossim_float64 ossimElevManager::m_defaultHeightAboveEllipsoid
protected

Definition at line 179 of file ossimElevManager.h.

Referenced by getHeightAboveEllipsoid(), getHeightAboveMSL(), print(), and saveState().

◆ m_elevationOffset

ossim_float64 ossimElevManager::m_elevationOffset
protected

Definition at line 180 of file ossimElevManager.h.

Referenced by getHeightAboveEllipsoid(), getHeightAboveMSL(), print(), and saveState().

◆ m_maxRoundRobinSize

ossim_uint32 ossimElevManager::m_maxRoundRobinSize
protected

Definition at line 178 of file ossimElevManager.h.

Referenced by getNextElevDbList(), saveState(), and setRoundRobinMaxSize().

◆ m_mutex

std::mutex ossimElevManager::m_mutex
mutableprotected

I have tried the readwrite lock interfaces but have found it unstable.

I am using the standard Mutex and it seems to be much more stable across all platforms. More testing needs to occur for the ReadWriteMutex. For now we will use Mutex.

Definition at line 193 of file ossimElevManager.h.

Referenced by getNextElevDbList().

◆ m_useGeoidIfNullFlag

bool ossimElevManager::m_useGeoidIfNullFlag
protected

Definition at line 183 of file ossimElevManager.h.

Referenced by getHeightAboveEllipsoid(), getHeightAboveMSL(), print(), and saveState().

◆ m_useStandardPaths

bool ossimElevManager::m_useStandardPaths
protected

Definition at line 184 of file ossimElevManager.h.

Referenced by loadStandardElevationPaths(), and saveState().


The documentation for this class was generated from the following files: