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

Elevation source used for working with generic images opened by an ossimImageHandler. More...

#include <ossimTiledElevationDatabase.h>

Inheritance diagram for ossimTiledElevationDatabase:
ossimElevationDatabase ossimFileProcessorInterface ossimElevSource ossimSource ossimConnectableObject ossimErrorStatusInterface ossimObject ossimListenerManager ossimPropertyInterface ossimReferenced

Classes

struct  ossimTiledElevationEntry
 

Public Member Functions

 ossimTiledElevationDatabase ()
 default constructor More...
 
virtual bool open (const ossimString &connectionString)
 Open a connection to a database. More...
 
virtual void close ()
 close method. More...
 
void mapRegion (const ossimGrect &region)
 Maps elevation data for region to a grid. More...
 
virtual double getHeightAboveMSL (const ossimGpt &gpt)
 Get height above MSL for point. More...
 
virtual double getHeightAboveEllipsoid (const ossimGpt &)
 Get height above ellipsoid for point. More...
 
virtual bool pointHasCoverage (const ossimGpt &gpt) const
 Satisfies pure virtual ossimElevSource::pointHasCoverage. More...
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 Initialize from keyword list. More...
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Save the state to a keyword list. More...
 
bool getAccuracyInfo (ossimElevationAccuracyInfo &info, const ossimGpt &) const
 
virtual void processFile (const ossimFilename &file)
 ProcessFile method. More...
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
virtual ossimObjectdup () const
 
- 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
 
- Public Member Functions inherited from ossimFileProcessorInterface
 ossimFileProcessorInterface ()
 default constructor More...
 
virtual ~ossimFileProcessorInterface ()
 virtual destructor. More...
 

Protected Member Functions

virtual ~ossimTiledElevationDatabase ()
 Protected destructor as this is derived from ossimRefenced. More...
 
- 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)
 

Private Member Functions

void addEntry (const ossimTiledElevationEntry &entry)
 adds entry to the list checking for duplicates. More...
 
void initializeReferenceProjection ()
 Initializes m_referenceProj from the first entry. More...
 
bool isDirectoryBasedImage (ossimRefPtr< ossimImageHandler > ih)
 
bool isCompatible (ossimImageHandler *ih, ossimImageGeometry *geom, ossimProjection *proj) const
 Check for match of the following against the first entry of: bands, projection, scalar type and scale. More...
 
void getBoundingRect (ossimRefPtr< ossimImageGeometry > geom, ossimGrect &boundingRect) const
 Initialize bounding rectangle from image handler. More...
 
void mapRegion ()
 Loads m_requestedRect into m_grid from m_entries. More...
 
template<class T >
void fillGrid (T dummyTemplate, ossimRefPtr< ossimImageData > data)
 Templated fill grid method. More...
 
 ossimTiledElevationDatabase (const ossimTiledElevationDatabase &copy_this)
 Hidden from use copy constructor. More...
 

Private Attributes

std::vector< ossimTiledElevationEntrym_entries
 
ossimDblGridm_grid
 Hold region of elevation. More...
 
ossimRefPtr< ossimProjectionm_referenceProj
 Projection of the first entry. More...
 
ossimGrect m_requestedRect
 
ossimGrect m_entryListRect
 
ossimGrect m_mappedRect
 
ossimFileWalkerm_fileWalker
 

Additional Inherited Members

- 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
 
- 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

Elevation source used for working with generic images opened by an ossimImageHandler.

This class is typically utilized through the ossimElevManager.

This class supplies a mapRegion method used to map a region of elevation to a grid. The grid in turn is used for the getHeightAboveMSL. This class is for applications that know their region of interest up front and want to bypass the ossimElevManager and grid the elevation prior to processing for speed. Can work on a file or a directory of files.

Definition at line 47 of file ossimTiledElevationDatabase.h.

Constructor & Destructor Documentation

◆ ossimTiledElevationDatabase() [1/2]

ossimTiledElevationDatabase::ossimTiledElevationDatabase ( )

default constructor

Definition at line 38 of file ossimTiledElevationDatabase.cpp.

References m_entryListRect, m_requestedRect, ossimGrect::makeNan(), and ossimElevSource::theGroundRect.

39  :
42  m_entries(0),
43  m_grid(0),
44  m_referenceProj(0),
47  m_fileWalker(0)
48 {
51 
52  //---
53  // Use the ossimElevSource::theGroundRect to hold the mapped rect expanded to even post
54  // boundaries.
55  //---
57 }
ossimRefPtr< ossimProjection > m_referenceProj
Projection of the first entry.
void makeNan()
Definition: ossimGrect.h:284
ossimFileProcessorInterface()
default constructor
ossimGrect theGroundRect
ossimDblGrid * m_grid
Hold region of elevation.
std::vector< ossimTiledElevationEntry > m_entries

◆ ~ossimTiledElevationDatabase()

ossimTiledElevationDatabase::~ossimTiledElevationDatabase ( )
protectedvirtual

Protected destructor as this is derived from ossimRefenced.

Definition at line 60 of file ossimTiledElevationDatabase.cpp.

References m_entries, m_fileWalker, m_grid, and m_referenceProj.

61 {
62  m_referenceProj = 0;
63  m_entries.clear();
64  if ( m_grid )
65  {
66  delete m_grid;
67  m_grid = 0;
68  }
69  if ( m_fileWalker )
70  {
71  delete m_fileWalker;
72  m_fileWalker = 0;
73  }
74 }
ossimRefPtr< ossimProjection > m_referenceProj
Projection of the first entry.
ossimDblGrid * m_grid
Hold region of elevation.
std::vector< ossimTiledElevationEntry > m_entries

◆ ossimTiledElevationDatabase() [2/2]

ossimTiledElevationDatabase::ossimTiledElevationDatabase ( const ossimTiledElevationDatabase copy_this)
private

Hidden from use copy constructor.

Definition at line 634 of file ossimTiledElevationDatabase.cpp.

636 {
637 }

Member Function Documentation

◆ addEntry()

void ossimTiledElevationDatabase::addEntry ( const ossimTiledElevationEntry entry)
private

adds entry to the list checking for duplicates.

Definition at line 297 of file ossimTiledElevationDatabase.cpp.

References ossimSingleImageChain::getFilename(), m_entries, and ossimTiledElevationDatabase::ossimTiledElevationEntry::m_sic.

298 {
299  bool result = true;
300  std::vector<ossimTiledElevationEntry>::const_iterator i = m_entries.begin();
301  while ( i != m_entries.end() )
302  {
303  if ( (*i).m_sic->getFilename() == entry.m_sic->getFilename() )
304  {
305  result = false; // In list already.
306  break;
307  }
308  ++i;
309  }
310  if ( result )
311  {
312  m_entries.push_back(entry); // Add to list.
313  }
314 }
std::vector< ossimTiledElevationEntry > m_entries

◆ close()

void ossimTiledElevationDatabase::close ( )
virtual

close method.

Unreferences all data.

Definition at line 106 of file ossimTiledElevationDatabase.cpp.

References ossimString::clear(), ossimElevationDatabase::m_connectionString, m_entries, m_entryListRect, ossimElevationDatabase::m_geoid, m_grid, ossimElevationDatabase::m_meanSpacing, m_referenceProj, m_requestedRect, ossimGrect::makeNan(), and ossimElevSource::theGroundRect.

107 {
111  m_referenceProj = 0;
112  m_entries.clear();
113  if ( m_grid )
114  {
115  delete m_grid;
116  m_grid = 0;
117  }
118  m_meanSpacing = 0.0;
119  m_geoid = 0;
121 }
void clear()
Erases the entire container.
Definition: ossimString.h:432
ossimRefPtr< ossimProjection > m_referenceProj
Projection of the first entry.
void makeNan()
Definition: ossimGrect.h:284
ossimGrect theGroundRect
ossimDblGrid * m_grid
Hold region of elevation.
ossimRefPtr< ossimGeoid > m_geoid
std::vector< ossimTiledElevationEntry > m_entries

◆ dup()

virtual ossimObject* ossimTiledElevationDatabase::dup ( ) const
inlinevirtual

Implements ossimElevSource.

Definition at line 131 of file ossimTiledElevationDatabase.h.

References open().

132  {
134  duped->open(m_connectionString);
135  return duped;
136  }
ossimTiledElevationDatabase()
default constructor
Elevation source used for working with generic images opened by an ossimImageHandler.
virtual bool open(const ossimString &connectionString)
Open a connection to a database.

◆ fillGrid()

template<class T >
void ossimTiledElevationDatabase::fillGrid ( dummyTemplate,
ossimRefPtr< ossimImageData data 
)
private

Templated fill grid method.

Definition at line 606 of file ossimTiledElevationDatabase.cpp.

References ossimImageData::getBuf(), ossimImageData::getHeight(), ossimImageData::getNullPix(), ossimImageData::getWidth(), m_grid, ossim::nan(), ossimDblGrid::setNode(), ossimRefPtr< T >::valid(), x, and y.

608 {
609  if ( data.valid() )
610  {
611  // Copy to grid reversing the lines as the ossimDblGrid's origin is the SW corner.
612  const ossim_float64 NP = data->getNullPix(0);
613  const T* buf = static_cast<T*>(data->getBuf(0));
614  if ( buf )
615  {
616  const ossimIpt SIZE( data->getWidth(), data->getHeight() );
617  ossim_int32 bufIdx = (SIZE.y-1) * data->getWidth();
618  ossim_int32 grdY = 0;
619  for (ossim_int32 y = SIZE.y-1; y >= 0; --y)
620  {
621  for (ossim_int32 x = 0; x < SIZE.x; ++ x)
622  {
623  ossim_float64 v = static_cast<ossim_float64>(buf[bufIdx+x]);
624  m_grid->setNode(x, grdY, (v!=NP?v:ossim::nan()) );
625  }
626  bufIdx -= data->getWidth();
627  ++grdY;
628  }
629  }
630  }
631 }
virtual ossim_uint32 getWidth() const
ossim_uint32 x
ossim_uint32 y
bool valid() const
Definition: ossimRefPtr.h:75
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
virtual ossim_uint32 getHeight() const
double ossim_float64
ossimDblGrid * m_grid
Hold region of elevation.
virtual const ossim_float64 * getNullPix() const
virtual const void * getBuf() const
void setNode(const ossimIpt &p, const double &value)
Definition: ossimDblGrid.h:107
int ossim_int32

◆ getAccuracyInfo()

bool ossimTiledElevationDatabase::getAccuracyInfo ( ossimElevationAccuracyInfo info,
const ossimGpt  
) const
inlinevirtual

Reimplemented from ossimElevationDatabase.

Definition at line 108 of file ossimTiledElevationDatabase.h.

References ossimElevationAccuracyInfo::makeNan().

109  {
110  info.makeNan();
111 
112  return false;
113  }

◆ getBoundingRect()

void ossimTiledElevationDatabase::getBoundingRect ( ossimRefPtr< ossimImageGeometry geom,
ossimGrect boundingRect 
) const
private

Initialize bounding rectangle from image handler.

Sets boundingRect to nan if ossimImageGeometry::getCornerGpts returns false.

Parameters
ihImage handler.
boundingRectInitialized by method.

Definition at line 466 of file ossimTiledElevationDatabase.cpp.

References ossimImageGeometry::getCornerGpts(), ossimGpt::lat, ossimGpt::lon, ossimGrect::makeNan(), and ossimRefPtr< T >::valid().

468 {
469  if ( geom.valid() )
470  {
471  std::vector<ossimGpt> corner(4);
472  if ( geom->getCornerGpts(corner[0], corner[1], corner[2], corner[3]) )
473  {
474  ossimGpt ulGpt(corner[0]);
475  ossimGpt lrGpt(corner[0]);
476  for ( ossim_uint32 i = 1; i < 4; ++i )
477  {
478  if ( corner[i].lon < ulGpt.lon ) ulGpt.lon = corner[i].lon;
479  if ( corner[i].lat > ulGpt.lat ) ulGpt.lat = corner[i].lat;
480  if ( corner[i].lon > lrGpt.lon ) lrGpt.lon = corner[i].lon;
481  if ( corner[i].lat < lrGpt.lat ) lrGpt.lat = corner[i].lat;
482  }
483  boundingRect = ossimGrect(ulGpt, lrGpt);
484  }
485  else
486  {
487  boundingRect.makeNan();
488  }
489  }
490 }
bool valid() const
Definition: ossimRefPtr.h:75
void makeNan()
Definition: ossimGrect.h:284
bool getCornerGpts(ossimGpt &ul, ossimGpt &ur, ossimGpt &lr, ossimGpt &ll) const
Assigns the ossimGpts with the ground coordinates of the four corresponding image corner points...
unsigned int ossim_uint32

◆ getHeightAboveEllipsoid()

double ossimTiledElevationDatabase::getHeightAboveEllipsoid ( const ossimGpt gpt)
virtual

Get height above ellipsoid for point.

Satisfies pure virtual ossimElevSource::getHeightAboveMSL().

Returns
Height above MSL.

Reimplemented from ossimElevSource.

Definition at line 342 of file ossimTiledElevationDatabase.cpp.

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

343 {
344  double h = getHeightAboveMSL(gpt);
345  if(h != ossim::nan())
346  {
347  h += getOffsetFromEllipsoid(gpt);
348  }
349  return h;
350 }
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
virtual double getOffsetFromEllipsoid(const ossimGpt &gpt)
virtual double getHeightAboveMSL(const ossimGpt &gpt)
Get height above MSL for point.

◆ getHeightAboveMSL()

double ossimTiledElevationDatabase::getHeightAboveMSL ( const ossimGpt gpt)
virtual

Get height above MSL for point.

Satisfies pure virtual ossimElevSource::getHeightAboveMSL().

Returns
Height above MSL.

Implements ossimElevSource.

Definition at line 333 of file ossimTiledElevationDatabase.cpp.

References ossimGpt::lat, ossimGpt::lon, m_grid, and ossim::nan().

Referenced by getHeightAboveEllipsoid().

334 {
335  if ( m_grid )
336  {
337  return (*m_grid)(gpt.lon, gpt.lat);
338  }
339  return ossim::nan();
340 }
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
ossim_float64 lon
Definition: ossimGpt.h:266
ossimDblGrid * m_grid
Hold region of elevation.
ossim_float64 lat
Definition: ossimGpt.h:265

◆ initializeReferenceProjection()

void ossimTiledElevationDatabase::initializeReferenceProjection ( )
private

Initializes m_referenceProj from the first entry.

Definition at line 316 of file ossimTiledElevationDatabase.cpp.

References ossimImageHandler::getImageGeometry(), ossimImageGeometry::getProjection(), m_entries, m_referenceProj, and ossimRefPtr< T >::valid().

317 {
318  if ( m_entries.size() )
319  {
320  ossimRefPtr<ossimImageHandler> ih = m_entries[0].m_sic->getImageHandler();
321  if ( ih.valid() )
322  {
324  if ( geom.valid() )
325  {
326  m_referenceProj = geom->getProjection();
327  }
328  // else throw exception ??? (drb)
329  }
330  }
331 }
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimProjection > m_referenceProj
Projection of the first entry.
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if non defined...
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
std::vector< ossimTiledElevationEntry > m_entries

◆ isCompatible()

bool ossimTiledElevationDatabase::isCompatible ( ossimImageHandler ih,
ossimImageGeometry geom,
ossimProjection proj 
) const
private

Check for match of the following against the first entry of: bands, projection, scalar type and scale.

Returns
true if good, false if not the same.

Definition at line 410 of file ossimTiledElevationDatabase.cpp.

References ossimRefPtr< T >::get(), ossimMapProjection::getDecimalDegreesPerPixel(), ossimProjection::getMetersPerPixel(), ossimMapProjection::getMetersPerPixel(), ossimImageSource::getNumberOfOutputBands(), ossimImageSource::getOutputScalarType(), ossimMapProjection::isGeographic(), m_entries, m_referenceProj, and ossimRefPtr< T >::valid().

413 {
414  //---
415  // Check for match of the following against the first entry:
416  // bands
417  // projection
418  // scalar type
419  // scale
420  //---
421  bool result = false;
422 
423  if ( m_entries.size() && ih && geom && proj )
424  {
425  ossimRefPtr<const ossimImageHandler> entry0_ih = m_entries[0].m_sic->getImageHandler();
426 
427  // Check scalar type and bands.
428  if ( (entry0_ih->getOutputScalarType() == ih->getOutputScalarType()) &&
429  (entry0_ih->getNumberOfOutputBands() == ih->getNumberOfOutputBands()) )
430  {
431  // Check the scale.
433  dynamic_cast<const ossimMapProjection*>(proj);
434  if ( mapProj.valid() )
435  {
437  dynamic_cast<const ossimMapProjection*>(m_referenceProj.get());
438 
439  if ( mapProj->isGeographic() )
440  {
441  if ( refMapProj->getDecimalDegreesPerPixel() ==
442  mapProj->getDecimalDegreesPerPixel() )
443  {
444  result = true;
445  }
446  else if ( refMapProj->getMetersPerPixel() ==
447  mapProj->getMetersPerPixel() )
448  {
449  result = true;
450  }
451  }
452  }
453  else // sensor model
454  {
456  {
457  result = true;
458  }
459  }
460  }
461  }
462 
463  return result;
464 }
virtual const ossimDpt & getDecimalDegreesPerPixel() const
Returns decimal degrees per pixel as an ossimDpt with "x" representing longitude and "y" representing...
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimProjection > m_referenceProj
Projection of the first entry.
virtual bool isGeographic() const
virtual ossimDpt getMetersPerPixel() const =0
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
virtual ossimDpt getMetersPerPixel() const
std::vector< ossimTiledElevationEntry > m_entries

◆ isDirectoryBasedImage()

bool ossimTiledElevationDatabase::isDirectoryBasedImage ( ossimRefPtr< ossimImageHandler ih)
private
Returns
true if file is a directory based image and the stager should go on to next directory; false if stager should continue with directory.

Definition at line 394 of file ossimTiledElevationDatabase.cpp.

References ossimObject::getClassName(), and ossimRefPtr< T >::valid().

395 {
396  bool result = false;
397  if ( ih.valid() )
398  {
399  // Get the image handler name.
400  ossimString imageHandlerName = ih->getClassName();
401  if ( (imageHandlerName == "ossimAdrgTileSource") ||
402  (imageHandlerName == "ossimCibCadrgTileSource") )
403  {
404  result = true;
405  }
406  }
407  return result;
408 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimString getClassName() const
Definition: ossimObject.cpp:64

◆ loadState()

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

Initialize from keyword list.

Reimplemented from ossimElevationDatabase.

Definition at line 361 of file ossimTiledElevationDatabase.cpp.

362 {
363  static const char M[] = "ossimTiledElevationDatabase::loadState";
364  if(traceDebug())
365  {
367  << M << " entered..." << "\nkwl:\n" << kwl << "\n";
368  }
369  bool result = false;
370  const char* lookup = kwl.find(prefix, "type");
371  if ( lookup )
372  {
373  std::string type = lookup;
374  if ( ( type == "image_directory" ) || ( type == "ossimTiledElevationDatabase" ) )
375  {
376  result = ossimElevationDatabase::loadState(kwl, prefix);
377  }
378  }
379 
380  if(traceDebug())
381  {
382  ossimNotify(ossimNotifyLevel_DEBUG) << M << " result=" << (result?"true\n":"false\n");
383  }
384 
385  return result;
386 }
const char * find(const char *key) const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ mapRegion() [1/2]

void ossimTiledElevationDatabase::mapRegion ( const ossimGrect region)

Maps elevation data for region to a grid.

This uses connectionString passed to open method as starting point.

Definition at line 123 of file ossimTiledElevationDatabase.cpp.

124 {
125  static const char M[] = "ossimTiledElevationDatabase::mapRegion";
126  if(traceDebug())
127  {
129  << M << " entered...\n" << "region: " << region << "\n";
130  }
131 
132  if ( m_connectionString.size() )
133  {
134  // Wrap in try catch block as excptions can be thrown under the hood.
135  try
136  {
137  m_requestedRect = region;
138 
140  if ( f.exists() )
141  {
142  if ( !m_fileWalker )
143  {
146 
148 
149  // Must set this so we can stop recursion on directory based images.
151 
152  // This links the file walker back to our "processFile" method.
154  }
155 
156  // Walk the directory:
157  m_fileWalker->walk(f);
158 
159  mapRegion();
160  }
161  else
162  {
164  << M << " ERROR: Connection string does not exists: "
165  << m_connectionString.c_str() << endl;
166  }
167  }
168  catch (const ossimException& e)
169  {
171  << "Caught exception: " << e.what() << endl;
172  m_entries. clear();
173  }
174 
175  // cleanup:
176  if ( m_fileWalker )
177  {
178  delete m_fileWalker;
179  m_fileWalker = 0;
180  }
181 }
182 
183  if(traceDebug())
184  {
185  ossimNotify(ossimNotifyLevel_DEBUG) << M << " exited...\n";
186  }
187 }
void setFileProcessor(ossimFileProcessorInterface *fpi)
Sets ossimFileProcessorInterfacecallback method to process files.
Utility class to walk through directories and get a list of files to process.
OSSIM_DLL ossim_uint32 getNumberOfThreads()
Get the number threads to use from ossimPreferences or ossim::Thread.
bool exists() const
virtual const char * what() const
Returns the error message.
std::string::size_type size() const
Definition: ossimString.h:405
void setNumberOfThreads(ossim_uint32 nThreads)
Sets the max number of threads(jobs) to run at one time.
void mapRegion()
Loads m_requestedRect into m_grid from m_entries.
void initializeDefaultFilterList()
Initializes the filter list with a default set of filtered out file names.
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
void setWaitOnDirFlag(bool flag)
Sets waitOnDir flag.
std::vector< ossimTiledElevationEntry > m_entries
void walk(const std::vector< ossimFilename > &files)
Takes an array of files.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ mapRegion() [2/2]

void ossimTiledElevationDatabase::mapRegion ( )
private

Loads m_requestedRect into m_grid from m_entries.

Definition at line 491 of file ossimTiledElevationDatabase.cpp.

References ossimConnectableObject::connectMyInputTo(), ossimImageData::getHeight(), ossimOrthoImageMosaic::getImageGeometry(), ossimImageMosaic::getTile(), ossimImageData::getWidth(), ossimDblGrid::initialize(), ossimGrect::isLonLatNan(), ossimGpt::lat, ossimImageGeometry::localToWorld(), ossimGpt::lon, ossimGrect::lr(), m_entries, m_grid, m_requestedRect, ossim::nan(), ossimElevSource::theGroundRect, ossimGrect::ul(), ossimRefPtr< T >::valid(), ossimImageGeometry::worldToLocal(), ossimDpt::x, and ossimDpt::y.

492 {
493  static const char M[] = "ossimTiledElevationDatabase::mapRegion";
494 
495  if ( m_entries.size() && ( m_requestedRect.isLonLatNan() == false ) )
496  {
498  std::vector<ossimTiledElevationEntry>::iterator i = m_entries.begin();
499  while ( i != m_entries.end() )
500  {
501  mosaic->connectMyInputTo( (*i).m_sic.get() );
502  ++i;
503  }
504 
505  // Compute the requested rectangle in view space.
507  if ( geom.valid() )
508  {
509  ossimDpt ulDpt;
510  ossimDpt lrDpt;
511  geom->worldToLocal(m_requestedRect.ul(), ulDpt);
512  geom->worldToLocal(m_requestedRect.lr(), lrDpt);
513 
514  // Expand out to fall on even view coordinates.
515  ulDpt.x = std::floor(ulDpt.x);
516  ulDpt.y = std::floor(ulDpt.y);
517  lrDpt.x = std::ceil(lrDpt.x);
518  lrDpt.y = std::floor(lrDpt.y);
519 
520  // Get new(expanded) corners in ground space.
521  ossimGpt ulGpt;
522  ossimGpt lrGpt;
523  geom->localToWorld(ulDpt, ulGpt);
524  geom->localToWorld(lrDpt, lrGpt);
525  theGroundRect = ossimGrect(ulGpt, lrGpt);
526 
527  // Expanded requested rect in view space.
528  ossimIpt ulIpt = ulDpt;
529  ossimIpt lrIpt = lrDpt;
530  const ossimIrect VIEW_RECT(ulIpt, lrIpt);
531 
532  // Get the data.
533  ossimRefPtr<ossimImageData> data = mosaic->getTile(VIEW_RECT, 0);
534  if ( data.valid() )
535  {
536  // Initialize the grid:
537  const ossimIpt SIZE( data->getWidth(), data->getHeight() );
538  const ossimDpt ORIGIN(ulGpt.lon, lrGpt.lat); // SouthWest corner
539  const ossimDpt SPACING( (lrGpt.lon-ulGpt.lon)/(SIZE.x-1),
540  (ulGpt.lat-lrGpt.lat)/(SIZE.y-1) );
541  if ( !m_grid ) m_grid = new ossimDblGrid();
542  m_grid->initialize(SIZE, ORIGIN, SPACING, ossim::nan());
543 
544  if ( traceDebug() )
545  {
547  << M
548  << "\nrequested view rect: " << VIEW_RECT
549  << "\nexpanded ground rect: " << theGroundRect
550  << "\norigin: " << ORIGIN
551  << "\nsize: " << SIZE
552  << "\nspacing: " << SPACING << std::endl;
553  }
554 
555  // Fill the grid:
556  switch( data->getScalarType() )
557  {
558  case OSSIM_SINT16:
559  {
560  fillGrid(ossim_sint16(0), data);
561  break;
562  }
563  case OSSIM_SINT32:
564  {
565  fillGrid(ossim_sint32(0), data);
566  break;
567  }
568  case OSSIM_FLOAT32:
569  {
570  fillGrid(ossim_float32(0), data);
571  break;
572  }
573  case OSSIM_FLOAT64:
574  {
575  fillGrid(ossim_float64(0), data);
576  break;
577  }
578  case OSSIM_UINT8:
579  case OSSIM_SINT8:
580  case OSSIM_USHORT11:
581  case OSSIM_USHORT12:
582  case OSSIM_USHORT13:
583  case OSSIM_USHORT14:
584  case OSSIM_USHORT15:
585  case OSSIM_UINT16:
586  case OSSIM_UINT32:
590  default:
591  {
592  std::string errMsg = M;
593  errMsg += " ERROR:\nUnhandled scalar type: ";
594  errMsg += data->getScalarTypeAsString().string();
595  throw ossimException(errMsg);
596  }
597  }
598 
599  } // if ( data.valid() )
600 
601  } // if ( geom.valid() )
602 
603  } // if ( m_entries.size() && ...
604 }
16 bit unsigned integer (15 bits used)
8 bit signed integer
virtual ossim_uint32 getWidth() const
64 bit floating point
16 bit unsigned integer
bool valid() const
Definition: ossimRefPtr.h:75
float ossim_float32
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
double y
Definition: ossimDpt.h:165
16 bit signed integer
void initialize(const ossimIpt &size, const ossimDpt &origin, const ossimDpt &spacing, double null_value=OSSIM_DEFAULT_NULL_PIX_DOUBLE)
virtual ossim_uint32 getHeight() const
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &origin, ossim_uint32 resLevel=0)
32 bit floating point
32 bit unsigned integer
void fillGrid(T dummyTemplate, ossimRefPtr< ossimImageData > data)
Templated fill grid method.
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the geometry associated with the full mosaic.
double ossim_float64
ossimGrect theGroundRect
ossim_float64 lon
Definition: ossimGpt.h:266
bool localToWorld(const ossimDpt &local_pt, ossimGpt &world_pt) const
Exposes the 3D projection from image to world coordinates.
signed short ossim_sint16
ossimDblGrid * m_grid
Hold region of elevation.
32 bit signed integer
32 bit normalized floating point
signed int ossim_sint32
virtual ossimString getScalarTypeAsString() const
const ossimGpt & ul() const
Definition: ossimGrect.h:252
virtual ossim_int32 connectMyInputTo(ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
Will try to connect this objects input to the passed in object.
virtual ossimScalarType getScalarType() const
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
double x
Definition: ossimDpt.h:164
bool worldToLocal(const ossimGpt &world_pt, ossimDpt &local_pt) const
Exposes the 3D world-to-local image coordinate reverse projection.
ossim_float64 lat
Definition: ossimGpt.h:265
8 bit unsigned integer
bool isLonLatNan() const
Definition: ossimGrect.h:290
const ossimGpt & lr() const
Definition: ossimGrect.h:269
std::vector< ossimTiledElevationEntry > m_entries
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
const std::string & string() const
Definition: ossimString.h:414
16 bit unsigned integer (12 bits used)

◆ open()

bool ossimTiledElevationDatabase::open ( const ossimString connectionString)
virtual

Open a connection to a database.

Parameters
connectionStringFile or directory to open. In most cases this will point to a directory containing DEMs. Satisfies pure virtual ossimElevationDatabase::open().
Returns
true on success, false on error.

Implements ossimElevationDatabase.

Definition at line 76 of file ossimTiledElevationDatabase.cpp.

Referenced by dup().

77 {
78  static const char M[] = "ossimTiledElevationDatabase::open";
79  if(traceDebug())
80  {
82  << M << " entered...\n"
83  << "\nConnection string: " << connectionString << "\n";
84  }
85 
86  bool result = false;
87 
88  close();
89 
90  if ( connectionString.size() )
91  {
92  m_connectionString = connectionString.c_str();
93  result = true;
94  }
95 
96  if ( m_entries.size() ) result = true;
97 
98  if(traceDebug())
99  {
100  ossimNotify(ossimNotifyLevel_DEBUG) << M << " result=" << (result?"true\n":"false\n");
101  }
102 
103  return result;
104 }
std::string::size_type size() const
Definition: ossimString.h:405
virtual void close()
close method.
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
std::vector< ossimTiledElevationEntry > m_entries
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ pointHasCoverage()

bool ossimTiledElevationDatabase::pointHasCoverage ( const ossimGpt gpt) const
virtual

Satisfies pure virtual ossimElevSource::pointHasCoverage.

Returns
true if database has coverage for point.

Implements ossimElevSource.

Definition at line 352 of file ossimTiledElevationDatabase.cpp.

References ossimGrect::isLonLatNan(), ossimGrect::pointWithin(), and ossimElevSource::theGroundRect.

353 {
354  if ( theGroundRect.isLonLatNan() == false)
355  {
356  return theGroundRect.pointWithin(gpt);
357  }
358  return false;
359 }
bool pointWithin(const ossimGpt &gpt, bool considerHgt=false) const
METHOD: pointWithin(ossimGpt)
Definition: ossimGrect.h:232
ossimGrect theGroundRect
bool isLonLatNan() const
Definition: ossimGrect.h:290

◆ print()

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

Definition at line 651 of file ossimTiledElevationDatabase.cpp.

References saveState().

652 {
653  ossimKeywordlist kwl;
654  saveState(kwl,0);
655  out << "\nossimTiledElevationDatabase @ "<< (ossim_uint64) this << "\n"
656  << kwl <<ends;
657  return out;
658 }
Represents serializable keyword/value map.
unsigned long long ossim_uint64
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Save the state to a keyword list.

◆ processFile()

void ossimTiledElevationDatabase::processFile ( const ossimFilename file)
virtual

ProcessFile method.

Satisfies pure virtual ossimFileProcessorInterface::processFile.

This method is linked to the ossimFileWalker::walk method via a callback mechanism. It is called by the ossimFileWalk (caller). This class (callee) sets recurse and return flags accordingly to control the ossimFileWalker, e.g. don't recurse, stop altogether.

Parameters
fileto process.

Implements ossimFileProcessorInterface.

Definition at line 189 of file ossimTiledElevationDatabase.cpp.

190 {
191  static const char M[] = "ossimTiledElevationDatabase::processFile";
192  if(traceDebug())
193  {
195  << M << " entered...\n" << "file: " << file << "\n";
196  }
197 
199  if ( sic->open(file, false) ) // False for do not open overviews.
200  {
201  if ( isDirectoryBasedImage( sic->getImageHandler() ) )
202  {
203  // Tell the walker not to recurse this directory.
205  }
206 
208  if ( ih.valid() && (m_requestedRect.isLonLatNan() == false) )
209  {
211  if ( geom.valid() == false )
212  {
213  std::string errMsg = M;
214  errMsg += " ERROR:\nNo image geometry for image: ";
215  errMsg += ih->getFilename().string();
216  throw ossimException(errMsg);
217  }
218 
220  if ( proj.valid() == false )
221  {
222  std::string errMsg = M;
223  errMsg += " ERROR:\nNo image projection for image: ";
224  errMsg += ih->getFilename().string();
225  throw ossimException(errMsg);
226  }
227 
228  // Get the bounding rect:
229  ossimGrect boundingRect;
230  getBoundingRect(geom, boundingRect);
231 
232  if ( boundingRect.isLonLatNan() )
233  {
234  std::string errMsg = M;
235  errMsg += " ERROR:\nBounding rect has nans for image: ";
236  errMsg += ih->getFilename().string();
237  throw ossimException(errMsg);
238  }
239 
240  if ( boundingRect.intersects(m_requestedRect) )
241  {
242  bool addEntryToList = false;
243 
244  if ( m_entries.size() == 0 ) // First time through.
245  {
246  addEntryToList = true;
247  m_entryListRect = boundingRect;
248  m_referenceProj = proj;
249  m_meanSpacing = (geom->getMetersPerPixel().x + geom->getMetersPerPixel().y) / 2.0;
250  }
251  else
252  {
253  addEntryToList = isCompatible( ih.get(), geom.get(), proj.get() );
254  if ( addEntryToList )
255  {
256  // Expand the rectangle.
257  m_entryListRect.combine(boundingRect);
258  }
259  }
260 
261  if ( addEntryToList )
262  {
263  // If we're keeping it add a cache to the chain.
264  sic->addCache();
265 
266  //---
267  // Create the entry and give to addEntry which checks for duplicates in case
268  // mapRegion was called consecutively.
269  //---
270  ossimTiledElevationEntry entry(boundingRect, sic);
271  addEntry(entry);
272 
273  // Once the requested rect is filled abort the file walk.
275  {
276  m_fileWalker->setAbortFlag(true);
277  }
278  }
279  }
280  }
281  else
282  {
283  std::string errMsg = M;
284  errMsg += " ERROR:\nNo image geometry for image: ";
285  errMsg += ih->getFilename().string();
286  throw ossimException(errMsg);
287  }
288  }
289 
290  if(traceDebug())
291  {
292  // Since ossimFileWalker is threaded output the file so we know which job exited.
293  ossimNotify(ossimNotifyLevel_DEBUG) << M << "\nfile: " << file << "\nexited...\n";
294  }
295 }
void setRecurseFlag(bool flag)
Sets recurse flag.
ossimRefPtr< const ossimImageHandler > getImageHandler() const
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimProjection > m_referenceProj
Projection of the first entry.
double y
Definition: ossimDpt.h:165
void addEntry(const ossimTiledElevationEntry &entry)
adds entry to the list checking for duplicates.
bool completely_within(const ossimGrect &rect) const
Definition: ossimGrect.cpp:218
Single image chain class.
bool isCompatible(ossimImageHandler *ih, ossimImageGeometry *geom, ossimProjection *proj) const
Check for match of the following against the first entry of: bands, projection, scalar type and scale...
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if non defined...
virtual const ossimFilename & getFilename() const
Returns the filename.
ossimDpt getMetersPerPixel() const
Returns the GSD associated with this image in the active projection.
void getBoundingRect(ossimRefPtr< ossimImageGeometry > geom, ossimGrect &boundingRect) const
Initialize bounding rectangle from image handler.
bool isDirectoryBasedImage(ossimRefPtr< ossimImageHandler > ih)
ossimRefPtr< ossimCacheTileSource > addCache()
Adds a new cache to the current end of the chain.
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
ossimGrect combine(const ossimGrect &rect) const
Definition: ossimGrect.h:213
double x
Definition: ossimDpt.h:164
bool open(const ossimFilename &file, bool openOverview=true)
open method that takes an image file.
bool isLonLatNan() const
Definition: ossimGrect.h:290
bool intersects(const ossimGrect &rect) const
Definition: ossimGrect.cpp:266
std::vector< ossimTiledElevationEntry > m_entries
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
const std::string & string() const
Definition: ossimString.h:414
void setAbortFlag(bool flag)
If set to true this stops files walking (aborts).

◆ saveState()

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

Save the state to a keyword list.

Reimplemented from ossimElevationDatabase.

Definition at line 388 of file ossimTiledElevationDatabase.cpp.

References ossimElevationDatabase::saveState().

Referenced by print().

389 {
390  return ossimElevationDatabase::saveState(kwl, prefix);
391 }
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const

Member Data Documentation

◆ m_entries

std::vector<ossimTiledElevationEntry> ossimTiledElevationDatabase::m_entries
private

◆ m_entryListRect

ossimGrect ossimTiledElevationDatabase::m_entryListRect
private

Definition at line 214 of file ossimTiledElevationDatabase.h.

Referenced by close(), and ossimTiledElevationDatabase().

◆ m_fileWalker

ossimFileWalker* ossimTiledElevationDatabase::m_fileWalker
private

Definition at line 217 of file ossimTiledElevationDatabase.h.

Referenced by ~ossimTiledElevationDatabase().

◆ m_grid

ossimDblGrid* ossimTiledElevationDatabase::m_grid
private

Hold region of elevation.

Definition at line 208 of file ossimTiledElevationDatabase.h.

Referenced by close(), fillGrid(), getHeightAboveMSL(), mapRegion(), and ~ossimTiledElevationDatabase().

◆ m_mappedRect

ossimGrect ossimTiledElevationDatabase::m_mappedRect
private

Definition at line 215 of file ossimTiledElevationDatabase.h.

◆ m_referenceProj

ossimRefPtr<ossimProjection> ossimTiledElevationDatabase::m_referenceProj
private

Projection of the first entry.

Stored for convenience.

Definition at line 211 of file ossimTiledElevationDatabase.h.

Referenced by close(), initializeReferenceProjection(), isCompatible(), and ~ossimTiledElevationDatabase().

◆ m_requestedRect

ossimGrect ossimTiledElevationDatabase::m_requestedRect
private

Definition at line 213 of file ossimTiledElevationDatabase.h.

Referenced by close(), mapRegion(), and ossimTiledElevationDatabase().


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