OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimGeneralRasterElevFactory.cpp
Go to the documentation of this file.
4 
5 RTTI_DEF1(ossimGeneralRasterElevFactory, "ossimGeneralRasterElevFactory", ossimElevSourceFactory)
6 
8  :theHandlerReturnedFlag(false)
9 {
10 }
11 
13  :theHandlerReturnedFlag(false)
14 {
15  setDirectory(dir);
16 }
17 
19 {
20 }
21 
23 {
27 
28  if(theDirectory.exists())
29  {
30  if(theDirectory.isDir())
31  {
33 
34  ossimFilename file;
35  ossim_uint32 maxCount = 10; // search at least the first 10 files to see if there are any here
36  ossim_uint32 count = 0;
37  bool foundOne = false;
38  if(dir.getFirst(file))
39  {
40  do
41  {
42  ++count;
43  ossimString ext = file.ext();
44  ext = ext.downcase();
45  if(ext == "ras")
46  {
47  if(handler->open(file))
48  {
49  foundOne = true;
50  addInfo(handler->generalRasterInfo());
51  }
52  }
53  } while(dir.getNext(file) &&
54  (foundOne ||
55  (!foundOne && (count < maxCount))));
56  }
57  }
58  }
59 }
60 
62 {
63  ossimDpt pt(gpt);
64  std::vector<ossimGeneralRasterElevHandler::GeneralRasterInfo>::const_iterator i = theGeneralRasterInfoList.begin();
65  while (i != theGeneralRasterInfoList.end())
66  {
67  if ((*i).theWgs84GroundRect.pointWithin(pt))
68  {
69  return new ossimGeneralRasterElevHandler((*i));
70 
71  }
72  ++i;
73  }
74  return 0;
75 }
76 
78 {
79  theGeneralRasterInfoList.push_back(info);
80 }
81 
83 {
84 }
bool open(const ossimFilename &file, bool memoryMapFlag=false)
Opens a stream to the srtm cell.
void setDirectory(const ossimFilename &directory)
bool getFirst(ossimFilename &filename, int flags=OSSIM_DIR_DEFAULT)
virtual void createIndex()
To satisfy pure virtual.
bool isDir() const
bool getNext(ossimFilename &filename) const
std::vector< ossimGeneralRasterElevHandler::GeneralRasterInfo > theGeneralRasterInfoList
bool exists() const
unsigned int ossim_uint32
virtual void setDirectory(const ossimFilename &directory)
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
virtual ossimElevSource * getNewElevSource(const ossimGpt &gpt) const
Open the appropriate handler that covers given a ground point.
const ossimGeneralRasterElevHandler::GeneralRasterInfo & generalRasterInfo() const
ossimString ext() const
#define RTTI_DEF1(cls, name, b1)
Definition: ossimRtti.h:485
ossimGeneralRasterElevFactory()
Constructor that takes a file name.
void addInfo(const ossimGeneralRasterElevHandler::GeneralRasterInfo &info)