OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimKmlSuperOverlayReaderFactory.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // License: See top level LICENSE.txt file
4 //
5 // Author: Mingjie Su, Harsh Govind
6 //
7 // Description: Factory for ossim KmlSuperOverlay reader using libkml library.
8 //----------------------------------------------------------------------------
9 // $Id: ossimKmlSuperOverlayReaderFactory.cpp 2472 2011-04-26 15:47:50Z ming.su $
10 
11 
14 
16 #include <ossim/base/ossimRefPtr.h>
17 #include <ossim/base/ossimString.h>
18 #include <ossim/base/ossimTrace.h>
20 
21 static const ossimTrace traceDebug("ossimKmlSuperOverlayReaderFactory:debug");
22 
23 class ossimImageHandler;
24 
26  "ossimKmlSuperOverlayReaderFactory",
28 
30 
32 {
33  theInstance = 0;
34 }
35 
37 {
38  if(!theInstance)
39  {
41  }
42  return theInstance;
43 }
44 
46  bool /* openOverview */ )const
47 {
48  if(traceDebug())
49  {
51  << "ossimKmlSuperOverlayReaderFactory::open(filename) DEBUG: entered..."
52  << "\ntrying ossimKakaduNitfReader"
53  << std::endl;
54  }
55 
57 
58  if ( hasExcludedExtension(fileName) == false )
59  {
60  reader = new ossimKmlSuperOverlayReader;
61  if(reader->open(fileName) == false)
62  {
63  reader = 0;
64  }
65  }
66 
67  if(traceDebug())
68  {
70  << "ossimKmlSuperOverlayReaderFactory::open(filename) DEBUG: leaving..."
71  << std::endl;
72  }
73 
74  return reader.release();
75 }
76 
78  const char* prefix)const
79 {
80  if(traceDebug())
81  {
83  << "ossimKmlSuperOverlayReaderFactory::open(kwl, prefix) DEBUG: entered..."
84  << "Trying ossimKakaduNitfReader"
85  << std::endl;
86  }
87 
89  if(reader->loadState(kwl, prefix) == false)
90  {
91  reader = 0;
92  }
93 
94  if(traceDebug())
95  {
97  << "ossimKmlSuperOverlayReaderFactory::open(kwl, prefix) DEBUG: leaving..."
98  << std::endl;
99  }
100 
101  return reader.release();
102 }
103 
105  const ossimString& typeName)const
106 {
107  ossimRefPtr<ossimObject> result = 0;
108  if(typeName == "ossimKmlSuperOverlayReader")
109  {
110  result = new ossimKmlSuperOverlayReader;
111  }
112 
113  return result.release();
114 }
115 
117  const ossimKeywordlist& kwl,
118  const char* prefix)const
119 {
120  return this->open(kwl, prefix);
121 }
122 
124  std::vector<ossimString>& typeList)const
125 {
126  typeList.push_back(ossimString("ossimKmlSuperOverlayReader"));
127 }
128 
131 {
132  extensionList.push_back(ossimString("kml"));
133  extensionList.push_back(ossimString("kmz"));
134 }
135 
137  const ossimFilename& file) const
138 {
139  bool result = true;
140  ossimString ext = file.ext().downcase();
141  if (ext == "kml" || ext == "kmz") //only include the file with .kml or .kmz extension and exclude any other files
142  {
143  result = false;
144  }
145  return result;
146 }
147 
149 
151 
virtual bool open()=0
Pure virtual open.
RTTI_DEF1(ossimKmlSuperOverlayReaderFactory, "ossimKmlSuperOverlayReaderFactory", ossimImageHandlerFactoryBase)
ossimKmlSuperOverlayReaderFactory()
hidden from use default constructor
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 ~ossimKmlSuperOverlayReaderFactory()
virtual destructor
void operator=(const ossimKmlSuperOverlayReaderFactory &)
hidden from use copy constructor
virtual void getTypeNameList(std::vector< ossimString > &typeList) const
Adds ossimKmlSuperOverlayReader to the typeList.
T * release()
Definition: ossimRefPtr.h:93
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
virtual ossimImageHandler * open(const ossimFilename &fileName, bool openOverview=true) const
open that takes a file name.
static ossimKmlSuperOverlayReaderFactory * instance()
static method to return instance (the only one) of this class.
This class defines an abstract Handler which all image handlers(loaders) should derive from...
Factory for Kml SuperOverlay reader.
ossimString ext() const
virtual ossimObject * createObject(const ossimString &typeName) const
createObject that takes a class name (ossimKmlSuperOverlayReader)
static ossimKmlSuperOverlayReaderFactory * theInstance
static instance of this class
virtual void getSupportedExtensions(ossimImageHandlerFactoryBase::UniqueStringList &extensionList) const
Method to add supported extension to the list, like "kml" or "kmz".
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)