OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
ossimProjectionFactoryRegistry Class Reference

#include <ossimProjectionFactoryRegistry.h>

Inheritance diagram for ossimProjectionFactoryRegistry:
ossimObjectFactory ossimFactoryListInterface< ossimProjectionFactoryBase, ossimProjection > ossimObject ossimReferenced

Public Member Functions

virtual ~ossimProjectionFactoryRegistry ()
 
ossimProjectioncreateProjection (const ossimFilename &filename, ossim_uint32 entryIdx) const
 
ossimProjectioncreateProjection (const ossimString &name) const
 
ossimProjectioncreateProjection (const ossimKeywordlist &kwl, const char *prefix=NULL) const
 
virtual ossimProjectioncreateProjection (ossimImageHandler *handler) const
 
virtual ossimObjectcreateObject (const ossimString &typeName) const
 
virtual ossimObjectcreateObject (const ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual void getTypeNameList (std::vector< ossimString > &typeList) const
 This should return the type name of all objects in all factories. More...
 
- Public Member Functions inherited from ossimObjectFactory
virtual ~ossimObjectFactory ()
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getDescription () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual std::ostream & print (std::ostream &out) const
 Generic print method. More...
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
virtual void accept (ossimVisitor &visitor)
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimFactoryListInterface< ossimProjectionFactoryBase, ossimProjection >
 ossimFactoryListInterface ()
 
void addFactory (ossimProjectionFactoryBase *factory)
 This is for backward compatability and calls registerFactory for simple adds. More...
 
bool isFactoryRegistered (ossimProjectionFactoryBase *factory) const
 Public access method to determine if a factory is already registered to this list. More...
 
void registerFactory (ossimProjectionFactoryBase *factory, bool pushToFrontFlag=false)
 Will register a factory to the factory list. More...
 
void unregisterFactory (ossimProjectionFactoryBase *factory)
 Will remove the factory from the registry. More...
 
void unregisterFactory (const ossimString &factoryTypeName)
 Will remove the factory from the registry by name. More...
 
void unregisterAllFactories ()
 Will remove all factories from the registry. More...
 
void registerFactoryToFront (ossimProjectionFactoryBase *factory)
 Inserts the factory to the front of the list. More...
 
void registerFactoryBefore (ossimProjectionFactoryBase *factory, ossimProjectionFactoryBase *beforeThisFactory)
 Will insert the factory before the beforeThisFactory. More...
 
void getAllTypeNamesFromRegistry (std::vector< ossimString > &typeList) const
 Will add all object types the factories can allocate. More...
 
ossimObjectcreateObjectFromRegistry (const ossimString &typeName) const
 This is the base object return for all objects in the system. More...
 
ossimObjectcreateObjectFromRegistry (const ossimKeywordlist &kwl, const char *prefix=0) const
 This is the base object return for all objects in the system. More...
 
ossimProjectioncreateNativeObjectFromRegistry (const ossimString &typeName) const
 This is a helper method that calls the createObject and makes sure that the returned object is of the NativeType base type this registry supports. More...
 
ossimProjectioncreateNativeObjectFromRegistry (const ossimKeywordlist &kwl, const char *prefix=0) const
 This is a helper method that calls the createObject and makes sure that the returned object is of the NativeType base type this registry supports. More...
 

Static Public Member Functions

static ossimProjectionFactoryRegistryinstance ()
 

Protected Member Functions

 ossimProjectionFactoryRegistry ()
 
 ossimProjectionFactoryRegistry (const ossimProjectionFactoryRegistry &rhs)
 
void operator= (const ossimProjectionFactoryRegistry &)
 
void initializeDefaults ()
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimFactoryListInterface< ossimProjectionFactoryBase, ossimProjection >
bool findFactory (ossimProjectionFactoryBase *factory) const
 Utility to find a factory in the list. More...
 

Additional Inherited Members

- Public Types inherited from ossimFactoryListInterface< ossimProjectionFactoryBase, ossimProjection >
typedef std::vector< ossimProjectionFactoryBase *> FactoryListType
 
typedef ossimProjectionFactoryBase FactoryType
 
typedef ossimProjection NativeReturnType
 
- Protected Attributes inherited from ossimFactoryListInterface< ossimProjectionFactoryBase, ossimProjection >
std::mutex m_factoryListMutex
 
FactoryListType m_factoryList
 

Detailed Description

Definition at line 20 of file ossimProjectionFactoryRegistry.h.

Constructor & Destructor Documentation

◆ ~ossimProjectionFactoryRegistry()

ossimProjectionFactoryRegistry::~ossimProjectionFactoryRegistry ( )
virtual

Definition at line 44 of file ossimProjectionFactoryRegistry.cpp.

45 {
46 }

◆ ossimProjectionFactoryRegistry() [1/2]

ossimProjectionFactoryRegistry::ossimProjectionFactoryRegistry ( )
protected

Definition at line 30 of file ossimProjectionFactoryRegistry.cpp.

References initializeDefaults(), ossimObjectFactoryRegistry::instance(), and ossimFactoryListInterface< T, NativeType >::registerFactory().

31 {
34 }
static ossimObjectFactoryRegistry * instance()
void registerFactory(T *factory, bool pushToFrontFlag=false)
Will register a factory to the factory list.

◆ ossimProjectionFactoryRegistry() [2/2]

ossimProjectionFactoryRegistry::ossimProjectionFactoryRegistry ( const ossimProjectionFactoryRegistry rhs)
protected

Definition at line 36 of file ossimProjectionFactoryRegistry.cpp.

Member Function Documentation

◆ createObject() [1/2]

virtual ossimObject* ossimProjectionFactoryRegistry::createObject ( const ossimString typeName) const
inlinevirtual

Creates an object given a type name.

Implements ossimObjectFactory.

Definition at line 44 of file ossimProjectionFactoryRegistry.h.

References ossimFactoryListInterface< T, NativeType >::createObjectFromRegistry().

45  {
46  return createObjectFromRegistry(typeName);
47  }
ossimObject * createObjectFromRegistry(const ossimString &typeName) const
This is the base object return for all objects in the system.

◆ createObject() [2/2]

virtual ossimObject* ossimProjectionFactoryRegistry::createObject ( const ossimKeywordlist kwl,
const char *  prefix = 0 
) const
inlinevirtual

Creates and object given a keyword list.

Implements ossimObjectFactory.

Definition at line 52 of file ossimProjectionFactoryRegistry.h.

References ossimFactoryListInterface< T, NativeType >::createObjectFromRegistry().

54  {
55  return createObjectFromRegistry(kwl, prefix);
56  }
ossimObject * createObjectFromRegistry(const ossimString &typeName) const
This is the base object return for all objects in the system.

◆ createProjection() [1/4]

ossimProjection * ossimProjectionFactoryRegistry::createProjection ( const ossimFilename filename,
ossim_uint32  entryIdx 
) const

◆ createProjection() [2/4]

ossimProjection* ossimProjectionFactoryRegistry::createProjection ( const ossimString name) const
inline

Definition at line 33 of file ossimProjectionFactoryRegistry.h.

References ossimFactoryListInterface< T, NativeType >::createNativeObjectFromRegistry().

34  {
35  return createNativeObjectFromRegistry(name);
36  }
ossimProjection * createNativeObjectFromRegistry(const ossimString &typeName) const
This is a helper method that calls the createObject and makes sure that the returned object is of the...

◆ createProjection() [3/4]

ossimProjection * ossimProjectionFactoryRegistry::createProjection ( const ossimKeywordlist kwl,
const char *  prefix = NULL 
) const

Definition at line 87 of file ossimProjectionFactoryRegistry.cpp.

References ossimString::c_str(), ossimKeywordlist::getMap(), ossimFactoryListInterface< ossimProjectionFactoryBase, ossimProjection >::m_factoryList, ossimString::size(), and ossimString::split().

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 }
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::string::size_type size() const
Definition: ossimString.h:405
unsigned int ossim_uint32
const ossimKeywordlist::KeywordMap & getMap() const
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

◆ createProjection() [4/4]

ossimProjection * ossimProjectionFactoryRegistry::createProjection ( ossimImageHandler handler) const
virtual

Definition at line 75 of file ossimProjectionFactoryRegistry.cpp.

References ossimFactoryListInterface< ossimProjectionFactoryBase, ossimProjection >::m_factoryList.

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 }
unsigned int ossim_uint32

◆ getTypeNameList()

virtual void ossimProjectionFactoryRegistry::getTypeNameList ( std::vector< ossimString > &  typeList) const
inlinevirtual

This should return the type name of all objects in all factories.

This is the name used to construct the objects dynamially and this name must be unique.

Implements ossimObjectFactory.

Definition at line 63 of file ossimProjectionFactoryRegistry.h.

References ossimFactoryListInterface< T, NativeType >::getAllTypeNamesFromRegistry().

64  {
66  }
void getAllTypeNamesFromRegistry(std::vector< ossimString > &typeList) const
Will add all object types the factories can allocate.

◆ initializeDefaults()

void ossimProjectionFactoryRegistry::initializeDefaults ( )
protected

Definition at line 152 of file ossimProjectionFactoryRegistry.cpp.

References ossimHdf5ProjectionFactory::instance(), ossimNgaProjectionFactory::instance(), ossimSensorModelFactory::instance(), ossimMiscProjectionFactory::instance(), ossimTiffProjectionFactory::instance(), ossimMapProjectionFactory::instance(), ossimWktProjectionFactory::instance(), ossimEpsgProjectionFactory::instance(), ossimNitfProjectionFactory::instance(), and ossimFactoryListInterface< ossimProjectionFactoryBase, ossimProjection >::registerFactory().

Referenced by ossimProjectionFactoryRegistry().

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 }
static ossimTiffProjectionFactory * instance()
static ossimHdf5ProjectionFactory * instance()
static ossimMiscProjectionFactory * instance()
static ossimSensorModelFactory * instance()
static ossimMapProjectionFactory * instance()
static ossimNgaProjectionFactory * instance()
Implements singleton pattern.
static ossimNitfProjectionFactory * instance()
METHOD: instance()
void registerFactory(ossimProjectionFactoryBase *factory, bool pushToFrontFlag=false)
Will register a factory to the factory list.
static ossimWktProjectionFactory * instance()
Implements singleton pattern.
static ossimEpsgProjectionFactory * instance()
Implements singleton pattern.

◆ instance()

ossimProjectionFactoryRegistry * ossimProjectionFactoryRegistry::instance ( )
static

Definition at line 48 of file ossimProjectionFactoryRegistry.cpp.

Referenced by ossimKakaduJpipImageGeometryFactory::createGeometry(), ossimIgenGenerator::createProductProjection(), ossimJpipProjectionFactory::createProjection(), ossimTiffProjectionFactory::createProjection(), ossimKakaduJpipImageGeometryFactory::createProjection(), ossimMapProjectionFactory::createProjection(), ossimImageGeometryFactory::createProjection(), ossim::Image::getAvailableModels(), ossimMG4LidarReader::getGeoProjection(), ossimMrSidReader::getGeoProjection(), ossimQbTileFilesHandler::getImageGeometry(), ossimplugins::ossimTerraSarTiffReader::getInternalImageGeometry(), ossimChipperUtil::getNewProjectionFromSrsCode(), ossimAuxXmlSupportData::getProjection(), ossimInit::initializeDefaultFactories(), ossim::Image::loadJSON(), ossimMapViewController::loadState(), ossimH5GridModel::loadState(), ossimImageGeometry::loadState(), main(), ossimAffineProjection::ossimAffineProjection(), ossimProjectionFactoryRegistryGetInstance(), ossimplugins::ossimSharedLibraryFinalize(), ossimSharedLibraryFinalize(), ossimplugins::ossimSharedLibraryInitialize(), ossimSharedLibraryInitialize(), ossimWarpProjection::ossimWarpProjection(), ossimInfo::printProjections(), ossimMapViewController::setFilename(), ossimRpcProjection::setupOptimizer(), and ossimRpcModel::setupOptimizer().

49 {
51 
52  return &inst;
53  // if(!m_instance)
54 // {
55 // m_instance = new ossimProjectionFactoryRegistry();
56 // }
57 
58 // return m_instance;
59 }

◆ operator=()

void ossimProjectionFactoryRegistry::operator= ( const ossimProjectionFactoryRegistry )
protected

Definition at line 41 of file ossimProjectionFactoryRegistry.cpp.

42 {}

The documentation for this class was generated from the following files: