OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimGeoPdfReaderFactory.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // License: See top level LICENSE.txt file
4 //
5 // Author: Mingjie Su
6 //
7 // Description: Factory for OSSIM GeoPdf reader using kakadu library.
8 //----------------------------------------------------------------------------
9 // $Id: ossimGeoPdfReaderFactory.cpp 20935 2012-05-18 14:19:30Z dburken $
10 
13 #include <ossim/base/ossimRefPtr.h>
14 #include <ossim/base/ossimString.h>
15 #include <ossim/base/ossimTrace.h>
17 #include "ossimGeoPdfReader.h"
18 
19 static const ossimTrace traceDebug("ossimGeoPdfReaderFactory:debug");
20 
21 class ossimImageHandler;
22 
24  "ossimGeoPdfReaderFactory",
26 
28 
30 {
31  theInstance = 0;
32 }
33 
35 {
36  if(!theInstance)
37  {
39  }
40  return theInstance;
41 }
42 
44  bool openOverview)const
45 {
46  if(traceDebug())
47  {
49  << "ossimGeoPdfReaderFactory::open(filename) DEBUG: entered..."
50  << "\ntrying ossimKakaduNitfReader"
51  << std::endl;
52  }
53 
55 
56  if ( hasExcludedExtension(fileName) == false )
57  {
58  reader = new ossimGeoPdfReader;
60  if(reader->open(fileName) == false)
61  {
62  reader = 0;
63  }
64  }
65 
66  if(traceDebug())
67  {
69  << "ossimGeoPdfReaderFactory::open(filename) DEBUG: leaving..."
70  << std::endl;
71  }
72 
73  return reader.release();
74 }
75 
77  const char* prefix)const
78 {
79  if(traceDebug())
80  {
82  << "ossimGeoPdfReaderFactory::open(kwl, prefix) DEBUG: entered..."
83  << "Trying ossimKakaduNitfReader"
84  << std::endl;
85  }
86 
88  if(reader->loadState(kwl, prefix) == false)
89  {
90  reader = 0;
91  }
92 
93  if(traceDebug())
94  {
96  << "ossimGeoPdfReaderFactory::open(kwl, prefix) DEBUG: leaving..."
97  << std::endl;
98  }
99 
100  return reader.release();
101 }
102 
104  const ossimString& typeName)const
105 {
106  ossimRefPtr<ossimObject> result = 0;
107  if(typeName == "ossimGeoPdfReader")
108  {
109  result = new ossimGeoPdfReader;
110  }
111 
112  return result.release();
113 }
114 
116  const ossimKeywordlist& kwl,
117  const char* prefix)const
118 {
119  return this->open(kwl, prefix);
120 }
121 
123  std::vector<ossimString>& typeList)const
124 {
125  typeList.push_back(ossimString("ossimGeoPdfReader"));
126 }
127 
130 {
131  extensionList.push_back(ossimString("pdf"));
132 }
133 
135  const ossimFilename& file) const
136 {
137  bool result = true;
138  ossimString ext = file.ext().downcase();
139  if (ext == "pdf") //only include the file with .pdf extension and exclude any other files
140  {
141  result = false;
142  }
143  return result;
144 }
145 
147  const ossimString& ext)const
148 {
149  ossimString testExt = ext.downcase();
150  if(ext == "pdf")
151  {
152  result.push_back(new ossimGeoPdfReader);
153  }
154 }
155 
157  const ossimString& mimeType)const
158 {
159  ossimString testExt = mimeType.downcase();
160  if(testExt == "image/pdf")
161  {
162  result.push_back(new ossimGeoPdfReader);
163  }
164 }
165 
167 
169 
171 
172 
virtual bool open()=0
Pure virtual open.
void setOpenOverviewFlag(bool flag)
Sets theOpenOverviewFlag.
static ossimGeoPdfReaderFactory * theInstance
static instance of this class
Represents serializable keyword/value map.
bool hasExcludedExtension(const ossimFilename &file) const
Method to weed out extensions that this plugin knows it does not support.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
virtual ossimRefPtr< ossimImageHandler > openOverview(const ossimFilename &file) const
Open overview that takes a file name.
virtual ossimImageHandler * open(const ossimFilename &fileName, bool openOverview=true) const
open that takes a file name.
virtual bool openOverview()
Searches for an overview.
void push_back(char c)
Equivalent to insert(end(), c).
Definition: ossimString.h:905
virtual ~ossimGeoPdfReaderFactory()
virtual destructor
static ossimGeoPdfReaderFactory * instance()
static method to return instance (the only one) of this class.
virtual void getSupportedExtensions(ossimImageHandlerFactoryBase::UniqueStringList &extensionList) const
Method to add supported extension to the list, like "pdf".
virtual void getTypeNameList(std::vector< ossimString > &typeList) const
Adds ossimGeoPdfWriter to the typeList.
Factory for GeoPdf image reader.
RTTI_DEF1(ossimGeoPdfReaderFactory, "ossimGeoPdfReaderFactory", ossimImageHandlerFactoryBase)
T * release()
Definition: ossimRefPtr.h:93
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
ossimGeoPdfReaderFactory()
hidden from use default constructor
This class defines an abstract Handler which all image handlers(loaders) should derive from...
void operator=(const ossimGeoPdfReaderFactory &)
hidden from use copy constructor
virtual void getImageHandlersBySuffix(ImageHandlerList &result, const ossimString &ext) const
ossimString ext() const
std::vector< ossimRefPtr< ossimImageHandler > > ImageHandlerList
virtual ossimObject * createObject(const ossimString &typeName) const
createObject that takes a class name (ossimGeoPdfReader)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
virtual void getImageHandlersByMimeType(ImageHandlerList &result, const ossimString &mimeType) const