OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimProjectionFactoryRegistry.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 // License: See top level LICENSE.txt file.
3 //
4 // Author: Garrett Potts
5 //
6 //*************************************************************************
7 // $Id: ossimProjectionFactoryRegistry.cpp 22898 2014-09-29 15:22:32Z okramer $
20 #include <algorithm>
21 #include <vector>
22 
23 #if OSSIM_HAS_HDF5
25 #endif
26 
27 //ossimProjectionFactoryRegistry* ossimProjectionFactoryRegistry::m_instance = 0;
28 
29 
31 {
34 }
35 
37 :
39 {}
40 
42 {}
43 
45 {
46 }
47 
49 {
51 
52  return &inst;
53  // if(!m_instance)
54 // {
55 // m_instance = new ossimProjectionFactoryRegistry();
56 // }
57 
58 // return m_instance;
59 }
60 
63  ossim_uint32 entryIdx)const
64 {
65  ossimProjection* result = 0;
66  ossim_uint32 idx = 0;
67  for(idx = 0; ((idx < m_factoryList.size())&&(!result)); ++idx)
68  {
69  result = m_factoryList[idx]->createProjection(name, entryIdx);
70  }
71 
72  return result;
73 }
74 
76 {
77  ossimProjection* result = 0;
78  ossim_uint32 idx = 0;
79  for(idx = 0; ((idx < m_factoryList.size())&&(!result)); ++idx)
80  {
81  result = m_factoryList[idx]->createProjection(handler);
82  }
83 
84  return result;
85 }
86 
88  const ossimKeywordlist& kwl, const char* prefix)const
89 {
90  ossimProjection* result = 0;//createNativeObjectFromRegistry(kwl, prefix);
91  ossim_uint32 idx = 0;
92  for(idx = 0; ((idx < m_factoryList.size())&&!result);++idx)
93  {
94  result = m_factoryList[idx]->createProjection(kwl, prefix);
95  }
96 
97  if ( (result == 0) && (prefix == 0) )
98  {
99  //---
100  // Check for an embedded prefix like "image0."
101  //
102  // This is a workaround for people who use the "image_info" application
103  // to create a geometry file.
104  //
105  // If the image has an external geometry file and it has a prefix like
106  // "image0." and someone does:
107  //
108  // theInputConnection->getImageGeometry(kwl);
109  // ossimRefPtr<ossimProjection> proj =
110  // ossimProjectionFactoryRegistry::instance()->createProjection(kwl);
111  //
112  // It will fail because the factory doesn't know it has a prefix.
113  //
114  // ESH 01/2009: I've changed the following so that not just the first
115  // line is checked for "image" and ".". If the image_info .geom file
116  // was created with the -m (metadata) option, the first lines of the
117  // file will not have the expected structure.
118  //---
119  bool bFoundImageLine = false;
120  ossimKeywordlist::KeywordMap::const_iterator i = kwl.getMap().begin();
121  while ( (i != kwl.getMap().end()) && (bFoundImageLine == false) )
122  {
123  ossimString s1 = (*i).first;
124  if ( s1.size() )
125  {
126  std::vector<ossimString> v;
127  s1.split(v, ossimString("."));
128  if ( v.size() )
129  {
130  if ( v[0].contains("image") )
131  {
132  bFoundImageLine = true;
133  ossimString s2 = v[0];
134  s2 += ".";
135  idx = 0;
136  for(;((idx < m_factoryList.size())&&!result); ++idx)
137  {
138  result = m_factoryList[idx]->createProjection(kwl, s2.c_str());
139  }
140  }
141  }
142  }
143 
144  // Go to the next line of the .geom file
145  ++i;
146  }
147  }
148 
149  return result;
150 }
151 
153 {
161 
162 #if OSSIM_HAS_HDF5
164 #endif
165 
166  // KEEP THIS LAST PLEASE!
167  // This factory constructs map projections from EPSG codes. An infinite loop will occur if this
168  // is placed before the explicit (non-coded) factories, since this factory will invoke the above
169  // factories via this registry after populating a KWL which includes a PCS code. If this factory
170  // sees that request before the others, it will be caught in a loop.
172 }
173 
174 extern "C"
175 {
177  {
179  }
180 
181 }
static ossimTiffProjectionFactory * instance()
static ossimHdf5ProjectionFactory * instance()
static ossimMiscProjectionFactory * instance()
static ossimSensorModelFactory * instance()
Represents serializable keyword/value map.
static ossimMapProjectionFactory * instance()
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.
static ossimObjectFactoryRegistry * instance()
static ossimNgaProjectionFactory * instance()
Implements singleton pattern.
ossimProjection * createProjection(const ossimFilename &filename, ossim_uint32 entryIdx) const
void * ossimProjectionFactoryRegistryGetInstance()
std::string::size_type size() const
Definition: ossimString.h:405
static ossimNitfProjectionFactory * instance()
METHOD: instance()
unsigned int ossim_uint32
void registerFactory(T *factory, bool pushToFrontFlag=false)
Will register a factory to the factory list.
void operator=(const ossimProjectionFactoryRegistry &)
static ossimProjectionFactoryRegistry * instance()
const ossimKeywordlist::KeywordMap & getMap() const
This class defines an abstract Handler which all image handlers(loaders) should derive from...
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
static ossimWktProjectionFactory * instance()
Implements singleton pattern.
static ossimEpsgProjectionFactory * instance()
Implements singleton pattern.