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

#include <ossimQuickbirdTile.h>

Inheritance diagram for ossimQuickbirdTile:
ossimErrorStatusInterface

Public Types

typedef std::map< std::string, ossimQuickbirdTileInfoTileMap
 

Public Member Functions

 ossimQuickbirdTile ()
 
bool open (const ossimFilename tileFile)
 
bool getInfo (ossimQuickbirdTileInfo &result, const ossimFilename &filename) const
 
const std::map< std::string, ossimQuickbirdTileInfo > & getMap () const
 
- 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
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 

Protected Member Functions

void parseTileGroup (std::istream &in, const ossimString &tileName)
 
void parseNameValue (ossimString &name, ossimString &value, const ossimString &line) const
 

Protected Attributes

TileMap theTileMap
 
ossim_int32 theNumberOfTiles
 
ossimString theBandId
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 

Detailed Description

Definition at line 99 of file ossimQuickbirdTile.h.

Member Typedef Documentation

◆ TileMap

typedef std::map<std::string, ossimQuickbirdTileInfo> ossimQuickbirdTile::TileMap

Definition at line 110 of file ossimQuickbirdTile.h.

Constructor & Destructor Documentation

◆ ossimQuickbirdTile()

ossimQuickbirdTile::ossimQuickbirdTile ( )

Definition at line 17 of file ossimQuickbirdTile.cpp.

18 {
19 }

Member Function Documentation

◆ getInfo()

bool ossimQuickbirdTile::getInfo ( ossimQuickbirdTileInfo result,
const ossimFilename filename 
) const

Definition at line 366 of file ossimQuickbirdTile.cpp.

References ossimString::string(), and theTileMap.

Referenced by ossimQuickbirdTiffTileSource::getImageGeometry(), and ossimQuickbirdRpcModel::parseTileData().

368 {
369  std::map<std::string,ossimQuickbirdTileInfo>::const_iterator iter =
370  theTileMap.find(filename.string());
371 
372  if(iter != theTileMap.end())
373  {
374  result = (*iter).second;
375  return true;
376  }
377 
378  return false;
379 }
const std::string & string() const
Definition: ossimString.h:414

◆ getMap()

const std::map<std::string, ossimQuickbirdTileInfo>& ossimQuickbirdTile::getMap ( ) const
inline

Definition at line 108 of file ossimQuickbirdTile.h.

References theTileMap.

108 { return theTileMap; }

◆ open()

bool ossimQuickbirdTile::open ( const ossimFilename  tileFile)

Definition at line 21 of file ossimQuickbirdTile.cpp.

Referenced by ossimQuickbirdTiffTileSource::getImageGeometry(), and ossimQuickbirdRpcModel::parseTileData().

22 {
23  if (traceDebug())
24  {
26  << "ossimQuickbirdTile::open entered:"
27  << "\ntileFile: " << tileFile
28  << std::endl;
29  }
30 
31  std::ifstream in(tileFile.c_str(), std::ios::in|std::ios::binary);
32 
33  if(!in)
34  {
35  if (traceDebug())
36  {
38  << "Could not open!"
39  << std::endl;
40  }
41  return false;
42  }
43 
44  char testBuf[512];
45  in.read((char*)testBuf, 50);
46  testBuf[511] = '\0';
47  ossimString testString = testBuf;
48  testString = testString.upcase();
49  if(testString.contains("BEGIN_GROUP")||
50  testString.contains("BANDID"))
51  {
52  in.seekg(0);
53  ossimString line;
54  ossimString name;
55  ossimString value;
56  std::getline(in, line.string());
57 
58  while(!in.eof()&&!in.bad()&&(in.good())&&
60  {
61  parseNameValue(name,
62  value,
63  line);
64 
65  name = name.upcase();
66  name = name.trim();
67  if(name == "BEGIN_GROUP")
68  {
69  parseTileGroup(in, value);
70  }
71  else if(name == "BANDID")
72  {
73  theBandId = value.after("\"").before("\"");
74  }
75  else if(name == "NUMTILES")
76  {
77  theNumberOfTiles = value.before(";").toInt32();
78  }
79  else if(name == "TILESIZE")
80  {
81  if (traceDebug())
82  {
84  << "Key " << name << " not parsed!"
85  << std::endl;
86  }
87  }
88  else if(name == "TILESIZEX")
89  {
90  if (traceDebug())
91  {
93  << "Key " << name << " not parsed!"
94  << std::endl;
95  }
96  }
97  else if(name == "TILESIZEY")
98  {
99  if (traceDebug())
100  {
102  << "Key " << name << " not parsed!"
103  << std::endl;
104  }
105  }
106  else if(name == "TILEOVERLAP")
107  {
108  if (traceDebug())
109  {
111  << "Key " << name << " not parsed!"
112  << std::endl;
113  }
114  }
115  else if(name == "TILEUNITS")
116  {
117  if (traceDebug())
118  {
120  << "Key " << name << " not parsed!"
121  << std::endl;
122  }
123  }
124  else if (name == "END;")
125  {
126  break;
127  }
128  else
129  {
130  if (traceDebug())
131  {
133  << "key " << name << " not parsed! Exiting with error..."
134  << std::endl;
135  }
136  setErrorStatus();
137  }
138  std::getline(in, line.string());
139  }
140  }
141 
142  if (traceDebug())
143  {
145  << "ossimQuickbirdTile::open return value:"
146  << ((theErrorStatus == ossimErrorCodes::OSSIM_OK)?"true":"false")
147  << std::endl;
148  }
149 
151 }
void parseTileGroup(std::istream &in, const ossimString &tileName)
ossimString before(const ossimString &str, std::string::size_type pos=0) const
METHOD: before(str, pos) Returns string beginning at pos and ending one before the token str If strin...
static ossimString upcase(const ossimString &aString)
Definition: ossimString.cpp:34
static const ossimErrorCode OSSIM_OK
std::basic_ifstream< char > ifstream
Class for char input file streams.
Definition: ossimIosFwd.h:44
bool contains(char aChar) const
Definition: ossimString.h:58
ossim_int32 theNumberOfTiles
std::istream & getline(std::istream &is, ossimString &str, char delim)
Definition: ossimString.h:916
void parseNameValue(ossimString &name, ossimString &value, const ossimString &line) const
ossim_int32 toInt32() const
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
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 after(const ossimString &str, std::string::size_type pos=0) const
METHOD: after(str, pos) Returns string immediately after the token str.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
const std::string & string() const
Definition: ossimString.h:414

◆ parseNameValue()

void ossimQuickbirdTile::parseNameValue ( ossimString name,
ossimString value,
const ossimString line 
) const
protected

Definition at line 356 of file ossimQuickbirdTile.cpp.

References ossimString::after(), ossimString::before(), and ossimString::trim().

359 {
360  name = ossimString(line).before("=");
361  name = name.trim();
362  value = ossimString(line).after("=");
363  value = value.trim();
364 }
ossimString before(const ossimString &str, std::string::size_type pos=0) const
METHOD: before(str, pos) Returns string beginning at pos and ending one before the token str If strin...
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
ossimString after(const ossimString &str, std::string::size_type pos=0) const
METHOD: after(str, pos) Returns string immediately after the token str.

◆ parseTileGroup()

void ossimQuickbirdTile::parseTileGroup ( std::istream &  in,
const ossimString tileName 
)
protected

Definition at line 153 of file ossimQuickbirdTile.cpp.

155 {
156  if (traceDebug())
157  {
159  << "ossimQuickbirdTile::parseTileGroup entered:"
160  << std::endl;
161  }
162 
164  ossimString line;
165  ossimString name;
166  ossimString value;
167  info.theTileGroup = tileName;
168  while(!in.eof()&&!in.bad()&&
170  (name != "END_GROUP"))
171  {
172  line = "";
173  std::getline(in, line.string());
174 
175  parseNameValue(name, value, line);
176  name = name.upcase();
177 
178  if(name == "FILENAME")
179  {
180  ossimString filename = value.after("\"").before("\"");
181 
182  info.theFilename = filename.upcase();
183  }
184  else if(name == "COLOFFSET")
185  {
186  info.theUlXOffset = value.before(";").toInt32();
187  }
188  else if(name == "ROWOFFSET")
189  {
190  info.theUlYOffset = value.before(";").toInt32();
191  }
192  else if(name == "ULCOLOFFSET")
193  {
194  info.theUlXOffset = value.before(";").toInt32();
195  }
196  else if(name == "ULROWOFFSET")
197  {
198  info.theUlYOffset = value.before(";").toInt32();
199  }
200  else if(name == "URCOLOFFSET")
201  {
202  info.theUrXOffset = value.before(";").toInt32();
203  }
204  else if(name == "URROWOFFSET")
205  {
206  info.theUrYOffset = value.before(";").toInt32();
207  }
208  else if(name == "LRCOLOFFSET")
209  {
210  info.theLrXOffset = value.before(";").toInt32();
211  }
212  else if(name == "LRROWOFFSET")
213  {
214  info.theLrYOffset = value.before(";").toInt32();
215  }
216  else if(name == "LLCOLOFFSET")
217  {
218  info.theLlXOffset = value.before(";").toInt32();
219  }
220  else if(name == "LLROWOFFSET")
221  {
222  info.theLlYOffset = value.before(";").toInt32();
223  }
224  else if(name == "ULLON")
225  {
226  info.theUlLon = value.before(";").toDouble();
227  }
228  else if(name == "ULLAT")
229  {
230  info.theUlLat = value.before(";").toDouble();
231  }
232  else if(name == "URLON")
233  {
234  info.theUrLon = value.before(";").toDouble();
235  }
236  else if(name == "URLAT")
237  {
238  info.theUrLat = value.before(";").toDouble();
239  }
240  else if(name == "LRLON")
241  {
242  info.theLrLon = value.before(";").toDouble();
243  }
244  else if(name == "LRLAT")
245  {
246  info.theLrLat = value.before(";").toDouble();
247  }
248  else if(name == "LLLON")
249  {
250  info.theLlLon = value.before(";").toDouble();
251  }
252  else if(name == "LLLAT")
253  {
254  info.theLlLat = value.before(";").toDouble();
255  }
256  else if(name == "END_GROUP")
257  {
258  break;
259  }
260  else if (name == "ULX")
261  {
262  if (traceDebug())
263  {
265  << "key " << name << " not parsed!"
266  << std::endl;
267  }
268  }
269  else if (name == "ULY")
270  {
271  if (traceDebug())
272  {
274  << "key " << name << " not parsed!"
275  << std::endl;
276  }
277  }
278  else if (name == "URX")
279  {
280  if (traceDebug())
281  {
283  << "key " << name << " not parsed!"
284  << std::endl;
285  }
286  }
287  else if (name == "URY")
288  {
289  if (traceDebug())
290  {
292  << "key " << name << " not parsed!"
293  << std::endl;
294  }
295  }
296  else if (name == "LRX")
297  {
298  if (traceDebug())
299  {
301  << "key " << name << " not parsed!"
302  << std::endl;
303  }
304  }
305  else if (name == "LRY")
306  {
307  if (traceDebug())
308  {
310  << "key " << name << " not parsed!"
311  << std::endl;
312  }
313  }
314  else if (name == "LLX")
315  {
316  if (traceDebug())
317  {
319  << "key " << name << " not parsed!"
320  << std::endl;
321  }
322  }
323  else if (name == "LLY")
324  {
325  if (traceDebug())
326  {
328  << "key " << name << " not parsed!"
329  << std::endl;
330  }
331  }
332  else if(name == "END;")
333  {
334  break;
335  }
336  else
337  {
338  if (traceDebug())
339  {
341  << "key " << name << " not parsed! Exiting with error..."
342  << std::endl;
343  }
344 
345  setErrorStatus();
346  break;
347  }
348  }
349 
351  {
352  theTileMap.insert(std::make_pair(info.theFilename.string(), info));
353  }
354 }
ossimString before(const ossimString &str, std::string::size_type pos=0) const
METHOD: before(str, pos) Returns string beginning at pos and ending one before the token str If strin...
static ossimString upcase(const ossimString &aString)
Definition: ossimString.cpp:34
static const ossimErrorCode OSSIM_OK
std::istream & getline(std::istream &is, ossimString &str, char delim)
Definition: ossimString.h:916
void parseNameValue(ossimString &name, ossimString &value, const ossimString &line) const
ossim_int32 toInt32() const
double toDouble() const
ossimString after(const ossimString &str, std::string::size_type pos=0) const
METHOD: after(str, pos) Returns string immediately after the token str.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
const std::string & string() const
Definition: ossimString.h:414

Member Data Documentation

◆ theBandId

ossimString ossimQuickbirdTile::theBandId
protected

Definition at line 116 of file ossimQuickbirdTile.h.

◆ theNumberOfTiles

ossim_int32 ossimQuickbirdTile::theNumberOfTiles
protected

Definition at line 115 of file ossimQuickbirdTile.h.

◆ theTileMap

TileMap ossimQuickbirdTile::theTileMap
protected

Definition at line 114 of file ossimQuickbirdTile.h.

Referenced by getInfo(), and getMap().


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