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

#include <ossimElevationCellDatabase.h>

Inheritance diagram for ossimElevationCellDatabase:
ossimElevationDatabase ossimElevSource ossimSource ossimConnectableObject ossimErrorStatusInterface ossimObject ossimListenerManager ossimPropertyInterface ossimReferenced ossimDtedElevationDatabase ossimGeneralRasterElevationDatabase ossimImageElevationDatabase ossimSrtmElevationDatabase

Classes

struct  CellInfo
 

Public Types

typedef std::map< ossim_uint64, ossimRefPtr< CellInfo > > CellMap
 
- 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

 ossimElevationCellDatabase ()
 
 ossimElevationCellDatabase (const ossimElevationCellDatabase &src)
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual ossim_uint32 getMinOpenCells () const
 
virtual ossim_uint32 getMaxOpenCells () const
 
virtual void setMinMaxOpenCells (ossim_uint64 minCellCount, ossim_uint64 maxCellCount)
 
virtual bool getMemoryMapCellsFlag () const
 
virtual void setMemoryMapCellsFlag (bool flag)
 
virtual void getOpenCellList (std::vector< ossimFilename > &list) const
 
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...
 
virtual ossim_uint64 createId (const ossimGpt &) const
 
virtual ossimRefPtr< ossimElevCellHandlergetOrCreateCellHandler (const ossimGpt &gpt)
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
- Public Member Functions inherited from ossimElevationDatabase
 ossimElevationDatabase ()
 
 ossimElevationDatabase (const ossimElevationDatabase &src)
 
virtual bool getAccuracyInfo (ossimElevationAccuracyInfo &, const ossimGpt &) const
 
virtual double getMeanSpacingMeters () const
 METHOD: meanSpacingMeters() This method returns the post spacing in the region of gpt: More...
 
virtual void setGeoid (ossimGeoid *geoid)
 
ossimGeoidgetGeoid ()
 
const ossimGeoidgetGeoid () const
 
virtual bool open (const ossimString &connectionString)=0
 Open a connection to a database. More...
 
const ossimStringgetConnectionString () const
 
- Public Member Functions inherited from ossimElevSource
virtual double getHeightAboveMSL (const ossimGpt &)=0
 Height access methods: More...
 
virtual double getHeightAboveEllipsoid (const ossimGpt &)
 
virtual ossimObjectdup () const =0
 
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 bool pointHasCoverage (const ossimGpt &) const =0
 METHOD: pointHasCoverage(gpt) Returns TRUE if coverage exists over gpt: More...
 
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...
 
virtual void accept (ossimVisitor &visitor)
 We will add a visitor interface for all connectable objects. 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
 

Protected Member Functions

virtual ossimRefPtr< ossimElevCellHandlercreateCell (const ossimGpt &)
 
virtual void remove (ossim_uint64 id)
 
void flushCacheToMinOpenCells ()
 
- Protected Member Functions inherited from ossimElevationDatabase
virtual ~ossimElevationDatabase ()
 
virtual double getOffsetFromEllipsoid (const ossimGpt &gpt)
 
- 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

ossim_uint32 m_minOpenCells
 
ossim_uint32 m_maxOpenCells
 
std::mutex m_cacheMapMutex
 
CellMap m_cacheMap
 
ossim_uint32 m_memoryMapCellsFlag
 
 TYPE_DATA
 
- Protected Attributes inherited from ossimElevationDatabase
ossimString m_connectionString
 
ossimRefPtr< ossimGeoidm_geoid
 
ossim_float64 m_meanSpacing
 
- 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 6 of file ossimElevationCellDatabase.h.

Member Typedef Documentation

◆ CellMap

Definition at line 56 of file ossimElevationCellDatabase.h.

Constructor & Destructor Documentation

◆ ossimElevationCellDatabase() [1/2]

ossimElevationCellDatabase::ossimElevationCellDatabase ( )
inline

◆ ossimElevationCellDatabase() [2/2]

ossimElevationCellDatabase::ossimElevationCellDatabase ( const ossimElevationCellDatabase src)
inline

Member Function Documentation

◆ createCell()

virtual ossimRefPtr<ossimElevCellHandler> ossimElevationCellDatabase::createCell ( const ossimGpt )
inlineprotectedvirtual

◆ createId()

virtual ossim_uint64 ossimElevationCellDatabase::createId ( const ossimGpt ) const
inlinevirtual

Reimplemented in ossimGeneralRasterElevationDatabase, ossimDtedElevationDatabase, and ossimSrtmElevationDatabase.

Definition at line 120 of file ossimElevationCellDatabase.h.

Referenced by getOrCreateCellHandler().

121  {
122  return 0;
123  }

◆ flushCacheToMinOpenCells()

void ossimElevationCellDatabase::flushCacheToMinOpenCells ( )
inlineprotected

Definition at line 141 of file ossimElevationCellDatabase.h.

Referenced by getOrCreateCellHandler(), and ossimImageElevationDatabase::getOrCreateCellHandler().

142  {
143  // lets flush the cache from least recently used to recent.
144  //
145  CellMap sortedMap;
146  CellMap::iterator iter = m_cacheMap.begin();
147 
148  while(iter != m_cacheMap.end())
149  {
150  sortedMap.insert(std::make_pair(iter->second->m_timestamp, iter->second));
151  ++iter;
152  }
153 
154  iter = sortedMap.begin();
155  while((iter!=sortedMap.end())&&(m_cacheMap.size() > m_minOpenCells))
156  {
157  remove(iter->second->id());
158  ++iter;
159  }
160  }
std::map< ossim_uint64, ossimRefPtr< CellInfo > > CellMap

◆ getCellsForBounds()

void ossimElevationCellDatabase::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.

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 20 of file ossimElevationCellDatabase.cpp.

References ossimString::begin(), ossimElevCellHandler::getFilename(), getOrCreateCellHandler(), ossimGpt::lat, ossimGpt::lon, ossim::min< ossim_float64 >(), ossimString::size(), and ossimRefPtr< T >::valid().

Referenced by ossimElevManager::getCellsForBounds().

26 {
27  const ossim_float64 SEARCH_SPACING = 0.1;
28  ossimGpt gpt(0.0, 0.0, 0.0);
29  ossimFilename f;
30  ossim_uint32 limitNumberOfCells = maxNumberOfCells>0?maxNumberOfCells:999999999;
31  // Latitude loop:
32  ossim_float64 lat = minLat;
33  while ( (lat <= maxLat) &&(cells.size() < limitNumberOfCells))
34  {
35  gpt.lat = lat;
36 
37  // Longitude loop:
38  ossim_float64 lon = minLon;
39  while ( (lon <= maxLon ) &&(cells.size()< limitNumberOfCells))
40  {
41  gpt.lon = lon;
42 
44  if ( h.valid() )
45  {
46  // Get the file name:
47  f = h->getFilename();
48 
49  if ( f.size() )
50  {
51  // See if it's already in the list, i.e. duplicate:
52  std::vector<ossimFilename>::const_iterator i = cells.begin();
53  while ( i != cells.end() )
54  {
55  if ( f == (*i) )
56  {
57  break;
58  }
59  ++i;
60  }
61 
62  if ( i == cells.end() )
63  {
64  // Add it to the list:
65  cells.push_back( f );
66  }
67  }
68  }
69 
70  if ( lon < maxLon )
71  {
72  lon = ossim::min<ossim_float64>( (lon+SEARCH_SPACING), maxLon );
73  }
74  else
75  {
76  break;
77  }
78 
79  } // Matches: while ( lon <= maxLon )
80 
81  if ( lat < maxLat )
82  {
83  lat = ossim::min<ossim_float64>( (lat+SEARCH_SPACING), maxLat );
84  }
85  else
86  {
87  break;
88  }
89 
90  } // Matches: while ( lat <= maxLat )
91 
92 } // End: ossimElevationCellDatabase::getCellsForBounds( ... )
virtual const ossimFilename & getFilename() const
bool valid() const
Definition: ossimRefPtr.h:75
double ossim_float64
virtual ossimRefPtr< ossimElevCellHandler > getOrCreateCellHandler(const ossimGpt &gpt)
std::string::size_type size() const
Definition: ossimString.h:405
std::string::iterator begin()
Definition: ossimString.h:420
unsigned int ossim_uint32
ossim_float64 min< ossim_float64 >(ossim_float64 a, ossim_float64 b)
Definition: ossimCommon.h:223

◆ getMaxOpenCells()

virtual ossim_uint32 ossimElevationCellDatabase::getMaxOpenCells ( ) const
inlinevirtual

Definition at line 80 of file ossimElevationCellDatabase.h.

81  {
82  return m_maxOpenCells;
83  }

◆ getMemoryMapCellsFlag()

virtual bool ossimElevationCellDatabase::getMemoryMapCellsFlag ( ) const
inlinevirtual

Definition at line 90 of file ossimElevationCellDatabase.h.

91  {
92  return m_memoryMapCellsFlag;
93  }

◆ getMinOpenCells()

virtual ossim_uint32 ossimElevationCellDatabase::getMinOpenCells ( ) const
inlinevirtual

Definition at line 76 of file ossimElevationCellDatabase.h.

77  {
78  return m_minOpenCells;
79  }

◆ getOpenCellList()

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

Definition at line 5 of file ossimElevationCellDatabase.cpp.

References m_cacheMap.

Referenced by ossimElevManager::getOpenCellList().

6 {
7  CellMap::const_iterator iter = m_cacheMap.begin();
8 
9  while(iter!=m_cacheMap.end())
10  {
11  if ( iter->second->m_handler.valid() )
12  {
13  list.push_back(iter->second->m_handler->getFilename());
14  }
15  ++iter;
16  }
17 
18 }

◆ getOrCreateCellHandler()

ossimRefPtr< ossimElevCellHandler > ossimElevationCellDatabase::getOrCreateCellHandler ( const ossimGpt gpt)
virtual

Reimplemented in ossimImageElevationDatabase.

Definition at line 99 of file ossimElevationCellDatabase.cpp.

References createCell(), createId(), flushCacheToMinOpenCells(), ossimRefPtr< T >::get(), m_cacheMap, m_cacheMapMutex, and m_maxOpenCells.

Referenced by ossimDtedElevationDatabase::getAccuracyInfo(), getCellsForBounds(), ossimSrtmElevationDatabase::getHeightAboveMSL(), ossimDtedElevationDatabase::getHeightAboveMSL(), and ossimGeneralRasterElevationDatabase::getHeightAboveMSL().

101 {
103 
104  ossim_uint64 id = createId(gpt);
105 
106  m_cacheMapMutex.lock();
107 
108  CellMap::iterator iter = m_cacheMap.find(id);
109  if(iter != m_cacheMap.end())
110  {
111  iter->second->updateTimestamp();
112  result = iter->second->m_handler.get();
113  }
114  else
115  {
116  m_cacheMapMutex.unlock();
117 
118  result = createCell(gpt);
119 
120  m_cacheMapMutex.lock();
121 
122  //---
123  // Code speed up:
124  // Add it to the cache even if it's not valid so this database will not
125  // call createCell(...) again.
126  //---
127  m_cacheMap.insert(std::make_pair(id, new CellInfo(id, result.get())));
128 
129  // Check the map size and purge cells if needed.
130  if(m_cacheMap.size() > m_maxOpenCells)
131  {
133  }
134  }
135 
136  m_cacheMapMutex.unlock();
137 
138  return result;
139 }
virtual ossimRefPtr< ossimElevCellHandler > createCell(const ossimGpt &)
unsigned long long ossim_uint64
virtual ossim_uint64 createId(const ossimGpt &) const

◆ loadState()

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

Method to the load (recreate) the state of the object from a keyword list. Return true if ok or false on error.

Reimplemented from ossimElevationDatabase.

Reimplemented in ossimImageElevationDatabase, ossimDtedElevationDatabase, ossimGeneralRasterElevationDatabase, and ossimSrtmElevationDatabase.

Definition at line 178 of file ossimElevationCellDatabase.cpp.

References ossimString::empty(), ossimKeywordlist::find(), ossimElevationDatabase::loadState(), m_maxOpenCells, m_memoryMapCellsFlag, m_minOpenCells, ossimString::toBool(), and ossimString::toUInt32().

Referenced by ossimSrtmElevationDatabase::loadState(), ossimDtedElevationDatabase::loadState(), and ossimGeneralRasterElevationDatabase::loadState().

179 {
180  ossimString minOpenCells = kwl.find(prefix, "min_open_cells");
181  ossimString maxOpenCells = kwl.find(prefix, "max_open_cells");
182  if(!minOpenCells.empty()&&
183  !maxOpenCells.empty())
184  {
185  m_minOpenCells = minOpenCells.toUInt32();
186  m_maxOpenCells = maxOpenCells.toUInt32();
188  {
189  std::swap(m_minOpenCells, m_maxOpenCells);
190  }
191  }
192  ossimString memoryMapCellsFlag = kwl.find(prefix, "memory_map_cells");
193  if(!memoryMapCellsFlag.empty())
194  {
195  m_memoryMapCellsFlag = memoryMapCellsFlag.toBool();
196  }
197  return ossimElevationDatabase::loadState(kwl, prefix);
198 }
const char * find(const char *key) const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
ossim_uint32 toUInt32() const
bool toBool() const
String to numeric methods.
bool empty() const
Definition: ossimString.h:411

◆ print()

std::ostream & ossimElevationCellDatabase::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 ossimElevationDatabase.

Reimplemented in ossimImageElevationDatabase, ossimGeneralRasterElevationDatabase, and ossimDtedElevationDatabase.

Definition at line 214 of file ossimElevationCellDatabase.cpp.

References saveState().

215 {
216  ossimKeywordlist kwl;
217  saveState(kwl);
218  out << "\nossimElevationCellDatabase @ "<< (ossim_uint64) this << kwl << ends;
219  return out;
220 }
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Represents serializable keyword/value map.
unsigned long long ossim_uint64

◆ remove()

virtual void ossimElevationCellDatabase::remove ( ossim_uint64  id)
inlineprotectedvirtual

Reimplemented in ossimImageElevationDatabase.

Definition at line 133 of file ossimElevationCellDatabase.h.

Referenced by ossimImageElevationDatabase::remove().

134  {
135  CellMap::iterator iter = m_cacheMap.find(id);
136  if(iter != m_cacheMap.end())
137  {
138  m_cacheMap.erase(iter);
139  }
140  }

◆ saveState()

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

Method to save the state of the object to a keyword list. Return true if ok or false on error.

Reimplemented from ossimElevationDatabase.

Reimplemented in ossimImageElevationDatabase, ossimDtedElevationDatabase, ossimGeneralRasterElevationDatabase, and ossimSrtmElevationDatabase.

Definition at line 200 of file ossimElevationCellDatabase.cpp.

References ossimKeywordlist::add(), ossimObject::getShortName(), ossimElevationDatabase::m_geoid, m_maxOpenCells, m_memoryMapCellsFlag, m_minOpenCells, ossimElevationDatabase::saveState(), and ossimRefPtr< T >::valid().

Referenced by print(), ossimSrtmElevationDatabase::saveState(), ossimDtedElevationDatabase::saveState(), ossimGeneralRasterElevationDatabase::saveState(), and ossimImageElevationDatabase::saveState().

201 {
202  kwl.add(prefix, "memory_map_cells", m_memoryMapCellsFlag, true);
203  kwl.add(prefix, "min_open_cells", m_minOpenCells, true);
204  kwl.add(prefix, "max_open_cells", m_maxOpenCells, true);
205 
206  if(m_geoid.valid())
207  {
208  kwl.add(prefix, "geoid.type", m_geoid->getShortName(), true);
209  }
210 
211  return ossimElevationDatabase::saveState(kwl, prefix);
212 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimString getShortName() const
Definition: ossimObject.cpp:48
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
ossimRefPtr< ossimGeoid > m_geoid
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const

◆ setMemoryMapCellsFlag()

virtual void ossimElevationCellDatabase::setMemoryMapCellsFlag ( bool  flag)
inlinevirtual

Definition at line 94 of file ossimElevationCellDatabase.h.

95  {
96  m_memoryMapCellsFlag = flag;
97  }

◆ setMinMaxOpenCells()

virtual void ossimElevationCellDatabase::setMinMaxOpenCells ( ossim_uint64  minCellCount,
ossim_uint64  maxCellCount 
)
inlinevirtual

Definition at line 84 of file ossimElevationCellDatabase.h.

86  {
87  m_minOpenCells = minCellCount;
88  m_maxOpenCells = maxCellCount;
89  }

Member Data Documentation

◆ m_cacheMap

CellMap ossimElevationCellDatabase::m_cacheMap
protected

◆ m_cacheMapMutex

std::mutex ossimElevationCellDatabase::m_cacheMapMutex
mutableprotected

◆ m_maxOpenCells

ossim_uint32 ossimElevationCellDatabase::m_maxOpenCells
protected

◆ m_memoryMapCellsFlag

ossim_uint32 ossimElevationCellDatabase::m_memoryMapCellsFlag
protected

◆ m_minOpenCells

ossim_uint32 ossimElevationCellDatabase::m_minOpenCells
protected

Definition at line 162 of file ossimElevationCellDatabase.h.

Referenced by loadState(), and saveState().

◆ TYPE_DATA

ossimElevationCellDatabase::TYPE_DATA
protected

Definition at line 168 of file ossimElevationCellDatabase.h.


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