OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimRpfInfo.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // License: LGPL
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Author: Mingjie Su
8 //
9 // Description: Rpf Info object.
10 //
11 //----------------------------------------------------------------------------
12 // $Id: ossimRpfInfo.cpp 1237 2010-08-05 19:50:27Z ming.su $
13 
14 //ossim includes
15 #include <ossim/base/ossimTrace.h>
18 
19 // Static trace for debugging
20 static ossimTrace traceDebug("ossimRpfInfo:debug");
21 static ossimTrace traceDump("ossimRpfInfo:dump"); // This will dump offsets.
22 
24  : ossimInfoBase(),
25  theFile(),
26  m_infoFile()
27 {
28 }
29 
31 {
32 }
33 
35 {
36  theFile = file;
37  if (isOpen())
38  {
39  std::ifstream in((theFile).c_str() );
40 
41  std::string line;
42  int index = 0;
43  while(in.good())
44  {
45  // Read in a line.
46  std::getline(in, line);
47  ossimString tmpStr = ossimString(line);
48  if (index > 0)
49  {
50  if (!tmpStr.empty())
51  {
52  std::vector<ossimString> tmpVector = tmpStr.split("|");
53  if (tmpVector.size() > 0)
54  {
55  m_infoFile = tmpVector[0];
56  break;
57  }
58  }
59  }
60  index++;
61  }
62  in.close();
63 
64  return true;
65  }
66  return false;
67 }
68 
70 {
71  ossimString ext = theFile.ext().downcase();
72 
73  if(ext == "rpf")
74  {
75  return true;
76  }
77  else
78  {
79  return false;
80  }
81 }
82 
84 {
85  std::shared_ptr<ossimInfoBase> info = ossimInfoFactory::instance()->create(m_infoFile);
86  if (info)
87  {
88  info->print(out);
89  }
90 
91  return out;
92 }
virtual std::ostream & print(std::ostream &out) const
Print method.
std::basic_ifstream< char > ifstream
Class for char input file streams.
Definition: ossimIosFwd.h:44
virtual bool open(const ossimFilename &file)
open method.
ossimRpfInfo()
default constructor
void split(std::vector< ossimString > &result, const ossimString &separatorList, bool skipBlankFields=false) const
Splits this string into a vector of strings (fields) using the delimiter list specified.
std::istream & getline(std::istream &is, ossimString &str, char delim)
Definition: ossimString.h:916
ossimFilename theFile
Definition: ossimRpfInfo.h:58
Info Base.
Definition: ossimInfoBase.h:32
virtual ~ossimRpfInfo()
virtual destructor
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
static ossimInfoFactory * instance()
ossimFilename m_infoFile
Definition: ossimRpfInfo.h:59
bool empty() const
Definition: ossimString.h:411
virtual std::shared_ptr< ossimInfoBase > create(const ossimFilename &file) const
create method.
ossimString ext() const
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23