OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimH5Options.cpp
Go to the documentation of this file.
1 #include <ossimH5Options.h>
3 #include <algorithm>
4 
5 const char* MAX_RECURSION_LEVEL_KW="max_recursion_level";
6 const char* RENDERABLE_DATASETS_KW="renderable_datasets";
7 
9 
11 : m_maxRecursionLevel(8)
12 {
13  m_renderableDatasets.push_back("/All_Data/VIIRS-DNB-SDR_All/Radiance");
14 
15  loadOptions(ossimPreferences::instance()->preferencesKWL(), "hdf5.options.");
16 }
17 
19 {
23  if (m_instance)
24  {
25  return m_instance;
26  }
27 
31  m_instance = new ossimH5Options();
32 
33  return m_instance;
34 }
35 
37 {
38  return m_maxRecursionLevel;
39 }
40 
41 bool ossimH5Options::isDatasetRenderable(const std::string& datasetName)const
42 {
43  return std::binary_search (m_renderableDatasets.begin(),
44  m_renderableDatasets.end(),
45  datasetName);
46 }
47 
49 {
50  return m_renderableDatasets;
51 }
52 
54 {
55  std::vector<ossimString> splitList;
56  result.clear();
57  datasets.split(splitList, ",");
58  ossim_uint32 idx = 0;
59  for(;idx < splitList.size();++idx)
60  {
61  ossimString tempString = splitList[idx].trim();
62  if(!tempString.empty()) result.push_back(tempString);
63  }
64 
65  std::sort(result.begin(), result.end());
66 }
67 
68 bool ossimH5Options::loadOptions(const ossimKeywordlist& kwl, const char* prefix)
69 {
70  bool result = true;
71 
72  const char* maxRecursionLevel = kwl.find(prefix, MAX_RECURSION_LEVEL_KW);
73  if(maxRecursionLevel)
74  {
75  m_maxRecursionLevel = ossimString(maxRecursionLevel).toUInt32();
77  }
78  const char* renderableDatasets = kwl.find(prefix, RENDERABLE_DATASETS_KW);
79  if(renderableDatasets)
80  {
82  }
83 
84  return result;
85 }
ossim_uint32 m_maxRecursionLevel
Represents serializable keyword/value map.
const char * find(const char *key) const
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::vector< std::string > StringListType
Definition: ossimH5Options.h:8
static ossimH5Options * instance()
static void loadRenderableDatasetsFromString(StringListType &result, const ossimString &datasets)
ossim_uint32 toUInt32() const
const char * MAX_RECURSION_LEVEL_KW
void push_back(char c)
Equivalent to insert(end(), c).
Definition: ossimString.h:905
unsigned int ossim_uint32
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
static ossimH5Options * m_instance
static ossimPreferences * instance()
bool loadOptions(const ossimKeywordlist &kwl, const char *prefix)
const char * RENDERABLE_DATASETS_KW
bool empty() const
Definition: ossimString.h:411
bool isDatasetRenderable(const std::string &datasetName) const
StringListType m_renderableDatasets
const StringListType & getRenderableDataset() const
ossim_uint32 getMaxRecursionLevel() const