OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimMiscProjectionFactory.cpp
Go to the documentation of this file.
1 //*****************************************************************************
2 // FILE: ossimMiscProjectionFactory.cc
3 //
4 // License: See top level LICENSE.txt file.
5 //
6 // DESCRIPTION:
7 // Contains implementation of class ossimMiscProjectionFactory
8 //
9 // SOFTWARE HISTORY:
10 //>
11 // 15Jun2001 Garrett Potts
12 // Initial coding.
13 //<
14 //*****************************************************************************
15 // $Id: ossimMiscProjectionFactory.cpp 17623 2010-06-25 15:03:42Z gpotts $
16 
21 
22 //***
23 // Note to programmer: To add a new projection, search this file for
24 // "ADD_PROJECTION" to locate places requiring editing. Functional example
25 // below...
26 //
27 // ADD_PROJECTION: Include all map projection headers here:
28 //***
29 
37 
38 //***
39 // ADD_PROJECTION: List names of all map projections produced by this factory:
40 //***
41 
43 
44 //*****************************************************************************
45 // STATIC METHOD: ossimMiscProjectionFactory::instance()
46 //
47 //*****************************************************************************
49 {
50  if(!theInstance)
51  {
53  }
54 
56 }
57 
60  ossim_uint32 entryIdx) const
61 {
62  // Check for external geometry file.
63  return createProjectionFromGeometryFile(filename, entryIdx);
64 }
65 
66 //*****************************************************************************
67 // METHOD: ossimMiscProjectionFactory::createProjection(kwl, prefix)
68 //
69 //*****************************************************************************
72  const char *prefix) const
73 {
74  ossimProjection *result=NULL;
75 
76  const char *lookup = kwl.find(prefix, ossimKeywordNames::TYPE_KW);
77 
78  if(lookup)
79  {
80  result = createProjection(ossimString(lookup).trim());
81  if(result)
82  {
83  result->loadState(kwl, prefix);
84  }
85  }
86  else
87  {
88  // look for the geom_file keyword.
89  //
90  lookup = kwl.find(prefix, "geom_file");
91  if(lookup)
92  {
93  ossimKeywordlist kwl2;
94 
95  kwl2.addFile(lookup);
96 
97  result = createProjection(kwl2, "projection.");
98  // maybe they did not prepend projection. in the pro
99  // file.
100  if(!result)
101  {
102  result = createProjection(kwl2);
103  }
104 
105  }
106  }
107  return result;
108 }
109 
110 //*****************************************************************************
111 // METHOD: ossimMiscProjectionFactory::createProjection(projection_name)
112 //
113 //*****************************************************************************
116 {
117  //***
118  // ADD_PROJECTION: Test for each map projection here:
119  //***
121  {
122  return new ossimSonomaSensor;
123  }
125  {
126  return new ossimAffineProjection;
127  }
129  {
130  return new ossimBilinearProjection;
131  }
133  {
134  return new ossimQuadProjection;
135  }
137  {
138  return new ossimRpcProjection;
139  }
141  {
142  return new ossimWarpProjection;
143  }
145  {
146  return new ossimPolynomProjection;
147  }
148 
149  return NULL;
150 }
151 
152 //*****************************************************************************
153 // METHOD
154 //*****************************************************************************
157 {
158  return createProjection(typeName);
159 }
160 
161 //*****************************************************************************
162 // METHOD
163 //*****************************************************************************
166  const char* prefix)const
167 {
168  return createProjection(kwl, prefix);
169 }
170 
171 //*****************************************************************************
172 // METHOD
173 //*****************************************************************************
174 void ossimMiscProjectionFactory::getTypeNameList(std::vector<ossimString>& typeList)const
175 {
176  typeList.push_back(ossimString(STATIC_TYPE_NAME(ossimSonomaSensor)));
177  typeList.push_back(ossimString(STATIC_TYPE_NAME(ossimAffineProjection)));
179  typeList.push_back(ossimString(STATIC_TYPE_NAME(ossimRpcProjection)));
180  typeList.push_back(ossimString(STATIC_TYPE_NAME(ossimQuadProjection)));
181  typeList.push_back(ossimString(STATIC_TYPE_NAME(ossimWarpProjection)));
183 }
ossimProjection * createProjectionFromGeometryFile(const ossimFilename &imageFile, ossim_uint32 entryIdx) const
This method takes the filename and tries to find an external ".geom" file.
static ossimMiscProjectionFactory * instance()
Represents serializable keyword/value map.
bool addFile(const char *file)
const char * find(const char *key) const
static const char * TYPE_KW
virtual void getTypeNameList(std::vector< ossimString > &typeList) const
#define STATIC_TYPE_NAME(T)
Definition: ossimRtti.h:325
virtual ossimProjection * createProjection(const ossimFilename &filename, ossim_uint32 entryIdx) const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
unsigned int ossim_uint32
class for ground to image polynomial projection: (x,y,z)|->(x,y) polynom order is configurable ...
virtual ossimObject * createObject(const ossimString &typeName) const
static ossimMiscProjectionFactory * theInstance