OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimHdf5PluginHandlerFactory.cpp
Go to the documentation of this file.
1 /*****************************************************************************
2 * *
3 * O S S I M *
4 * Open Source, Geospatial Image Processing Project *
5 * License: MIT, see LICENSE at the top-level directory *
6 * *
7 *****************************************************************************/
8 
10 
12 #include <ossim/base/ossimRefPtr.h>
13 #include <ossim/base/ossimString.h>
14 #include <ossim/base/ossimTrace.h>
16 #include "ossimViirsHandler.h"
17 
18 class ossimImageHandler;
19 
21 
23 
24 // To add other sensor types that use HDF5, search for the string "Add other sensors here".
25 
27 {
28  theInstance = 0;
29 }
30 
32 {
33  if(!theInstance)
34  {
36  }
37  return theInstance;
38 }
39 
41  bool openOverview)const
42 {
44  getSupportedExtensions(extensionList);
45 
46  ossimString ext = fileName.ext().downcase();
47  bool ext_handled = false;
48  for (int i=0; (i<extensionList.size()) && !ext_handled ; ++i)
49  {
50  if (ext == extensionList[i])
51  ext_handled = true;
52  }
53  if (!ext_handled)
54  return NULL;
55 
56  // Now try each of the represented concrete types in this plugin:
58  while (1)
59  {
60  // VIIRS:
61  reader = new ossimViirsHandler;
63  if(reader->open(fileName))
64  break;
65 
66  // Add other sensors here:
67 
68  reader = 0;
69  break;
70  }
71 
72  return reader.release();
73 }
74 
76  const char* prefix) const
77 {
79  while (1)
80  {
81  // VIIRS:
82  reader = new ossimViirsHandler;
83  if(reader->loadState(kwl, prefix))
84  break;
85 
86  // Add other sensors here:
87  reader = 0;
88  break;
89  }
90  return reader.release();
91 }
92 
94 {
95  ossimRefPtr<ossimObject> result = 0;
96  if(typeName == "ossimViirsHandler")
97  result = new ossimViirsHandler;
98 
99  // Add other sensors here:
100 
101  return result.release();
102 }
103 
105  const ossimKeywordlist& kwl,
106  const char* prefix)const
107 {
108  return this->open(kwl, prefix);
109 }
110 
112  std::vector<ossimString>& typeList)const
113 {
114  typeList.push_back(ossimString("ossimViirsHandler"));
115  // Add other sensors here:
116 }
117 
120 {
121  extensionList.push_back(ossimString("h5"));
122  extensionList.push_back(ossimString("he5"));
123  extensionList.push_back(ossimString("hdf5"));
124 }
125 
126 void ossimHdf5PluginHandlerFactory::getSupportedRenderableNames(std::vector<ossimString>& names) const
127 {
128  names.clear();
129 
130  // Fetch all sensors represented by this plugin. Start with VIIRS:
131  ossimViirsHandler viirs;
132  const vector<ossimString>& viirsRenderables = viirs.getRenderableSetNames();
133  names.insert(names.end(), viirsRenderables.begin(), viirsRenderables.end());
134 
135  // Add other sensors here:
136 }
137 
139 
141 
143 
virtual bool open()=0
Pure virtual open.
static ossimHdf5PluginHandlerFactory * instance()
static method to return instance (the only one) of this class.
void setOpenOverviewFlag(bool flag)
Sets theOpenOverviewFlag.
Represents serializable keyword/value map.
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.
static ossimHdf5PluginHandlerFactory * theInstance
static instance of this class
virtual bool openOverview()
Searches for an overview.
ossimHdf5PluginHandlerFactory()
hidden from use default constructor
virtual void getSupportedRenderableNames(std::vector< ossimString > &names) const
HDF5 defines different datasets depending on the sensor/format.
virtual void getSupportedExtensions(ossimImageHandlerFactoryBase::UniqueStringList &list) const
Method to add supported extension to the list, like "hdf".
const std::vector< ossimString > & getRenderableSetNames()
T * release()
Definition: ossimRefPtr.h:93
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
virtual void getTypeNameList(std::vector< ossimString > &typeList) const
Adds ossimH5Reader to the typeList.
void operator=(const ossimHdf5PluginHandlerFactory &)
hidden from use copy constructor
This class defines an abstract Handler which all image handlers(loaders) should derive from...
virtual ossimObject * createObject(const ossimString &typeName) const
createObject that takes a class name (ossimH5Reader)
RTTI_DEF1(ossimHdf5PluginHandlerFactory, "ossimHdf5HandlerFactory", ossimImageHandlerFactoryBase)
Factory for Hdf image reader.
virtual ~ossimHdf5PluginHandlerFactory()
virtual destructor
ossimString ext() const
Concrete class for reading VIIRS data from HDF5 file.
virtual ossimImageHandler * open(const ossimFilename &fileName, bool openOverview=true) const
open that takes a file name.