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

the DTED handler is an elevation source that allows for handling of a single cell of data. More...

#include <ossimDtedHandler.h>

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

Classes

class  DtedHeight
 DtedHeight is a class for storing DTED information. More...
 
class  DtedPost
 DtedPost, this class contains the height, weighting factor and status. More...
 

Public Types

enum  { DATA_RECORD_OFFSET_TO_POST = 8, DATA_RECORD_CHECKSUM_SIZE = 4, POST_SIZE = 2, NULL_POST = -32767 }
 
- 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

 ossimDtedHandler ()
 Constructor. More...
 
 ossimDtedHandler (const ossimFilename &dted_file, bool memoryMapFlag=false)
 Constructor. More...
 
virtual bool open (const ossimFilename &file, bool memoryMapFlag=false)
 opens a cell More...
 
virtual bool open (std::shared_ptr< ossim::istream > &fileStr, const std::string &connectionString, bool memoryMapFlag=false)
 opens a cell given a stream More...
 
virtual void close ()
 
virtual double getHeightAboveMSL (const ossimGpt &gpt)
 
virtual ossimIpt getSizeOfElevCell () const
 
virtual double getPostValue (const ossimIpt &gridPt) const
 
ossimString edition () const
 
ossimString productLevel () const
 
ossimString compilationDate () const
 
virtual bool isOpen () const
 
virtual bool getAccuracyInfo (ossimElevationAccuracyInfo &info, const ossimGpt &gpt) const
 
const ossimDtedVolvol () const
 
const ossimDtedHdrhdr () const
 
const ossimDtedUhluhl () const
 
const ossimDtedDsidsi () const
 
const ossimDtedAccacc () const
 
virtual ossimObjectdup () const
 
virtual ~ossimDtedHandler ()
 
- Public Member Functions inherited from ossimElevCellHandler
 ossimElevCellHandler (const char *elev_filename)
 Constructors: More...
 
 ossimElevCellHandler (const ossimElevCellHandler &src)
 
virtual const ossimFilenamegetFilename () const
 
virtual double getMeanSpacingMeters () const
 METHOD: meanSpacingMeters() Implements pure virtual for. More...
 
virtual bool pointHasCoverage (const ossimGpt &) const
 METHOD: pointIsInsideRect() Method to check if the ground point elevation is defined: More...
 
bool canConnectMyInputTo (ossim_int32 inputIndex, const ossimConnectableObject *object) const
 METHODS: accuracyLE90(), accuracyCE90() Returns the vertical and horizontal accuracy (90% confidence): More...
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
- Public Member Functions inherited from ossimElevSource
virtual double getHeightAboveEllipsoid (const ossimGpt &)
 
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 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
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
- 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
 

Static Public Attributes

static const int TOTAL_POSTS = 4
 
static const int NUM_POSTS_PER_BLOCK = 2
 

Protected Member Functions

const ossimDtedHandleroperator= (const ossimDtedHandler &rhs)
 
 ossimDtedHandler (const ossimDtedHandler &)
 
void gatherStatistics ()
 
ossim_sint16 convertSignedMagnitude (ossim_uint16 &s) const
 
virtual double getHeightAboveMSL (const ossimGpt &, bool readFromFile)
 
void readPostsFromFile (DtedHeight &postData, int offset)
 read the height posts from the File More...
 
- Protected Member Functions inherited from ossimElevCellHandler
 ossimElevCellHandler ()
 
virtual ~ossimElevCellHandler ()
 
- 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::mutex m_fileStrMutex
 
std::shared_ptr< ossim::istreamm_fileStr
 
std::string m_connectionString
 
ossim_int32 m_numLonLines
 
ossim_int32 m_numLatPoints
 
ossim_int32 m_dtedRecordSizeInBytes
 
ossimString m_edition
 
ossimString m_productLevel
 
ossimString m_compilationDate
 
ossim_int32 m_offsetToFirstDataRecord
 
double m_latSpacing
 
double m_lonSpacing
 
ossimDpt m_swCornerPost
 
bool m_swapBytesFlag
 
std::mutex m_memoryMapMutex
 
std::vector< ossim_uint8m_memoryMap
 
std::shared_ptr< ossimDtedVolm_vol
 
std::shared_ptr< ossimDtedHdrm_hdr
 
std::shared_ptr< ossimDtedUhlm_uhl
 
std::shared_ptr< ossimDtedDsim_dsi
 
std::shared_ptr< ossimDtedAccm_acc
 
- Protected Attributes inherited from ossimElevCellHandler
ossimFilename theFilename
 Virtual method for reading. More...
 
double theMeanSpacing
 
double theAbsLE90
 
double theAbsCE90
 
- 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 handler is an elevation source that allows for handling of a single cell of data.

DTED is typically a 1x1 degree cell.

This can open from an ossim::istream or from a filename. It allows one to query the cell by overriding the getHeightAboveMSL.

For reference

See also
ossimGpt Example:

When a height is calculated it will use a weighted average of 4 neighboring posts.

Definition at line 57 of file ossimDtedHandler.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
DATA_RECORD_OFFSET_TO_POST 
DATA_RECORD_CHECKSUM_SIZE 
POST_SIZE 
NULL_POST 

Definition at line 84 of file ossimDtedHandler.h.

Constructor & Destructor Documentation

◆ ossimDtedHandler() [1/3]

ossimDtedHandler::ossimDtedHandler ( )
inline

Constructor.

Definition at line 69 of file ossimDtedHandler.h.

70  {
71  }

◆ ossimDtedHandler() [2/3]

ossimDtedHandler::ossimDtedHandler ( const ossimFilename dted_file,
bool  memoryMapFlag = false 
)

Constructor.

Parameters
dted_fileis a file path to the dted cell we wish to open
memoryMapFlagIf this is set we will pull the entire cell into memory and treat that memory location as an inputstream.

Definition at line 36 of file ossimDtedHandler.cpp.

37  :
38  ossimElevCellHandler(dted_file),
39  m_fileStr(),
40  m_numLonLines(0),
41  m_numLatPoints(0),
43  m_edition(),
47  m_latSpacing(0.0),
48  m_lonSpacing(0.0),
50  m_swapBytesFlag(false)
51 {
52 
53  static const char MODULE[] = "ossimDtedHandler (Filename) Constructor";
54  if (traceExec())
55  {
57  << "DEBUG " << MODULE <<": entering..." << std::endl;
58  }
59 
61  //---
62  // Open the dted file for reading.
63  //---
64  if (!open(dted_file, memoryMapFlag))
65  {
67 
68  if (traceDebug())
69  {
71  << "FATAL " << MODULE << ": "
72  << "\nCould not open file: " << dted_file.c_str()
73  << "\nReturning..." << std::endl;
75  << "DEBUG " << MODULE << ": returning with error..." << std::endl;
76  }
77  return;
78  }
79  else
80  {
81  if (traceDebug())
82  {
84  << "DEBUG " << MODULE <<": Loading dted file: " << dted_file
85  << std::endl;
86  }
87  }
88 
89  // DTED is stored in big endian.
90  if (traceExec())
91  {
93  << "DEBUG " << MODULE << ": returning..." << std::endl;
94  }
95 }
virtual bool open(const ossimFilename &file, bool memoryMapFlag=false)
opens a cell
ossimString m_productLevel
ossim_int32 m_numLonLines
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
static const ossimErrorCode OSSIM_ERROR
ossimString m_compilationDate
std::shared_ptr< ossim::istream > m_fileStr
ossim_int32 m_numLatPoints
ossim_int32 m_offsetToFirstDataRecord
ossim_int32 m_dtedRecordSizeInBytes
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
ossimString m_edition
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ ~ossimDtedHandler()

ossimDtedHandler::~ossimDtedHandler ( )
virtual

Definition at line 97 of file ossimDtedHandler.cpp.

References close().

98 {
99  close();
100 }
virtual void close()

◆ ossimDtedHandler() [3/3]

ossimDtedHandler::ossimDtedHandler ( const ossimDtedHandler )
protected

Definition at line 548 of file ossimDtedHandler.cpp.

549  :
551 {}

Member Function Documentation

◆ acc()

const ossimDtedAcc& ossimDtedHandler::acc ( ) const
inline

Definition at line 162 of file ossimDtedHandler.h.

163  {
164  return *m_acc;
165  }
std::shared_ptr< ossimDtedAcc > m_acc

◆ close()

void ossimDtedHandler::close ( )
inlinevirtual

Reimplemented from ossimElevCellHandler.

Definition at line 293 of file ossimDtedHandler.h.

References m_fileStr, and m_memoryMap.

Referenced by open(), and ~ossimDtedHandler().

294 {
295  m_fileStr.reset();
296  m_memoryMap.clear();
297 }
std::vector< ossim_uint8 > m_memoryMap
std::shared_ptr< ossim::istream > m_fileStr

◆ compilationDate()

ossimString ossimDtedHandler::compilationDate ( ) const

Definition at line 537 of file ossimDtedHandler.cpp.

References m_compilationDate.

538 {
539  return m_compilationDate;
540 }
ossimString m_compilationDate

◆ convertSignedMagnitude()

ossim_sint16 ossimDtedHandler::convertSignedMagnitude ( ossim_uint16 s) const
inlineprotected

Definition at line 267 of file ossimDtedHandler.h.

References m_swapBytesFlag.

Referenced by getHeightAboveMSL(), and readPostsFromFile().

268 {
269  // DATA_VALUE_MASK 0x7fff = 0111 1111 1111 1111
270  // DATA_SIGN_MASK 0x8000 = 1000 0000 0000 0000
271 
272  // First check to see if the bytes need swapped.
273  s = (m_swapBytesFlag ? ( ((s & 0x00ff) << 8) | ((s & 0xff00) >> 8) ) : s);
274 
275  // If the sign bit is set, mask it out then multiply by negative one.
276  if (s & 0x8000)
277  {
278  return (static_cast<ossim_sint16>(s & 0x7fff) * -1);
279  }
280 
281  return static_cast<ossim_sint16>(s);
282 }
signed short ossim_sint16

◆ dsi()

const ossimDtedDsi& ossimDtedHandler::dsi ( ) const
inline

Definition at line 158 of file ossimDtedHandler.h.

159  {
160  return *m_dsi;
161  }
std::shared_ptr< ossimDtedDsi > m_dsi

◆ dup()

virtual ossimObject* ossimDtedHandler::dup ( ) const
inlinevirtual

Implements ossimElevSource.

Definition at line 167 of file ossimDtedHandler.h.

References ossimElevCellHandler::getFilename().

168  {
169  return new ossimDtedHandler(this->getFilename(), (m_memoryMap.size() != 0));
170  }
virtual const ossimFilename & getFilename() const
std::vector< ossim_uint8 > m_memoryMap
ossimDtedHandler()
Constructor.

◆ edition()

ossimString ossimDtedHandler::edition ( ) const

Definition at line 527 of file ossimDtedHandler.cpp.

References m_edition.

528 {
529  return m_edition;
530 }
ossimString m_edition

◆ gatherStatistics()

void ossimDtedHandler::gatherStatistics ( )
protected

If statistics file exist, stats will be initialized from that; else, this scans the dted cell and gets stats, then, writes new stats file. The statistics file will be named accordingly: If dted cell = n27.dt1 then the stats file = n27.statistics. Currently method only grabs the min and max posts value.

Definition at line 424 of file ossimDtedHandler.cpp.

References ossimFilename::setExtension(), and ossimElevCellHandler::theFilename.

425 {
426  //***
427  // Check to see if there is a statistics file already. If so; do a lookup
428  // for the min and max values.
429  //***
430  ossimFilename stats_file = theFilename;//theFilename.path();
431  stats_file.setExtension("statistics");
432 
433  if (traceDebug())
434  {
436  << "DEBUG ossimDtedHandler::gatherStatistics(): Looking for "
437  << stats_file << " statistics file..." << std::endl;
438  }
439 
440  ossimKeywordlist kwl;
441  const char* min_str = NULL;
442  const char* max_str = NULL;
443 
444  if (stats_file.exists())
445  {
446  if (kwl.addFile(stats_file))
447  {
448  // Look for the min_pixel_value keyword.
449  min_str = kwl.find(ossimKeywordNames::MIN_VALUE_KW);
450  max_str = kwl.find(ossimKeywordNames::MAX_VALUE_KW);
451  }
452  }
453 
454  if (min_str && max_str)
455  {
456  theMinHeightAboveMSL = atoi(min_str);
457  theMaxHeightAboveMSL = atoi(max_str);
458  }
459  else if (theComputeStatsFlag&&!m_memoryMap.size()) // Scan the cell and gather the statistics...
460  {
461  if(traceDebug())
462  {
464  << "NOTICE ossimDtedHandler::gatherStatistics():"
465  << " scanning for min/max"
466  << "\nThis may take a while..." << std::endl;
467  }
468  // Start off with the min and max pegged.
469  theMinHeightAboveMSL = 32767;
470  theMaxHeightAboveMSL = -32767;
471 
472  // Put the file pointer at the start of the first elevation post.
473  m_fileStr->seekg(m_offsetToFirstDataRecord, std::ios::beg);
474 
475  //---
476  // Loop through all records and scan for lowest min and highest max.
477  // Each record contains a row of latitude points for a given longitude.
478  // There are eight bytes in front of the post and four checksum bytes at
479  // the end so ignore them.
480  //---
481  for (ossim_int32 i=0; i<m_numLonLines; ++i) // longitude direction
482  {
483  m_fileStr->seekg(DATA_RECORD_OFFSET_TO_POST, std::ios::cur);
484 
485  for (ossim_int32 j=0; j<m_numLatPoints; ++j) // latitude direction
486  {
487  ossim_uint16 us;
488  ossim_sint16 ss;
489  m_fileStr->read((char*)&us, POST_SIZE);
490  ss = convertSignedMagnitude(us);
491  if (ss < theMinHeightAboveMSL && ss != NULL_POST)
492  {
494  }
495  if (ss > theMaxHeightAboveMSL)
496  {
498  }
499  }
500 
501  m_fileStr->seekg(DATA_RECORD_CHECKSUM_SIZE, std::ios::cur);
502  }
503 
504  // Add the stats to the keyword list.
507 
508  // Write out the statistics file.
509  kwl.write(stats_file.c_str());
510  }
511 
512  if (traceDebug())
513  {
515  << "DEBUG ossimDtedHandler::gatherStatistics:"
516  << "\ntheMinHeightAboveMSL: " << theMinHeightAboveMSL
517  << "\ntheMaxHeightAboveMSL: " << theMaxHeightAboveMSL
518  << std::endl;
519  }
520 }
static const char * MIN_VALUE_KW
Represents serializable keyword/value map.
bool addFile(const char *file)
const char * find(const char *key) const
double theMinHeightAboveMSL
Data members:
static const char * MAX_VALUE_KW
ossim_int32 m_numLonLines
std::vector< ossim_uint8 > m_memoryMap
unsigned short ossim_uint16
virtual bool write(const char *file, const char *comment=0) const
Methods to dump the ossimKeywordlist to a file on disk.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
bool exists() const
signed short ossim_sint16
std::shared_ptr< ossim::istream > m_fileStr
ossimFilename theFilename
Virtual method for reading.
ossim_int32 m_numLatPoints
ossim_sint16 convertSignedMagnitude(ossim_uint16 &s) const
ossim_int32 m_offsetToFirstDataRecord
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
double theMaxHeightAboveMSL
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
int ossim_int32

◆ getAccuracyInfo()

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

Reimplemented from ossimElevCellHandler.

Definition at line 102 of file ossimDtedHandler.cpp.

References ossimElevationAccuracyInfo::hasValidAbsoluteError(), ossimElevationAccuracyInfo::m_absoluteCE, ossimElevationAccuracyInfo::m_absoluteLE, m_acc, ossimElevationAccuracyInfo::m_confidenceLevel, m_dsi, ossimElevationAccuracyInfo::m_relativeCE, ossimElevationAccuracyInfo::m_relativeLE, and ossimElevationAccuracyInfo::m_surfaceName.

104 {
105  info.m_confidenceLevel = .9;
106  info.m_absoluteLE = m_acc->absLE();
107  info.m_absoluteCE = m_acc->absCE();
108  info.m_relativeLE = m_acc->relLE();
109  info.m_relativeCE = m_acc->relCE();
110 
111  info.m_surfaceName = m_dsi->productLevel();
112 
113  return info.hasValidAbsoluteError();
114 }
std::shared_ptr< ossimDtedDsi > m_dsi
std::shared_ptr< ossimDtedAcc > m_acc

◆ getHeightAboveMSL() [1/2]

double ossimDtedHandler::getHeightAboveMSL ( const ossimGpt gpt)
virtual
Parameters
gptis a ground point <lat, lon> that is used to lookup the elevation pos value.
Returns
height above Mean Sea Level (MSL).

Implements ossimElevSource.

Definition at line 116 of file ossimDtedHandler.cpp.

References m_fileStr, m_memoryMap, and ossim::nan().

117 {
118  if(m_memoryMap.size())
119  {
120  return getHeightAboveMSL(gpt, false);
121  }
122  else if((m_fileStr)&&(m_fileStr->good()))
123  {
124  return getHeightAboveMSL(gpt, true);
125  }
126 
127  return ossim::nan();
128 }
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
std::vector< ossim_uint8 > m_memoryMap
std::shared_ptr< ossim::istream > m_fileStr
virtual double getHeightAboveMSL(const ossimGpt &gpt)

◆ getHeightAboveMSL() [2/2]

double ossimDtedHandler::getHeightAboveMSL ( const ossimGpt gpt,
bool  readFromFile 
)
protectedvirtual

read the posts from the DTED file.

Definition at line 266 of file ossimDtedHandler.cpp.

References ossimDtedHandler::DtedHeight::calcHeight(), convertSignedMagnitude(), DATA_RECORD_OFFSET_TO_POST, ossimDtedHandler::DtedHeight::debug(), ossimDpt::lat, ossimGpt::lat, ossimDpt::lon, ossimGpt::lon, m_dtedRecordSizeInBytes, ossimDtedHandler::DtedPost::m_height, m_latSpacing, m_lonSpacing, m_memoryMap, m_numLatPoints, m_numLonLines, m_offsetToFirstDataRecord, ossimDtedHandler::DtedHeight::m_posts, ossimDtedHandler::DtedPost::m_status, m_swCornerPost, ossimDtedHandler::DtedPost::m_weight, ossim::nan(), POST_SIZE, and readPostsFromFile().

267 {
268  // Establish the grid indexes:
269  double xi = (gpt.lon - m_swCornerPost.lon) / m_lonSpacing;
270  double yi = (gpt.lat - m_swCornerPost.lat) / m_latSpacing;
271 
272  // Check for right edge.
273  int x0 = static_cast<int>(xi);
274  int y0 = static_cast<int>(yi);
275 
276  if(x0 == (m_numLonLines-1))
277  {
278  --x0; // Move over one post.
279  }
280 
281  // Check for top edge.
282  // if (gpt.lat == theGroundRect.ul().lat)
283  if(y0 == (m_numLatPoints-1))
284  {
285  --y0; // Move down one post.
286  }
287 
288  // Do some error checking.
289  if ( xi < 0.0 || yi < 0.0 ||
290  x0 > (m_numLonLines - 2.0) ||
291  y0 > (m_numLatPoints - 2.0) )
292  {
293  return ossim::nan();
294  }
295 
296  //***
297  // Grab the four points from the dted cell needed. These are big endian,
298  // signed magnitude shorts so they must be interpreted accordingly.
299  //***
302 
304  DtedHeight postData;
305  //
306  if ( readFromFile )
307  {
308  readPostsFromFile( postData, offset );
309  }
310  else
311  {
312  ossim_uint8* buf = &m_memoryMap.front();
313  {
314  ossim_uint16 us;
315 
316  memcpy(&us, buf+offset, POST_SIZE);
317  postData.m_posts[0].m_height = convertSignedMagnitude(us);
318  postData.m_posts[0].m_status = true;
319  memcpy(&us, buf+offset+POST_SIZE, POST_SIZE);
320  postData.m_posts[1].m_height = convertSignedMagnitude(us);
321  postData.m_posts[1].m_status = true;
322 
323  // Move over to the next column.
324  offset += m_dtedRecordSizeInBytes;
325  memcpy(&us, buf+offset, POST_SIZE);
326  postData.m_posts[2].m_height = convertSignedMagnitude(us);
327  postData.m_posts[2].m_status = true;
328  memcpy(&us, buf+offset+POST_SIZE, POST_SIZE);
329  postData.m_posts[3].m_height = convertSignedMagnitude(us);
330  postData.m_posts[3].m_status = true;
331  }
332  }
333  // Perform bilinear interpolation:
334  double wx1 = xi - x0;
335  double wy1 = yi - y0;
336  double wx0 = 1.0 - wx1;
337  double wy0 = 1.0 - wy1;
338 
339  postData.m_posts[0].m_weight = wx0*wy0;
340  postData.m_posts[1].m_weight = wx0*wy1;
341  postData.m_posts[2].m_weight = wx1*wy0;
342  postData.m_posts[3].m_weight = wx1*wy1;
343 
344 #if 0 /* Serious debug only... */
345  postData.debug();
346 #endif
347 
348  return postData.calcHeight();
349 }
void readPostsFromFile(DtedHeight &postData, int offset)
read the height posts from the File
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
ossim_int32 m_numLonLines
std::vector< ossim_uint8 > m_memoryMap
unsigned short ossim_uint16
double lat
Definition: ossimDpt.h:165
ossim_float64 lon
Definition: ossimGpt.h:266
double lon
Definition: ossimDpt.h:164
ossim_int32 m_numLatPoints
ossim_sint16 convertSignedMagnitude(ossim_uint16 &s) const
ossim_int32 m_offsetToFirstDataRecord
ossim_int32 m_dtedRecordSizeInBytes
ossim_float64 lat
Definition: ossimGpt.h:265
unsigned char ossim_uint8

◆ getPostValue()

double ossimDtedHandler::getPostValue ( const ossimIpt gridPt) const
virtual

METHOD: getPostValue Returns the value at a given grid point as a double. Satisfies pure virtual.

Implements ossimElevCellHandler.

Definition at line 387 of file ossimDtedHandler.cpp.

References m_numLatPoints, m_numLonLines, ossimIpt::x, and ossimIpt::y.

388 {
389  static const char MODULE[] = "ossimDtedHandler::getPostValue";
390 
391  // Do some error checking.
392  if ( gridPt.x < 0.0 || gridPt.y < 0.0 ||
393  gridPt.x > (m_numLonLines - 1) ||
394  gridPt.y > (m_numLatPoints - 1) )
395  {
396  if(traceDebug())
397  {
399  << "WARNING " << MODULE << ": No intersection..." << std::endl;
400  }
401  return ossim::nan();
402  }
403 
404  if (!isOpen())
405  {
406  return ossim::nan();
407  }
408 
409  int offset =
411  gridPt.y * 2 + DATA_RECORD_OFFSET_TO_POST;
412 
413  // Put the file pointer at the start of the first elevation post.
414  m_fileStr->seekg(offset, std::ios::beg);
415 
416  ossim_uint16 us;
417 
418  // Get the post.
419  m_fileStr->read((char*)&us, POST_SIZE);
420 
421  return double(convertSignedMagnitude(us));
422 }
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
ossim_int32 m_numLonLines
unsigned short ossim_uint16
virtual bool isOpen() const
std::shared_ptr< ossim::istream > m_fileStr
ossim_int32 m_numLatPoints
ossim_sint16 convertSignedMagnitude(ossim_uint16 &s) const
ossim_int32 m_offsetToFirstDataRecord
ossim_int32 m_dtedRecordSizeInBytes
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ getSizeOfElevCell()

ossimIpt ossimDtedHandler::getSizeOfElevCell ( ) const
virtual

METHOD: getSizeOfElevCell Returns the number of post in the cell. Satisfies pure virtual. Note: x = longitude, y = latitude

Implements ossimElevCellHandler.

Definition at line 522 of file ossimDtedHandler.cpp.

References m_numLatPoints, and m_numLonLines.

523 {
525 }
ossim_int32 m_numLonLines
ossim_int32 m_numLatPoints

◆ hdr()

const ossimDtedHdr& ossimDtedHandler::hdr ( ) const
inline

Definition at line 150 of file ossimDtedHandler.h.

151  {
152  return *m_hdr;
153  }
std::shared_ptr< ossimDtedHdr > m_hdr

◆ isOpen()

bool ossimDtedHandler::isOpen ( ) const
inlinevirtual

Definition at line 284 of file ossimDtedHandler.h.

References m_fileStr, m_fileStrMutex, and m_memoryMap.

285 {
286 
287  if(!m_memoryMap.empty()) return true;
288  std::lock_guard<std::mutex> lock(m_fileStrMutex);
289 
290  return (m_fileStr != 0);
291 }
std::vector< ossim_uint8 > m_memoryMap
std::mutex m_fileStrMutex
std::shared_ptr< ossim::istream > m_fileStr

◆ open() [1/2]

bool ossimDtedHandler::open ( const ossimFilename file,
bool  memoryMapFlag = false 
)
virtual

opens a cell

Parameters
fileis a file path to the dted cell we wish to open
memoryMapFlagIf this is set we will pull the entire cell into memory and treat that memory location as an inputstream.

Reimplemented from ossimElevCellHandler.

Definition at line 130 of file ossimDtedHandler.cpp.

References ossimString::c_str(), and ossim::StreamFactoryRegistry::instance().

Referenced by ossimDtedElevationDatabase::inititializeExtension().

131 {
132  std::string connectionString = file.c_str();
133  std::shared_ptr<ossim::istream> str = ossim::StreamFactoryRegistry::instance()->
134  createIstream( file.c_str(), std::ios_base::in|std::ios_base::binary);
135  if(!str) return false;
136  return open(str, connectionString, memoryMapFlag);
137 }
virtual bool open(const ossimFilename &file, bool memoryMapFlag=false)
opens a cell
static StreamFactoryRegistry * instance()
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

◆ open() [2/2]

bool ossimDtedHandler::open ( std::shared_ptr< ossim::istream > &  fileStr,
const std::string &  connectionString,
bool  memoryMapFlag = false 
)
virtual

opens a cell given a stream

Parameters
fileStris a stream that was opened and has access to a cell.
connectionStringis the connection string used to open the input stream.
memoryMapFlagIf this is set we will pull the entire cell into memory and treat that memory location as an inputstream.

Definition at line 139 of file ossimDtedHandler.cpp.

References close(), m_acc, m_connectionString, m_dsi, m_dtedRecordSizeInBytes, m_fileStr, m_hdr, m_numLatPoints, m_numLonLines, m_uhl, m_vol, and ossimErrorCodes::OSSIM_ERROR.

142 {
143  static const char* MODULE = "ossimDtedHandler::open";
144  close();
145  if(!fileStr) return false;
146 
147  m_vol = std::make_shared<ossimDtedVol>();
148  m_hdr = std::make_shared<ossimDtedHdr>();
149  m_uhl = std::make_shared<ossimDtedUhl>();
150  m_dsi = std::make_shared<ossimDtedDsi>();
151  m_acc = std::make_shared<ossimDtedAcc>();
152 
153  m_connectionString = connectionString;
154 
155  m_fileStr = fileStr;
156  m_fileStr->clear();
157 
158  m_numLonLines = 0;
159  m_numLatPoints = 0;
161 
162  // Attempt to parse.
163  m_vol->parse(*m_fileStr);
164  m_hdr->parse(*m_fileStr);
165  m_uhl->parse(*m_fileStr);
166  m_dsi->parse(*m_fileStr);
167  m_acc->parse(*m_fileStr);
168 
169  //***
170  // Check for errors. Must have uhl, dsi and acc records. vol and hdr
171  // are for magnetic tape only; hence, may or may not be there.
172  //***
173  if (m_uhl->getErrorStatus() == ossimErrorCodes::OSSIM_ERROR ||
174  m_dsi->getErrorStatus() == ossimErrorCodes::OSSIM_ERROR ||
175  m_acc->getErrorStatus() == ossimErrorCodes::OSSIM_ERROR)
176  {
177  if (traceDebug())
178  {
180  << "DEBUG " << MODULE << ": "
181  << "\nError parsing file: " << m_connectionString
182  << "\nPossibly not a dted file."
183  << std::endl;
184  }
185 
187  close();
188  return false;
189  }
190  if(memoryMapFlag)
191  {
192  ossim_int64 streamSize;
193  m_fileStr->clear();
194  m_fileStr->seekg(0, std::ios::end);
195  streamSize = m_fileStr->tellg();
196  m_fileStr->seekg(0, std::ios::beg);
197 
198  m_memoryMap.resize(streamSize);//theFilename.fileSize());
199  m_fileStr->read((char*)(&m_memoryMap.front()), (std::streamsize)m_memoryMap.size());
200  m_fileStr.reset();
201  }
202 
203  m_numLonLines = m_uhl->numLonLines();
204  m_numLatPoints = m_uhl->numLatPoints();
205  m_latSpacing = m_uhl->latInterval();
206  m_lonSpacing = m_uhl->lonInterval();
208 
209  m_edition = m_dsi->edition();
210  m_productLevel = m_dsi->productLevel();
211  m_compilationDate = m_dsi->compilationDate();
212 
213  m_offsetToFirstDataRecord = m_acc->stopOffset();
214 
215  #if 0 /* Serious debug only... */
216  std::cout << m_numLonLines
217  << "\t" << m_numLatPoints
218  << "\t" << m_lonSpacing
219  << "\t" << m_latSpacing
220  << "\t" << m_dtedRecordSizeInBytes
221  << "\t" << theFilename.fileSize()
222  << "\t" << file
223  << "\t" << m_offsetToFirstDataRecord
224  << std::endl;
225  #endif
226 
227  //***
228  // initialize the bounding rectangle:
229  //***
230  double south_boundary = m_uhl->latOrigin();
231  double west_boundary = m_uhl->lonOrigin();
232  double north_boundary = south_boundary + m_latSpacing*(m_numLatPoints-1);
233  double east_boundary = west_boundary + m_lonSpacing*(m_numLonLines-1);
234 
235  // For ossimElevCellHandler::pointHasCoverage method.
236  theGroundRect = ossimGrect(ossimGpt(north_boundary, west_boundary, 0.0),
237  ossimGpt(south_boundary, east_boundary, 0.0));
238 
239  m_swCornerPost.lat = south_boundary;
240  m_swCornerPost.lon = west_boundary;
241 
242  //***
243  // Determine the mean spacing:
244  //***
245  double center_lat = (south_boundary + north_boundary)/2.0;
247  * ossimGpt().metersPerDegree().x / 2.0;
248 
249  // Initialize the accuracy values:
250  theAbsLE90 = m_acc->absLE();
251  theAbsCE90 = m_acc->absCE();
252 
253  // Set the base class null height value.
254  theNullHeightValue = -32767.0;
255 
256  //---
257  // Commented out as this writes an un-needed file. (drb 20100611)
258  // Get the statistics.
259  // gatherStatistics();
260  //---
261 
262  return true;
263 
264 }
std::shared_ptr< ossimDtedVol > m_vol
ossimString m_productLevel
ossim_int64 fileSize() const
std::shared_ptr< ossimDtedUhl > m_uhl
virtual void close()
ossim_int32 m_numLonLines
static const ossimErrorCode OSSIM_ERROR
std::vector< ossim_uint8 > m_memoryMap
std::shared_ptr< ossimDtedHdr > m_hdr
std::shared_ptr< ossimDtedDsi > m_dsi
ossimGrect theGroundRect
double lat
Definition: ossimDpt.h:165
ossimString m_compilationDate
std::shared_ptr< ossim::istream > m_fileStr
ossimFilename theFilename
Virtual method for reading.
double cosd(double x)
Definition: ossimCommon.h:259
double lon
Definition: ossimDpt.h:164
ossim_int32 m_numLatPoints
ossim_int32 m_offsetToFirstDataRecord
ossim_int32 m_dtedRecordSizeInBytes
std::shared_ptr< ossimDtedAcc > m_acc
double x
Definition: ossimDpt.h:164
long long ossim_int64
ossimDpt metersPerDegree() const
Definition: ossimGpt.cpp:498
ossimString m_edition
std::string m_connectionString
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ operator=()

const ossimDtedHandler & ossimDtedHandler::operator= ( const ossimDtedHandler rhs)
protected

Definition at line 542 of file ossimDtedHandler.cpp.

544 {
545  return rhs;
546 }

◆ productLevel()

ossimString ossimDtedHandler::productLevel ( ) const

Definition at line 532 of file ossimDtedHandler.cpp.

References m_productLevel.

533 {
534  return m_productLevel;
535 }
ossimString m_productLevel

◆ readPostsFromFile()

void ossimDtedHandler::readPostsFromFile ( DtedHeight postData,
int  offset 
)
protected

read the height posts from the File

Parameters
postData- post heights, status & weight
offset- file contents offset to start reading from

Definition at line 351 of file ossimDtedHandler.cpp.

References convertSignedMagnitude(), m_dtedRecordSizeInBytes, m_fileStr, m_fileStrMutex, ossimDtedHandler::DtedPost::m_height, ossimDtedHandler::DtedHeight::m_posts, ossimDtedHandler::DtedPost::m_status, NUM_POSTS_PER_BLOCK, and POST_SIZE.

Referenced by getHeightAboveMSL().

352 {
353 
354  std::lock_guard<std::mutex> lock( m_fileStrMutex );
355  ossim_sint16 ss;
356  ossim_uint16 us;
357  int postCount = 0;
358  // read the posts in blocks 2x2.
359  for ( int column = 0; column < NUM_POSTS_PER_BLOCK ; ++column )
360  {
361  m_fileStr->seekg( offset, std::ios::beg );
362  for ( int row = 0; row < NUM_POSTS_PER_BLOCK ; ++row )
363  {
364  if ( !m_fileStr->eof() )
365  {
366  us = 0;
367  m_fileStr->read( ( char* ) &us, POST_SIZE );
368  // check the read was ok
369  if ( m_fileStr->good() )
370  {
371  postData.m_posts[postCount].m_status = true;
372  }
373  else
374  {
375  // reset the goodbit
376  m_fileStr->clear();
377  }
378  ss = convertSignedMagnitude( us );
379  postData.m_posts[postCount].m_height = ss;
380  }
381  postCount++;
382  }
383  offset += m_dtedRecordSizeInBytes;
384  }
385 }
unsigned short ossim_uint16
static const int NUM_POSTS_PER_BLOCK
std::mutex m_fileStrMutex
signed short ossim_sint16
std::shared_ptr< ossim::istream > m_fileStr
ossim_sint16 convertSignedMagnitude(ossim_uint16 &s) const
ossim_int32 m_dtedRecordSizeInBytes

◆ uhl()

const ossimDtedUhl& ossimDtedHandler::uhl ( ) const
inline

Definition at line 154 of file ossimDtedHandler.h.

155  {
156  return *m_uhl;
157  }
std::shared_ptr< ossimDtedUhl > m_uhl

◆ vol()

const ossimDtedVol& ossimDtedHandler::vol ( ) const
inline

Definition at line 146 of file ossimDtedHandler.h.

147  {
148  return *m_vol;
149  }
std::shared_ptr< ossimDtedVol > m_vol

Member Data Documentation

◆ m_acc

std::shared_ptr<ossimDtedAcc> ossimDtedHandler::m_acc
protected

Definition at line 262 of file ossimDtedHandler.h.

Referenced by getAccuracyInfo(), and open().

◆ m_compilationDate

ossimString ossimDtedHandler::m_compilationDate
protected

Definition at line 246 of file ossimDtedHandler.h.

Referenced by compilationDate().

◆ m_connectionString

std::string ossimDtedHandler::m_connectionString
mutableprotected

Definition at line 239 of file ossimDtedHandler.h.

Referenced by open().

◆ m_dsi

std::shared_ptr<ossimDtedDsi> ossimDtedHandler::m_dsi
protected

Definition at line 261 of file ossimDtedHandler.h.

Referenced by getAccuracyInfo(), and open().

◆ m_dtedRecordSizeInBytes

ossim_int32 ossimDtedHandler::m_dtedRecordSizeInBytes
protected

Definition at line 243 of file ossimDtedHandler.h.

Referenced by getHeightAboveMSL(), open(), and readPostsFromFile().

◆ m_edition

ossimString ossimDtedHandler::m_edition
protected

Definition at line 244 of file ossimDtedHandler.h.

Referenced by edition().

◆ m_fileStr

std::shared_ptr<ossim::istream> ossimDtedHandler::m_fileStr
mutableprotected

Definition at line 238 of file ossimDtedHandler.h.

Referenced by close(), getHeightAboveMSL(), isOpen(), open(), and readPostsFromFile().

◆ m_fileStrMutex

std::mutex ossimDtedHandler::m_fileStrMutex
mutableprotected

Definition at line 236 of file ossimDtedHandler.h.

Referenced by isOpen(), and readPostsFromFile().

◆ m_hdr

std::shared_ptr<ossimDtedHdr> ossimDtedHandler::m_hdr
protected

Definition at line 259 of file ossimDtedHandler.h.

Referenced by open().

◆ m_latSpacing

double ossimDtedHandler::m_latSpacing
protected

Definition at line 248 of file ossimDtedHandler.h.

Referenced by getHeightAboveMSL().

◆ m_lonSpacing

double ossimDtedHandler::m_lonSpacing
protected

Definition at line 249 of file ossimDtedHandler.h.

Referenced by getHeightAboveMSL().

◆ m_memoryMap

std::vector<ossim_uint8> ossimDtedHandler::m_memoryMap
mutableprotected

Definition at line 256 of file ossimDtedHandler.h.

Referenced by close(), getHeightAboveMSL(), and isOpen().

◆ m_memoryMapMutex

std::mutex ossimDtedHandler::m_memoryMapMutex
mutableprotected

Definition at line 255 of file ossimDtedHandler.h.

◆ m_numLatPoints

ossim_int32 ossimDtedHandler::m_numLatPoints
protected

Definition at line 242 of file ossimDtedHandler.h.

Referenced by getHeightAboveMSL(), getPostValue(), getSizeOfElevCell(), and open().

◆ m_numLonLines

ossim_int32 ossimDtedHandler::m_numLonLines
protected

Definition at line 241 of file ossimDtedHandler.h.

Referenced by getHeightAboveMSL(), getPostValue(), getSizeOfElevCell(), and open().

◆ m_offsetToFirstDataRecord

ossim_int32 ossimDtedHandler::m_offsetToFirstDataRecord
protected

Definition at line 247 of file ossimDtedHandler.h.

Referenced by getHeightAboveMSL().

◆ m_productLevel

ossimString ossimDtedHandler::m_productLevel
protected

Definition at line 245 of file ossimDtedHandler.h.

Referenced by productLevel().

◆ m_swapBytesFlag

bool ossimDtedHandler::m_swapBytesFlag
protected

Definition at line 253 of file ossimDtedHandler.h.

Referenced by convertSignedMagnitude().

◆ m_swCornerPost

ossimDpt ossimDtedHandler::m_swCornerPost
protected

Definition at line 250 of file ossimDtedHandler.h.

Referenced by getHeightAboveMSL().

◆ m_uhl

std::shared_ptr<ossimDtedUhl> ossimDtedHandler::m_uhl
protected

Definition at line 260 of file ossimDtedHandler.h.

Referenced by open().

◆ m_vol

std::shared_ptr<ossimDtedVol> ossimDtedHandler::m_vol
protected

Definition at line 258 of file ossimDtedHandler.h.

Referenced by open().

◆ NUM_POSTS_PER_BLOCK

const int ossimDtedHandler::NUM_POSTS_PER_BLOCK = 2
static

Definition at line 64 of file ossimDtedHandler.h.

Referenced by readPostsFromFile().

◆ TOTAL_POSTS

const int ossimDtedHandler::TOTAL_POSTS = 4
static

Definition at line 62 of file ossimDtedHandler.h.

Referenced by ossimDtedHandler::DtedHeight::calcHeight().


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