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

The DTED elevation data base is also an elevation source but allows one to point to an file based elevation tree. More...

#include <ossimDtedElevationDatabase.h>

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

Public Types

typedef std::vector< ossimRefPtr< CellInfo > > DirectMap
 
- Public Types inherited from ossimElevationCellDatabase
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

 ossimDtedElevationDatabase ()
 
 ossimDtedElevationDatabase (const ossimDtedElevationDatabase &rhs)
 
virtual ~ossimDtedElevationDatabase ()
 
virtual ossimObjectdup () const
 
virtual bool open (const ossimString &connectionString)
 Open a connection to a database. More...
 
virtual bool pointHasCoverage (const ossimGpt &gpt) const
 METHOD: pointHasCoverage(gpt) Returns TRUE if coverage exists over gpt: More...
 
virtual bool getAccuracyInfo (ossimElevationAccuracyInfo &info, const ossimGpt &gpt) const
 
virtual double getHeightAboveMSL (const ossimGpt &)
 Height access methods: More...
 
virtual double getHeightAboveEllipsoid (const ossimGpt &gpt)
 
virtual ossim_uint64 createId (const ossimGpt &pt) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
- Public Member Functions inherited from ossimElevationCellDatabase
 ossimElevationCellDatabase ()
 
 ossimElevationCellDatabase (const ossimElevationCellDatabase &src)
 
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 ossimRefPtr< ossimElevCellHandlergetOrCreateCellHandler (const ossimGpt &gpt)
 
- Public Member Functions inherited from ossimElevationDatabase
 ossimElevationDatabase ()
 
 ossimElevationDatabase (const ossimElevationDatabase &src)
 
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
 
const ossimStringgetConnectionString () const
 
- 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...
 
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

bool openDtedDirectory (const ossimFilename &dir)
 
void createRelativePath (ossimFilename &file, const ossimGpt &gpt) const
 
void createFullPath (ossimFilename &file, const ossimGpt &gpt) const
 
virtual ossimRefPtr< ossimElevCellHandlercreateCell (const ossimGpt &gpt)
 
bool inititializeExtension (const ossimFilename &dir)
 Scans directory and set m_extension to extension of first dted file found. More...
 
- Protected Member Functions inherited from ossimElevationCellDatabase
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

ossimString m_extension
 
bool m_upcase
 
ossimRefPtr< ossimElevCellHandlerm_lastHandler
 
std::mutex m_mutex
 
- Protected Attributes inherited from ossimElevationCellDatabase
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

The DTED elevation data base is also an elevation source but allows one to point to an file based elevation tree.

The general format of a DTED elevation tree:

<root dir>="">/e|w<longitude value>="">/n|s<latitiude value>="">.<extension> Exmaple 1 kilometer: <root dir>="">/w023/n15.dt0

Note for 1 kilimeter the extension is dt0 and for 90 meter post spacing it is .dt1 and for 30 meter spacing it is .dt2

Definition at line 22 of file ossimDtedElevationDatabase.h.

Member Typedef Documentation

◆ DirectMap

Definition at line 25 of file ossimDtedElevationDatabase.h.

Constructor & Destructor Documentation

◆ ossimDtedElevationDatabase() [1/2]

ossimDtedElevationDatabase::ossimDtedElevationDatabase ( )

Definition at line 14 of file ossimDtedElevationDatabase.cpp.

Referenced by dup().

◆ ossimDtedElevationDatabase() [2/2]

ossimDtedElevationDatabase::ossimDtedElevationDatabase ( const ossimDtedElevationDatabase rhs)

Definition at line 23 of file ossimDtedElevationDatabase.cpp.

26  m_upcase(rhs.m_upcase),
27  m_lastHandler(0), // Do not copy this to get a unique handler for thread.
28  m_mutex()
29 {
30 }
ossimRefPtr< ossimElevCellHandler > m_lastHandler

◆ ~ossimDtedElevationDatabase()

ossimDtedElevationDatabase::~ossimDtedElevationDatabase ( )
virtual

Definition at line 32 of file ossimDtedElevationDatabase.cpp.

33 {
34 }

Member Function Documentation

◆ createCell()

ossimRefPtr< ossimElevCellHandler > ossimDtedElevationDatabase::createCell ( const ossimGpt gpt)
protectedvirtual

Reimplemented from ossimElevationCellDatabase.

Definition at line 192 of file ossimDtedElevationDatabase.cpp.

References createFullPath(), ossimFilename::exists(), ossimRefPtr< T >::get(), ossimErrorStatusInterface::getErrorStatus(), and ossimElevationCellDatabase::m_memoryMapCellsFlag.

193 {
195  ossimFilename f;
196  createFullPath(f, gpt);
197  if(f.exists())
198  {
200  if (!(h->getErrorStatus()))
201  {
202  result = h.get();
203  }
204  }
205  return result;
206 }
bool exists() const
the DTED handler is an elevation source that allows for handling of a single cell of data...
virtual ossimErrorCode getErrorStatus() const
void createFullPath(ossimFilename &file, const ossimGpt &gpt) const

◆ createFullPath()

void ossimDtedElevationDatabase::createFullPath ( ossimFilename file,
const ossimGpt gpt 
) const
inlineprotected

Definition at line 71 of file ossimDtedElevationDatabase.h.

References ossimFilename::dirCat().

Referenced by createCell().

72  {
73  ossimFilename relativeFile;
74  createRelativePath(relativeFile, gpt);
75  file = ossimFilename(m_connectionString).dirCat(relativeFile);
76  }
ossimFilename dirCat(const ossimFilename &file) const
void createRelativePath(ossimFilename &file, const ossimGpt &gpt) const

◆ createId()

virtual ossim_uint64 ossimDtedElevationDatabase::createId ( const ossimGpt pt) const
inlinevirtual

Reimplemented from ossimElevationCellDatabase.

Definition at line 47 of file ossimDtedElevationDatabase.h.

References ossimGpt::latd(), ossimGpt::lond(), ossim::wrap(), x, and y.

48  {
49  ossim_uint64 y = static_cast<ossim_uint64>(ossim::wrap(pt.latd(), -90.0, 90.0)+90.0);
50  ossim_uint64 x = static_cast<ossim_uint64>(ossim::wrap(pt.lond(),-180.0,180.0)+180.0);
51  // map the extreme edge to the same ID ax the 179 west cell and the same for the 89
52  // degree north cell.
53  //
54  x = x==360?359:x;
55  y = y==180?179:y;
56  // dted databases are 1x1 degree cells and we will use a world
57  // grid for id generation.
58  //
59  return (y*360+x);
60  }
ossim_uint32 x
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
ossim_uint32 y
T wrap(T x, T a, T b)
Definition: ossimCommon.h:180
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
unsigned long long ossim_uint64

◆ createRelativePath()

void ossimDtedElevationDatabase::createRelativePath ( ossimFilename file,
const ossimGpt gpt 
) const
protected

Definition at line 152 of file ossimDtedElevationDatabase.cpp.

References abs, ossimString::c_str(), ossimFilename::dirCat(), ossimGpt::latd(), ossimGpt::lond(), m_extension, and m_upcase.

153 {
154  ossimFilename lon, lat;
155  int ilon = static_cast<int>(floor(gpt.lond()));
156 
157  if (ilon < 0)
158  {
159  lon = m_upcase?"W":"w";
160  }
161  else
162  {
163  lon = m_upcase?"E":"e";
164  }
165 
166  ilon = abs(ilon);
168  s1 << std::setfill('0') << std::setw(3)<< ilon;
169 
170  lon += s1.str().c_str();//ossimString::toString(ilon);
171 
172  int ilat = static_cast<int>(floor(gpt.latd()));
173  if (ilat < 0)
174  {
175  lat += m_upcase?"S":"s";
176  }
177  else
178  {
179  lat += m_upcase?"N":"n";
180  }
181 
182  ilat = abs(ilat);
184 
185  s2<< std::setfill('0') << std::setw(2)<< ilat;
186 
187  lat += s2.str().c_str();
188 
189  file = lon.dirCat(lat+m_extension);
190 }
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
#define abs(a)
Definition: auxiliary.h:74
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
ossimFilename dirCat(const ossimFilename &file) 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

◆ dup()

ossimObject * ossimDtedElevationDatabase::dup ( ) const
virtual

Implements ossimElevSource.

Definition at line 36 of file ossimDtedElevationDatabase.cpp.

References ossimDtedElevationDatabase().

37 {
39  return duped;
40 }
The DTED elevation data base is also an elevation source but allows one to point to an file based ele...

◆ getAccuracyInfo()

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

Reimplemented from ossimElevationDatabase.

Definition at line 136 of file ossimDtedElevationDatabase.cpp.

References ossimElevCellHandler::getAccuracyInfo(), ossimElevationCellDatabase::getOrCreateCellHandler(), m_mutex, and ossimRefPtr< T >::valid().

137 {
138  bool result = false;
139 
140  m_mutex.lock();
141  ossimDtedElevationDatabase* thisPtr = const_cast<ossimDtedElevationDatabase*>(this);
142  ossimRefPtr<ossimElevCellHandler> tempHandler = thisPtr->getOrCreateCellHandler(gpt);
143  m_mutex.unlock();
144 
145  if(tempHandler.valid())
146  {
147  result = tempHandler->getAccuracyInfo(info, gpt);
148  }
149  return result;
150 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual bool getAccuracyInfo(ossimElevationAccuracyInfo &info, const ossimGpt &gpt) const
virtual ossimRefPtr< ossimElevCellHandler > getOrCreateCellHandler(const ossimGpt &gpt)
The DTED elevation data base is also an elevation source but allows one to point to an file based ele...

◆ getHeightAboveEllipsoid()

double ossimDtedElevationDatabase::getHeightAboveEllipsoid ( const ossimGpt gpt)
virtual

Reimplemented from ossimElevSource.

Definition at line 62 of file ossimDtedElevationDatabase.cpp.

References getHeightAboveMSL(), ossimElevationDatabase::getOffsetFromEllipsoid(), and ossim::nan().

63 {
64  double h = getHeightAboveMSL(gpt);
65  if(h != ossim::nan())
66  {
67  double offset = getOffsetFromEllipsoid(gpt);
68 
69  h += offset;
70  }
71 
72  return h;
73 }
virtual double getHeightAboveMSL(const ossimGpt &)
Height access methods:
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
virtual double getOffsetFromEllipsoid(const ossimGpt &gpt)

◆ getHeightAboveMSL()

double ossimDtedElevationDatabase::getHeightAboveMSL ( const ossimGpt )
virtual

Height access methods:

Implements ossimElevSource.

Definition at line 42 of file ossimDtedElevationDatabase.cpp.

References ossimElevSource::getHeightAboveMSL(), ossimElevationCellDatabase::getOrCreateCellHandler(), ossimSource::isSourceEnabled(), m_lastHandler, m_mutex, ossim::nan(), ossimElevCellHandler::pointHasCoverage(), and ossimRefPtr< T >::valid().

Referenced by getHeightAboveEllipsoid().

43 {
44  if(!isSourceEnabled())
45  return ossim::nan();
46  std::lock_guard<std::mutex> lock(m_mutex);
47  double result = ossim::nan();
49  {
50  result = m_lastHandler->getHeightAboveMSL(gpt);
51  }
52  else
53  {
55  if(m_lastHandler.valid())
56  result = m_lastHandler->getHeightAboveMSL(gpt);
57  }
58 
59  return result;
60 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual double getHeightAboveMSL(const ossimGpt &)=0
Height access methods:
bool valid() const
Definition: ossimRefPtr.h:75
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
virtual ossimRefPtr< ossimElevCellHandler > getOrCreateCellHandler(const ossimGpt &gpt)
virtual bool pointHasCoverage(const ossimGpt &) const
METHOD: pointIsInsideRect() Method to check if the ground point elevation is defined: ...
ossimRefPtr< ossimElevCellHandler > m_lastHandler

◆ inititializeExtension()

bool ossimDtedElevationDatabase::inititializeExtension ( const ossimFilename dir)
protected

Scans directory and set m_extension to extension of first dted file found.

Parameters
dirDirectory to scan.
Returns
true on success, false on error.

Definition at line 293 of file ossimDtedElevationDatabase.cpp.

References ossimString::c_str(), ossimString::empty(), ossimFilename::ext(), ossimFilename::file(), ossimDirectory::getFirst(), ossimFilename::isDir(), ossimString::match(), ossimDirectory::open(), ossimDtedHandler::open(), ossimDirectory::OSSIM_DIR_DIRS, ossimDirectory::OSSIM_DIR_FILES, and ossimString::size().

294 {
295  ossim_uint32 count = 0;
296  ossim_uint32 maxCount = 10;
297  ossimDirectory od;
298  bool result = od.open(dir);
299  if(result)
300  {
301  result = false;
302  ossimFilename f;
303  // Get the first directory.
305 
306  do
307  {
308  ++count;
309  // Must be a directory.
310  if (f.isDir())
311  {
312  // Discard any full path.
313  ossimFilename fileOnly = f.file();
314 
315  // Downcase it. Note have sites with upper case. (drb)
316  // fileOnly.downcase();
317 
318  //---
319  // Longitude subdir check:
320  // Must start with 'e', 'E', 'w' or 'W'.
321  //---
322  bool foundCell = ( ( (fileOnly.c_str()[0] == 'e') ||
323  (fileOnly.c_str()[0] == 'w') ||
324  (fileOnly.c_str()[0] == 'E') ||
325  (fileOnly.c_str()[0] == 'W') ) &&
326  (fileOnly.size() == 4));
327  if(foundCell)
328  {
329  ossim_uint32 maxCount2 = 10;
330  ossim_uint32 count2 = 0;
331  ossimDirectory d2;
332 
333  // Open the longitude subdir:
334  if(d2.open(f))
335  {
337  do
338  {
339  // The DTED directory may be polluted with cell statistics files and other
340  // non-DEM items. Skip if not of the expected extension (OLK 10/2017):
341  if (f.ext().match("[dD][tT][0-9]").empty())
342  continue;
343 
345  if(dtedHandler->open(f, false))
346  {
347  if(traceDebug())
348  {
350  << "ossimDtedElevationDatabase::open: Found dted file " << f << "\n";
351  }
352  result = true;
353  m_extension = "."+f.ext();
354  m_connectionString = dir;
355  m_meanSpacing = dtedHandler->getMeanSpacingMeters();
356  }
357  dtedHandler->close();
358  dtedHandler = 0;
359  ++count2;
360  } while(!result&&d2.getNext(f)&&(count2 < maxCount2));
361  }
362  }
363  }
364  } while(!result&&(od.getNext(f))&&(count < maxCount));
365  }
366 
367  return result;
368 
369 } // End: ossimDtedElevationDatabase::inititializeExtension( dir )
virtual bool open(const ossimFilename &file, bool memoryMapFlag=false)
opens a cell
virtual double getMeanSpacingMeters() const
METHOD: meanSpacingMeters() Implements pure virtual for.
ossimString match(const char *regularExpressionPattern) const
Returns from found pattern to end of pattern.
bool getFirst(ossimFilename &filename, int flags=OSSIM_DIR_DEFAULT)
virtual void close()
bool isDir() const
bool getNext(ossimFilename &filename) const
std::string::size_type size() const
Definition: ossimString.h:405
unsigned int ossim_uint32
the DTED handler is an elevation source that allows for handling of a single cell of data...
bool open(const ossimFilename &dir)
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
ossimFilename file() const
ossimString ext() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ loadState()

bool ossimDtedElevationDatabase::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 ossimElevationCellDatabase.

Definition at line 208 of file ossimDtedElevationDatabase.cpp.

References ossimString::empty(), ossimFilename::exists(), ossimKeywordlist::findKey(), ossimPreferences::instance(), ossimElevationCellDatabase::loadState(), ossimElevationDatabase::m_connectionString, m_extension, ossimNotify(), ossimNotifyLevel_WARN, ossimPreferences::preferencesKWL(), ossimString::size(), and ossimString::string().

209 {
210  bool result = ossimElevationCellDatabase::loadState(kwl, prefix);
211  if(result)
212  {
214  {
215  // Look for "extension" keyword.
216  std::string pref = (prefix?prefix:"");
217  std::string key = "extension";
219  if ( val.size() )
220  {
221  if ( val.string()[0] != '.' )
222  {
223  m_extension = ".";
224  m_extension += val;
225 
227  << "\nossimDtedElevationDatabase::loadState: WARNING\n"
228  << "Key value for \"extension\" does not start with a dot!\n"
229  << "Consider changing \"" << val << "\" to \"" << m_extension << "\"\n"
230  << std::endl;
231  }
232  else
233  {
234  m_extension = val;
235  }
236  }
237  else if ( traceDebug() )
238  {
240  << "\nossimDtedElevationDatabase::loadState: NOTICE\n"
241  << "Key lookup for \"extension\" failed!\n"
242  << "Can be set in ossim preferences. Example:\n"
243  << pref << key << ": .dt2\n\n";
244  }
245 
246  key = "upcase";
247  val = ossimPreferences::instance()->preferencesKWL().findKey( pref, key );
248  if ( val.size() )
249  {
250  m_upcase = val.toBool();
251  }
252  else if ( traceDebug() )
253  {
255  << "\nossimDtedElevationDatabase::loadState: NOTICE\n"
256  << "Key lookup for \"upcase\" failed!\n"
257  << "Can be set in ossim preferences. Example:\n"
258  << pref << key << ": false\n\n";
259  }
260 
261 
262  result = open(m_connectionString);
263  }
264  else
265  {
266  // can't open the connection because it does not exists or empty
267  result = false;
268  }
269  }
270 
271  return result;
272 }
virtual bool open(const ossimString &connectionString)
Open a connection to a database.
const ossimKeywordlist & preferencesKWL() const
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
bool exists() const
std::string::size_type size() const
Definition: ossimString.h:405
bool toBool() const
String to numeric methods.
static ossimPreferences * instance()
bool empty() const
Definition: ossimString.h:411
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
const std::string & string() const
Definition: ossimString.h:414

◆ open()

bool ossimDtedElevationDatabase::open ( const ossimString connectionString)
virtual

Open a connection to a database.

In most cases this will be a pointer to a directory like in a Dted directory reader.

Implements ossimElevationDatabase.

Definition at line 74 of file ossimDtedElevationDatabase.cpp.

References openDtedDirectory().

75 {
76  bool result = false;
77  ossimFilename file = ossimFilename(connectionString);
78 
79  result = openDtedDirectory(file);
80 
81  return result;
82 }
bool openDtedDirectory(const ossimFilename &dir)

◆ openDtedDirectory()

bool ossimDtedElevationDatabase::openDtedDirectory ( const ossimFilename dir)
protected

Definition at line 84 of file ossimDtedElevationDatabase.cpp.

Referenced by open().

85 {
86  if(traceDebug())
87  {
89  << "ossimDtedElevationDatabase::open entered ...\n"
90  << "dir: " << dir << "\n";
91  }
92 
93  bool result = dir.isDir();
94  if(result)
95  {
96  if ( m_extension.size() == 0 )
97  {
98  //---
99  // This sets extension by doing a directory scan for files with "dt*".
100  // Use "extension" key in preferences to avoid this. Example:
101  // elevation_manager.elevation_source0.extension: dt2.
102  //---
103  result = inititializeExtension( dir );
104  if ( !result && traceDebug() )
105  {
107  << "ossimDtedElevationDatabase::open: WARNING "
108  << "Scan for dted extension failed!\n"
109  << "Can be set in ossim preferences. Example:\n"
110  << "elevation_manager.elevation_source0.extension: .dt2\n";
111  }
112  }
113 
114  // Set the geoid:
115  if( !m_geoid.valid() )
116  {
118  if(!m_geoid.valid()&&traceDebug())
119  {
121  << "ossimDtedElevationDatabase::open: WARNING "
122  << "Unable to load goeid grid 1996 for DTED database\n";
123  }
124  }
125 
126  }
127 
128  if(traceDebug())
129  {
131  << "ossimDtedElevationDatabase::open result:" << (result?"true":"false") << "\n";
132  }
133  return result;
134 }
bool valid() const
Definition: ossimRefPtr.h:75
bool inititializeExtension(const ossimFilename &dir)
Scans directory and set m_extension to extension of first dted file found.
bool isDir() const
ossimRefPtr< ossimGeoid > m_geoid
std::string::size_type size() const
Definition: ossimString.h:405
ossimGeoid * findGeoidByShortName(const ossimString &shortName, bool caseSensitive=true)
static ossimGeoidManager * instance()
Implements singelton pattern:
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ pointHasCoverage()

virtual bool ossimDtedElevationDatabase::pointHasCoverage ( const ossimGpt ) const
inlinevirtual

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

Implements ossimElevSource.

Definition at line 36 of file ossimDtedElevationDatabase.h.

References ossimFilename::exists().

37  {
38  ossimFilename filename;
39  createFullPath(filename, gpt);
40 
41  return filename.exists();
42  }
bool exists() const
void createFullPath(ossimFilename &file, const ossimGpt &gpt) const

◆ print()

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

Definition at line 284 of file ossimDtedElevationDatabase.cpp.

References saveState().

285 {
286  ossimKeywordlist kwl;
287  saveState(kwl);
288  out << "\nossimDtedElevationDatabase @ "<< (ossim_uint64) this << "\n"
289  << kwl <<ends;
290  return out;
291 }
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Represents serializable keyword/value map.
unsigned long long ossim_uint64

◆ saveState()

bool ossimDtedElevationDatabase::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 ossimElevationCellDatabase.

Definition at line 274 of file ossimDtedElevationDatabase.cpp.

References ossimKeywordlist::add(), m_extension, m_upcase, and ossimElevationCellDatabase::saveState().

Referenced by print().

275 {
276  kwl.add(prefix, "extension", m_extension, true);
277  kwl.add(prefix, "upcase", m_upcase, true);
278 
279  bool result = ossimElevationCellDatabase::saveState(kwl, prefix);
280 
281  return result;
282 }
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)

Member Data Documentation

◆ m_extension

ossimString ossimDtedElevationDatabase::m_extension
protected

Definition at line 89 of file ossimDtedElevationDatabase.h.

Referenced by createRelativePath(), loadState(), and saveState().

◆ m_lastHandler

ossimRefPtr<ossimElevCellHandler> ossimDtedElevationDatabase::m_lastHandler
protected

Definition at line 94 of file ossimDtedElevationDatabase.h.

Referenced by getHeightAboveMSL().

◆ m_mutex

std::mutex ossimDtedElevationDatabase::m_mutex
mutableprotected

Definition at line 95 of file ossimDtedElevationDatabase.h.

Referenced by getAccuracyInfo(), and getHeightAboveMSL().

◆ m_upcase

bool ossimDtedElevationDatabase::m_upcase
protected

Definition at line 92 of file ossimDtedElevationDatabase.h.

Referenced by createRelativePath(), and saveState().


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