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

CLASS: ossimDtedFactory. More...

#include <ossimDtedFactory.h>

Inheritance diagram for ossimDtedFactory:
ossimElevSourceFactory ossimObject ossimReferenced

Public Member Functions

 ossimDtedFactory ()
 
 ossimDtedFactory (const ossimFilename &dir)
 
virtual ossimElevSourcegetNewElevSource (const ossimGpt &gpt) const
 Pure virtual method. More...
 
virtual void createIndex ()
 
- Public Member Functions inherited from ossimElevSourceFactory
 ossimElevSourceFactory ()
 default constructor More...
 
virtual ~ossimElevSourceFactory ()
 virtual destructor More...
 
virtual ossimFilename getDirectory () const
 
virtual void setDirectory (const ossimFilename &directory)
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getDescription () 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 saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual std::ostream & print (std::ostream &out) const
 Generic print method. More...
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
virtual void accept (ossimVisitor &visitor)
 
- 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
 

Protected Member Functions

virtual ~ossimDtedFactory ()
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Additional Inherited Members

- Protected Attributes inherited from ossimElevSourceFactory
ossimFilename theDirectory
 

Detailed Description

CLASS: ossimDtedFactory.

Definition at line 22 of file ossimDtedFactory.h.

Constructor & Destructor Documentation

◆ ossimDtedFactory() [1/2]

ossimDtedFactory::ossimDtedFactory ( )

Definition at line 32 of file ossimDtedFactory.cpp.

34 {}
ossimElevSourceFactory()
default constructor

◆ ossimDtedFactory() [2/2]

ossimDtedFactory::ossimDtedFactory ( const ossimFilename dir)

Definition at line 36 of file ossimDtedFactory.cpp.

References ossimElevSourceFactory::theDirectory.

38 {
39  theDirectory = dir;
40 }
ossimElevSourceFactory()
default constructor

◆ ~ossimDtedFactory()

ossimDtedFactory::~ossimDtedFactory ( )
protectedvirtual

Definition at line 42 of file ossimDtedFactory.cpp.

43 {}

Member Function Documentation

◆ createIndex()

void ossimDtedFactory::createIndex ( )
virtual

Definition at line 185 of file ossimDtedFactory.cpp.

186 {
187 }

◆ getNewElevSource()

ossimElevSource * ossimDtedFactory::getNewElevSource ( const ossimGpt gpt) const
virtual

Pure virtual method.

return an elevation source pointer that has elevation coverage for the ground point passed in. Note the caller of this method is responsible for managing the memory allocated.

Implements ossimElevSourceFactory.

Definition at line 45 of file ossimDtedFactory.cpp.

46 {
47  if (traceDebug())
48  {
50  << "DEBUG ossimDtedFactory::getNewElevSource: Entered..."
51  << std::endl;
52  }
53 
55 
57  {
59  << "FATAL ossimDtedFactory::getNewElevSource: "
60  << "DTED directory has not been set!"
61  << "\nReturning null elevation source..."
62  << std::endl;
63  return dted_ptr.release();
64  }
65 
66  // Build up a dted file name.
67  ossimFilename dted_file_base;
68 
69  int ilon = static_cast<int>(floor(gpt.lond()));
70 
71  if (ilon < 0)
72  {
73  dted_file_base = "w";
74  }
75  else
76  {
77  dted_file_base = "e";
78  }
79 
80  ilon = abs(ilon);
82  s1 << std::setfill('0') << std::setw(3)<< ilon;
83 
84  dted_file_base += s1.str().c_str();//ossimString::toString(ilon);
85  dted_file_base += "/";
86 
87  int ilat = static_cast<int>(floor(gpt.latd()));
88  if (ilat < 0)
89  {
90  dted_file_base += "s";
91  }
92  else
93  {
94  dted_file_base += "n";
95  }
96 
97  ilat = abs(ilat);
99 
100  s2<< std::setfill('0') << std::setw(2)<< ilat;
101 
102  dted_file_base += s2.str().c_str();
103 
104  // Look for a dted file with a level 2 extension first.
105  ossimFilename dted_name = theDirectory.dirCat(dted_file_base);
106  dted_name += ".dt2";
107 
108  if (traceDebug())
109  {
111  << "DEBUG ossimDtedFactory::getNewElevSource:"
112  << "\nSearching for file: " << dted_name
113  << std::endl;
114  }
115 
116  if (dted_name.exists())
117  {
118  dted_ptr = new ossimDtedHandler(dted_name);
119  if ( (!(dted_ptr->getErrorStatus())) &&
120  dted_ptr->pointHasCoverage(gpt) )
121  {
122  return dted_ptr.release();
123  }
124  else
125  {
126  dted_ptr = 0;
127  }
128  }
129 
130  // Look for a dted file with a level 1 extension next.
131  dted_name = theDirectory.dirCat(dted_file_base);
132  dted_name += ".dt1";
133 
134  if (traceDebug())
135  {
137  << "DEBUG ossimDtedFactory::getNewElevSource:"
138  << "\nSearching for file: " << dted_name
139  << std::endl;
140  }
141 
142  if (dted_name.exists() )
143  {
144  dted_ptr = new ossimDtedHandler(dted_name);
145  if ( (!(dted_ptr->getErrorStatus())) &&
146  dted_ptr->pointHasCoverage(gpt) )
147  {
148  return dted_ptr.release();
149  }
150  else
151  {
152  dted_ptr = 0;
153  }
154  }
155 
156  // Look for a dted file with a level 0 extension next.
157  dted_name = theDirectory.dirCat(dted_file_base);
158  dted_name += ".dt0";
159 
160  if (traceDebug())
161  {
163  << "DEBUG ossimDtedFactory::getNewElevSource:"
164  << "\nSearching for file: " << dted_name
165  << std::endl;
166  }
167 
168  if (dted_name.exists() )
169  {
170  dted_ptr = new ossimDtedHandler(dted_name);
171  if ( (!(dted_ptr->getErrorStatus())) &&
172  dted_ptr->pointHasCoverage(gpt) )
173  {
174  return dted_ptr.release();
175  }
176  else
177  {
178  dted_ptr = 0;
179  }
180  }
181 
182  return dted_ptr.release();
183 }
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
static const ossimFilename NIL
This was taken from Wx widgets for performing touch and access date stamps.
Definition: ossimFilename.h:40
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
#define abs(a)
Definition: auxiliary.h:74
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
bool exists() const
T * release()
Definition: ossimRefPtr.h:93
virtual bool pointHasCoverage(const ossimGpt &) const =0
METHOD: pointHasCoverage(gpt) Returns TRUE if coverage exists over gpt:
the DTED handler is an elevation source that allows for handling of a single cell of data...
virtual ossimErrorCode getErrorStatus() const
ossimFilename dirCat(const ossimFilename &file) const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

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