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
ossimplugins::ossimPluginProjectionFactory Class Reference

#include <ossimPluginProjectionFactory.h>

Inheritance diagram for ossimplugins::ossimPluginProjectionFactory:
ossimProjectionFactoryBase ossimObjectFactory ossimObject ossimReferenced

Public Member Functions

virtual ossimProjectioncreateProjection (const ossimFilename &filename, ossim_uint32 entryIdx) const
 takes a filename. More...
 
virtual ossimProjectioncreateProjection (const ossimString &name) const
 Take a projection type name. More...
 
virtual ossimProjectioncreateProjection (const ossimKeywordlist &kwl, const char *prefix=0) const
 Take a keywordlist. More...
 
virtual ossimObjectcreateObject (const ossimString &typeName) const
 
virtual ossimObjectcreateObject (const ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual void getTypeNameList (std::vector< ossimString > &typeList) const
 
- Public Member Functions inherited from ossimProjectionFactoryBase
virtual ossimProjectioncreateProjection (ossimImageHandler *handler) const
 
- 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
 

Static Public Member Functions

static ossimPluginProjectionFactoryinstance ()
 

Protected Member Functions

 ossimPluginProjectionFactory ()
 
bool isTileMap (const ossimFilename &filename) const
 
- Protected Member Functions inherited from ossimProjectionFactoryBase
ossimProjectioncreateProjectionFromGeometryFile (const ossimFilename &imageFile, ossim_uint32 entryIdx) const
 This method takes the filename and tries to find an external ".geom" file. More...
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Detailed Description

Definition at line 19 of file ossimPluginProjectionFactory.h.

Constructor & Destructor Documentation

◆ ossimPluginProjectionFactory()

ossimplugins::ossimPluginProjectionFactory::ossimPluginProjectionFactory ( )
inlineprotected

Definition at line 55 of file ossimPluginProjectionFactory.h.

Referenced by instance().

55 {}

Member Function Documentation

◆ createObject() [1/2]

ossimObject * ossimplugins::ossimPluginProjectionFactory::createObject ( const ossimString typeName) const
virtual

Creates an object given a type name.

Implements ossimObjectFactory.

Definition at line 511 of file ossimPluginProjectionFactory.cpp.

References createProjection().

513 {
514  return createProjection(typeName);
515 }
virtual ossimProjection * createProjection(const ossimFilename &filename, ossim_uint32 entryIdx) const
takes a filename.

◆ createObject() [2/2]

ossimObject * ossimplugins::ossimPluginProjectionFactory::createObject ( const ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

Creates and object given a keyword list.

Implements ossimObjectFactory.

Definition at line 517 of file ossimPluginProjectionFactory.cpp.

References createProjection().

519 {
520  return createProjection(kwl, prefix);
521 }
virtual ossimProjection * createProjection(const ossimFilename &filename, ossim_uint32 entryIdx) const
takes a filename.

◆ createProjection() [1/3]

ossimProjection * ossimplugins::ossimPluginProjectionFactory::createProjection ( const ossimFilename filename,
ossim_uint32  entryIdx 
) const
virtual

takes a filename.

This filename can be an image file or it can also be a ossim .geom file. It could be other forms of geom files as well. The factories job will be to determine what parser to use and return a projection if successful.

Implements ossimProjectionFactoryBase.

Definition at line 57 of file ossimPluginProjectionFactory.cpp.

References ossimFilename::dirCat(), ossimString::downcase(), ossimFilename::exists(), ossimFilename::file(), ossimRefPtr< T >::get(), ossimFormosatDimapSupportData::loadXmlFile(), ossimNotify(), ossimNotifyLevel_DEBUG, ossimFilename::path(), ossimRefPtr< T >::release(), ossimFilename::setExtension(), and ossimRefPtr< T >::valid().

Referenced by createObject().

59 {
60  static const char MODULE[] = "ossimPluginProjectionFactory::createProjection(ossimFilename& filename)";
61  ossimRefPtr<ossimProjection> projection = 0;
62  //traceDebug.setTraceFlag(true);
63 
64  if(traceDebug())
65  {
67  << MODULE << " DEBUG: testing ossimRadarSat2Model" << std::endl;
68  }
69 
70  if ( !projection )
71  {
72  ossimRefPtr<ossimRadarSat2Model> model = new ossimRadarSat2Model();
73  if ( model->open(filename) )
74  {
75  // Check if a coarse grid was generated, and use it instead:
76  projection = model->getReplacementOcgModel().get();
77  if (projection.valid())
78  model = 0; // Have OCG, don't need this one anymore
79  else
80  projection = model.get();
81  }
82  else
83  {
84  model = 0;
85  }
86  }
87 
88  if(traceDebug())
89  {
91  << MODULE << " DEBUG: testing ossimPleiadesModel" << std::endl;
92  }
93 
94  // Pleiades
95  if ( !projection )
96  {
97  ossimRefPtr<ossimPleiadesModel> model = new ossimPleiadesModel();
98  if ( model->open(filename) )
99  {
100  projection = model.get();
101  }
102  else
103  {
104  model = 0;
105  }
106  }
107 
108  if(traceDebug())
109  {
111  << MODULE << " DEBUG: testing ossimTerraSarModel" << std::endl;
112  }
113 
114  if ( !projection )
115  {
116  ossimRefPtr<ossimTerraSarModel> model = new ossimTerraSarModel();
117 
118  if ( model->open(filename) )
119  {
120  // Check if a coarse grid was generated, and use it instead:
121  projection = model->getReplacementOcgModel().get();
122  if (projection.valid())
123  model = 0; // Have OCG, don't need this one anymore
124  else
125  projection = model.get();
126  }
127  else
128  {
129  model = 0;
130  }
131  }
132 
133  if(traceDebug())
134  {
136  << MODULE << " DEBUG: testing ossimErsSarModel" << std::endl;
137  }
138 
139  if ( !projection )
140  {
141  ossimRefPtr<ossimErsSarModel> model = new ossimErsSarModel();
142  if ( model->open(filename) )
143  {
144  projection = model.get();
145  }
146  else
147  {
148  model = 0;
149  }
150  }
151 
152  if(traceDebug())
153  {
155  << MODULE << " DEBUG: testing ossimEnvisatSarModel" << std::endl;
156  }
157 
158  if (!projection)
159  {
160  ossimRefPtr<ossimEnvisatAsarModel> model = new ossimEnvisatAsarModel();
161  if (model->open(filename))
162  {
163  projection = model.get();
164  }
165  else
166  {
167  model = 0;
168  }
169  }
170 
171  if(traceDebug())
172  {
174  << MODULE << " DEBUG: testing ossimRadarSatModel" << std::endl;
175  }
176 
177  if (!projection)
178  {
179  ossimRefPtr<ossimRadarSatModel> model = new ossimRadarSatModel();
180  if (model->open(filename))
181  {
182  projection = model.get();
183  }
184  else
185  {
186  model = 0;
187  }
188  }
189 
190  if(traceDebug())
191  {
193  << MODULE << " DEBUG: testing ossimAlosPalsarModel" << std::endl;
194  }
195 
196  if (!projection)
197  {
198  ossimRefPtr<ossimAlosPalsarModel> model = new ossimAlosPalsarModel();
199  if (model->open(filename))
200  {
201  projection = model.get();
202  }
203  else
204  {
205  model = 0;
206  }
207  }
208 
209  if(traceDebug())
210  {
212  << MODULE << " DEBUG: testing ossimFormosatModel" << std::endl;
213  }
214 
215  ossimFilename formosatTest = filename;
216  formosatTest = formosatTest.setExtension("geom");
217  if(!formosatTest.exists())
218  {
219  formosatTest = filename.path();
220  formosatTest = formosatTest.dirCat(ossimFilename("METADATA.DIM"));
221  if (formosatTest.exists() == false)
222  {
223  formosatTest = filename.path();
224  formosatTest = formosatTest.dirCat(ossimFilename("metadata.dim"));
225  }
226  }
227  if(formosatTest.exists())
228  {
229  //---
230  // Check the basename of the input file. So we don't create a projection
231  // for ancillary files, icon.jpg amd preview.jpg.
232  //---
233  ossimFilename baseName = filename.file();
234  baseName.downcase();
235 
236  if ( (baseName != "icon.jpg" ) && ( baseName != "preview.jpg" ) )
237  {
240  if(meta->loadXmlFile(formosatTest))
241  {
242  ossimRefPtr<ossimFormosatModel> model = new ossimFormosatModel(meta.get());
243  if(!model->getErrorStatus())
244  {
245  projection = model.get();
246 
247  }
248  model = 0;
249  }
250  }
251  }
252 
253  if(traceDebug())
254  {
256  << MODULE << " DEBUG: testing ossimTileMapModel" << std::endl;
257  }
258 
259  if (!projection)
260  {
261  ossimRefPtr<ossimTileMapModel> model = new ossimTileMapModel();
262  if (model->open(filename))
263  {
264  projection = model.get();
265  }
266  else
267  {
268  model = 0;
269  }
270  }
271 
272  if(traceDebug())
273  {
275  << MODULE << " DEBUG: testing ossimSpot6Model" << std::endl;
276  }
277 
278  // Spot6
279  if ( !projection )
280  {
281  ossimRefPtr<ossimSpot6Model> model = new ossimSpot6Model();
282  if ( model->open(filename) )
283  {
284  projection = model.get();
285  }
286  else
287  {
288  model = 0;
289  }
290  }
291 
292  //***
293  // ADD_MODEL: (Please leave this comment for the next programmer)
294  //***
295  //if(traceDebug())
296  //{
297  // ossimNotify(ossimNotifyLevel_DEBUG)
298  // << MODULE << " DEBUG: testing MY_NEW_MODEL" << std::endl;
299  //}
300 
301  // MY_NEW_MODEL
302  //if ( !projection )
303  //{
304  // ossimRefPtr<MY_NEW_MODEL> model = new MY_NEW_MODEL();
305  // if ( model->open(filename) )
306  //{
307  // projection = model.get();
308  //}
309  // else
310  // {
311  // model = 0;
312  // }
313  //}
314 
315  return projection.release();
316 }
bool valid() const
Definition: ossimRefPtr.h:75
bool exists() const
T * release()
Definition: ossimRefPtr.h:93
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
ossimFilename dirCat(const ossimFilename &file) const
bool loadXmlFile(const ossimFilename &file)
ossimFilename file() const
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
ossimFilename path() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ createProjection() [2/3]

ossimProjection * ossimplugins::ossimPluginProjectionFactory::createProjection ( const ossimString name) const
virtual

Take a projection type name.

Implements ossimProjectionFactoryBase.

Definition at line 318 of file ossimPluginProjectionFactory.cpp.

References ossimNotify(), ossimNotifyLevel_DEBUG, and STATIC_TYPE_NAME.

320 {
321  static const char MODULE[] = "ossimPluginProjectionFactory::createProjection(ossimString& name)";
322 
323  if(traceDebug())
324  {
326  << MODULE << " DEBUG: Entering ...." << std::endl;
327  }
328 
329  // else if (name == STATIC_TYPE_NAME(ossimCosmoSkymedModel))
330  // {
331  // return new ossimCosmoSkymedModel;
332  // }
333  if (name == STATIC_TYPE_NAME(ossimRadarSat2Model))
334  {
335  return new ossimRadarSat2Model();
336  }
337  else if (name == STATIC_TYPE_NAME(ossimTerraSarModel))
338  {
339  return new ossimTerraSarModel();
340  }
341  else if (name == STATIC_TYPE_NAME(ossimErsSarModel))
342  {
343  return new ossimErsSarModel;
344  }
345  else if (name == STATIC_TYPE_NAME(ossimEnvisatAsarModel))
346  {
347  return new ossimEnvisatAsarModel;
348  }
349  else if (name == STATIC_TYPE_NAME(ossimRadarSatModel))
350  {
351  return new ossimRadarSatModel;
352  }
353  else if (name == STATIC_TYPE_NAME(ossimAlosPalsarModel))
354  {
355  return new ossimAlosPalsarModel;
356  }
357  else if (name == STATIC_TYPE_NAME(ossimFormosatModel))
358  {
359  return new ossimFormosatModel;
360  }
361  else if (name == STATIC_TYPE_NAME(ossimTileMapModel))
362  {
363  return new ossimTileMapModel;
364  }
365  else if (name == STATIC_TYPE_NAME(ossimPleiadesModel))
366  {
367  return new ossimPleiadesModel;
368  }
369  else if (name == STATIC_TYPE_NAME(ossimSpot6Model))
370  {
371  return new ossimSpot6Model;
372  }
373 
374  //***
375  // ADD_MODEL: (Please leave this comment for the next programmer)
376  //***
377 // if(name == MY_NEW_MODEL)
378 // return new myNewModel;
379 
380 
381  if(traceDebug())
382  {
384  << MODULE << " DEBUG: Leaving ...." << std::endl;
385  }
386 
387  return 0;
388 }
#define STATIC_TYPE_NAME(T)
Definition: ossimRtti.h:325
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ createProjection() [3/3]

ossimProjection * ossimplugins::ossimPluginProjectionFactory::createProjection ( const ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

Take a keywordlist.

Implements ossimProjectionFactoryBase.

Definition at line 390 of file ossimPluginProjectionFactory.cpp.

References ossimKeywordlist::find(), ossimProjection::loadState(), ossimNotify(), ossimNotifyLevel_DEBUG, ossimRefPtr< T >::release(), and ossimKeywordNames::TYPE_KW.

392 {
393  ossimRefPtr<ossimProjection> result = 0;
394  static const char MODULE[] = "ossimPluginProjectionFactory::createProjection(ossimKeywordlist& kwl)";
395 
396  if(traceDebug())
397  {
399  << MODULE << " DEBUG: Start ...." << std::endl;
400  }
401 
402  const char* lookup = kwl.find(prefix, ossimKeywordNames::TYPE_KW);
403  if (lookup)
404  {
405  ossimString type = lookup;
406 
407  if (type == "ossimRadarSat2Model")
408  {
409  result = new ossimRadarSat2Model();
410  if ( !result->loadState(kwl, prefix) )
411  {
412  result = 0;
413  }
414  }
415  else if (type == "ossimTerraSarModel")
416  {
417  result = new ossimTerraSarModel();
418  if ( !result->loadState(kwl, prefix) )
419  {
420  result = 0;
421  }
422  }
423  else if (type == "ossimErsSarModel")
424  {
425  result = new ossimErsSarModel();
426  if ( !result->loadState(kwl, prefix) )
427  {
428  result = 0;
429  }
430  }
431  else if (type == "ossimEnvisatAsarModel")
432  {
433  result = new ossimEnvisatAsarModel();
434  if ( !result->loadState(kwl, prefix) )
435  {
436  result = 0;
437  }
438  }
439  else if (type == "ossimRadarSatModel")
440  {
441  result = new ossimRadarSatModel();
442  if ( !result->loadState(kwl, prefix) )
443  {
444  result = 0;
445  }
446  }
447  else if (type == "ossimAlosPalsarModel")
448  {
449  result = new ossimAlosPalsarModel();
450  if ( !result->loadState(kwl, prefix) )
451  {
452  result = 0;
453  }
454  }
455  else if (type == "ossimFormosatModel")
456  {
457  result = new ossimFormosatModel();
458  if ( !result->loadState(kwl, prefix) )
459  {
460  result = 0;
461  }
462  }
463  else if (type == "ossimTileMapModel")
464  {
465  result = new ossimTileMapModel();
466  if ( !result->loadState(kwl, prefix) )
467  {
468  result = 0;
469  }
470  }
471  else if (type == "ossimPleiadesModel")
472  {
473  result = new ossimPleiadesModel();
474  if ( !result->loadState(kwl, prefix) )
475  {
476  result = 0;
477  }
478  }
479  else if (type == "ossimSpot6Model")
480  {
481  result = new ossimSpot6Model();
482  if ( !result->loadState(kwl, prefix) )
483  {
484  result = 0;
485  }
486  }
487 
488  //***
489  // ADD_MODEL: (Please leave this comment for the next programmer)
490  //***
491 // else if (type == "ossimSpot6Model")
492 // {
493 // result = new ossimSpot6Model();
494 // if ( !result->loadState(kwl, prefix) )
495 // {
496 // result = 0;
497 // }
498 // }
499 
500  }
501 
502  if(traceDebug())
503  {
505  << MODULE << " DEBUG: End ...." << std::endl;
506  }
507 
508  return result.release();
509 }
const char * find(const char *key) const
static const char * TYPE_KW
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
T * release()
Definition: ossimRefPtr.h:93
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ getTypeNameList()

void ossimplugins::ossimPluginProjectionFactory::getTypeNameList ( std::vector< ossimString > &  typeList) const
virtual

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 524 of file ossimPluginProjectionFactory.cpp.

References STATIC_TYPE_NAME.

Referenced by ossimplugins::ossimSharedLibraryInitialize().

525 {
526  typeList.push_back(STATIC_TYPE_NAME(ossimRadarSatModel));
527  typeList.push_back(STATIC_TYPE_NAME(ossimRadarSat2Model));
528  typeList.push_back(STATIC_TYPE_NAME(ossimTerraSarModel));
529  // result.push_back(STATIC_TYPE_NAME(ossimCosmoSkymedModel));
530  typeList.push_back(STATIC_TYPE_NAME(ossimEnvisatAsarModel));
531  typeList.push_back(STATIC_TYPE_NAME(ossimErsSarModel));
532  typeList.push_back(STATIC_TYPE_NAME(ossimAlosPalsarModel));
533  typeList.push_back(STATIC_TYPE_NAME(ossimFormosatModel));
534  typeList.push_back(STATIC_TYPE_NAME(ossimTileMapModel));
535  typeList.push_back(STATIC_TYPE_NAME(ossimPleiadesModel));
536  typeList.push_back(STATIC_TYPE_NAME(ossimSpot6Model));
537 
538  //***
539  // ADD_MODEL: Please leave this comment for the next programmer. Add above.
540  //***
541  //typeList.push_back(STATIC_TYPE_NAME(MY_NEW_MODEL));
542 }
#define STATIC_TYPE_NAME(T)
Definition: ossimRtti.h:325

◆ instance()

ossimPluginProjectionFactory * ossimplugins::ossimPluginProjectionFactory::instance ( )
static

◆ isTileMap()

bool ossimplugins::ossimPluginProjectionFactory::isTileMap ( const ossimFilename filename) const
protected

Definition at line 544 of file ossimPluginProjectionFactory.cpp.

References ossimString::beforePos(), ossimString::downcase(), and ossimFilename::ext().

545 {
546  ossimFilename temp(filename);
547  temp.downcase();
548 
549  ossimString os = temp.beforePos(4);
550 
551  if(temp.ext()=="otb")
552  {
553  return true;
554  }
555  else if(os == "http")
556  {
557  return true;
558  }
559  return false;
560 }
ossimString beforePos(std::string::size_type pos) const

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