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

#include <ossimSrtmFilename.h>

Public Member Functions

 ossimSrtmFilename (const ossimFilename &srtmFilename="")
 
bool setFilename (const ossimFilename &srtmFilename)
 
ossimGpt ul () const
 
ossimGpt ur () const
 
ossimGpt lr () const
 
ossimGpt ll () const
 

Protected Attributes

ossimFilename theFilename
 
ossim_float64 theSouthwestLongitude
 
ossim_float64 theSouthwestLatitude
 

Detailed Description

Definition at line 7 of file ossimSrtmFilename.h.

Constructor & Destructor Documentation

◆ ossimSrtmFilename()

ossimSrtmFilename::ossimSrtmFilename ( const ossimFilename srtmFilename = "")

Definition at line 4 of file ossimSrtmFilename.cpp.

References setFilename().

5 {
6  setFilename(srtmFilename);
7 }
bool setFilename(const ossimFilename &srtmFilename)

Member Function Documentation

◆ ll()

ossimGpt ossimSrtmFilename::ll ( ) const

Definition at line 63 of file ossimSrtmFilename.cpp.

References ossim::isnan(), ossimGpt::latd(), ossimGpt::lond(), ossimGpt::makeNan(), theSouthwestLatitude, and theSouthwestLongitude.

64 {
65  ossimGpt result;
66 
69  {
70  result.makeNan();
71  }
72  else
73  {
74  result.latd(theSouthwestLatitude);
76  }
77 
78  return result;
79 }
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
void makeNan()
Definition: ossimGpt.h:130
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
ossim_float64 theSouthwestLongitude
ossim_float64 theSouthwestLatitude
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ lr()

ossimGpt ossimSrtmFilename::lr ( ) const

Definition at line 45 of file ossimSrtmFilename.cpp.

References ossim::isnan(), ossimGpt::latd(), ossimGpt::lond(), ossimGpt::makeNan(), theSouthwestLatitude, and theSouthwestLongitude.

46 {
47  ossimGpt result;
48 
51  {
52  result.makeNan();
53  }
54  else
55  {
56  result.latd(theSouthwestLatitude);
57  result.lond(theSouthwestLongitude+1.0);
58  }
59 
60  return result;
61 }
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
void makeNan()
Definition: ossimGpt.h:130
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
ossim_float64 theSouthwestLongitude
ossim_float64 theSouthwestLatitude
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ setFilename()

bool ossimSrtmFilename::setFilename ( const ossimFilename srtmFilename)

Definition at line 82 of file ossimSrtmFilename.cpp.

References ossimString::begin(), ossimString::c_str(), ossimRegExp::compile(), ossimRegExp::end(), ossimFilename::fileNoExtension(), ossimRegExp::find(), ossim::nan(), ossimString::size(), ossimRegExp::start(), theFilename, theSouthwestLatitude, theSouthwestLongitude, and ossimString::upcase().

Referenced by ossimSrtmFilename().

83 {
84  theFilename = srtmFilename;
87 
88  if(srtmFilename == "") return false;
89 
91  ossimString regularExp1 = "[N|S][0-9][0-9][E|W][0-9][0-9][0-9]";
92  ossimString regularExp2 = "[E|W][0-9][0-9][0-9][N|S][0-9][0-9]";
93  ossimRegExp regEx;
94  bool latLonOrderFlag = true;
95  bool foundFlag = false;
96  f = f.upcase();
97 
98  regEx.compile(regularExp1.c_str());
99  foundFlag = regEx.find(f.c_str());
100  if(!foundFlag)
101  {
102  regEx.compile(regularExp2.c_str());
103  foundFlag = regEx.find(f.c_str());
104  if(foundFlag)
105  {
106  latLonOrderFlag = false;
107  f = ossimFilename(ossimString(f.begin()+regEx.start(),
108  f.begin()+regEx.end()));
109  }
110  }
111  if(foundFlag)
112  {
113  f = ossimFilename(ossimString(f.begin()+regEx.start(),
114  f.begin()+regEx.end()));
115  }
116  if (f.size() != 7)
117  {
118  return false;
119  }
120 // ossimString s;
121  if(latLonOrderFlag)
122  {
123 
124 // s.push_back(f[1]);
125 // s.push_back(f[2]);
127  f.begin()+3).toDouble();//s.toDouble();
128  // Get the latitude.
129  if (f[static_cast<std::string::size_type>(0)] == 'S')
130  {
131  theSouthwestLatitude *= -1;
132  }
133  else if (f[static_cast<std::string::size_type>(0)] != 'N')
134  {
135  return false; // Must be either 's' or 'n'.
136  }
137  // Get the longitude.
138 // s.clear();
139 // s.push_back(f[4]);
140 // s.push_back(f[5]);
141 // s.push_back(f[6]);
143  f.begin()+7).toDouble();//s.toDouble();
144  if (f[static_cast<std::string::size_type>(3)] == 'W')
145  {
146  theSouthwestLongitude *= -1;
147  }
148  else if (f[static_cast<std::string::size_type>(3)] != 'E')
149  {
150  return false; // Must be either 'e' or 'w'.
151  }
152  }
153  else
154  {
155  // Get the longitude.
156 // s.clear();
157 // s.push_back(f[1]);
158 // s.push_back(f[2]);
159 // s.push_back(f[3]);
161  f.begin()+4).toDouble();//s.toDouble();
162  if (f[static_cast<std::string::size_type>(0)] == 'W')
163  {
164  theSouthwestLongitude *= -1;
165  }
166  else if (f[static_cast<std::string::size_type>(0)] != 'E')
167  {
168  return false; // Must be either 'e' or 'w'.
169  }
170 // s.clear();
171 
172 // s.push_back(f[5]);
173 // s.push_back(f[6]);
175  f.begin()+7).toDouble();//s.toDouble();
176  // Get the latitude.
177  if (f[static_cast<std::string::size_type>(4)] == 'S')
178  {
179  theSouthwestLatitude *= -1;
180  }
181  else if (f[static_cast<std::string::size_type>(4)] != 'N')
182  {
183  return false; // Must be either 's' or 'n'.
184  }
185  }
186 
187 // if(latLonOrderFlag)
188 // {
189 // s.push_back(f[1]);
190 // s.push_back(f[2]);
191 // theSouthwestLatitude = s.toDouble();
192 // // Get the latitude.
193 // if (f[0] == 'S')
194 // {
195 // theSouthwestLatitude *= -1;
196 // }
197 // else if (f[0] != 'N')
198 // {
199 // return false; // Must be either 's' or 'n'.
200 // }
201 // // Get the longitude.
202 // s.clear();
203 // s.push_back(f[4]);
204 // s.push_back(f[5]);
205 // s.push_back(f[6]);
206 // theSouthwestLongitude = s.toDouble();
207 // if (f[3] == 'W')
208 // {
209 // theSouthwestLongitude *= -1;
210 // }
211 // else if (f[3] != 'E')
212 // {
213 // return false; // Must be either 'e' or 'w'.
214 // }
215 // }
216 // else
217 // {
218 // // Get the longitude.
219 // s.clear();
220 // s.push_back(f[1]);
221 // s.push_back(f[2]);
222 // s.push_back(f[3]);
223 // theSouthwestLongitude = s.toDouble();
224 // if (f[0] == 'W')
225 // {
226 // theSouthwestLongitude *= -1;
227 // }
228 // else if (f[0] != 'E')
229 // {
230 // return false; // Must be either 'e' or 'w'.
231 // }
232 // s.clear();
233 
234 // s.push_back(f[5]);
235 // s.push_back(f[6]);
236 // theSouthwestLatitude = s.toDouble();
237 // // Get the latitude.
238 // if (f[4] == 'S')
239 // {
240 // theSouthwestLatitude *= -1;
241 // }
242 // else if (f[4] != 'N')
243 // {
244 // return false; // Must be either 's' or 'n'.
245 // }
246 // }
247 
248  return true;
249 }
static ossimString upcase(const ossimString &aString)
Definition: ossimString.cpp:34
ossimFilename theFilename
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
std::string::size_type size() const
Definition: ossimString.h:405
std::string::iterator begin()
Definition: ossimString.h:420
ossim_float64 theSouthwestLongitude
void compile(const char *)
ossim_uint32 start() const
Definition: ossimRegExp.h:209
ossim_uint32 end() const
Definition: ossimRegExp.h:217
ossimFilename fileNoExtension() 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
bool find(const char *)
ossim_float64 theSouthwestLatitude

◆ ul()

ossimGpt ossimSrtmFilename::ul ( ) const

Definition at line 9 of file ossimSrtmFilename.cpp.

References ossim::isnan(), ossimGpt::latd(), ossimGpt::lond(), ossimGpt::makeNan(), theSouthwestLatitude, and theSouthwestLongitude.

10 {
11  ossimGpt result;
12 
15  {
16  result.makeNan();
17  }
18  else
19  {
20  result.latd(theSouthwestLatitude+1.0);
22  }
23 
24  return result;
25 }
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
void makeNan()
Definition: ossimGpt.h:130
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
ossim_float64 theSouthwestLongitude
ossim_float64 theSouthwestLatitude
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ ur()

ossimGpt ossimSrtmFilename::ur ( ) const

Definition at line 27 of file ossimSrtmFilename.cpp.

References ossim::isnan(), ossimGpt::latd(), ossimGpt::lond(), ossimGpt::makeNan(), theSouthwestLatitude, and theSouthwestLongitude.

28 {
29  ossimGpt result;
30 
33  {
34  result.makeNan();
35  }
36  else
37  {
38  result.latd(theSouthwestLatitude+1.0);
39  result.lond(theSouthwestLongitude+1.0);
40  }
41 
42  return result;
43 }
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
void makeNan()
Definition: ossimGpt.h:130
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
ossim_float64 theSouthwestLongitude
ossim_float64 theSouthwestLatitude
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

Member Data Documentation

◆ theFilename

ossimFilename ossimSrtmFilename::theFilename
protected

Definition at line 19 of file ossimSrtmFilename.h.

Referenced by setFilename().

◆ theSouthwestLatitude

ossim_float64 ossimSrtmFilename::theSouthwestLatitude
protected

Definition at line 22 of file ossimSrtmFilename.h.

Referenced by ll(), lr(), setFilename(), ul(), and ur().

◆ theSouthwestLongitude

ossim_float64 ossimSrtmFilename::theSouthwestLongitude
protected

Definition at line 21 of file ossimSrtmFilename.h.

Referenced by ll(), lr(), setFilename(), ul(), and ur().


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