Request for Changes-2: Improve otb::DEMHandler interface to edit DEM-directory and Geoid-file

From OTBWiki
Jump to: navigation, search


  1.; and




Improve the otb::DEMHandler singleton class to provide a clearing interface to DEM-directory and Geoid-file management so that client code to the OTB can edit the instance after having set it up for the first time.


otb::DEMHandler is a singleton-class which allow client code to the OTB library to ::OpenDEMDirectory() and/or ::OpenGeoidFile() but not to clear them, nor clear and setup again (nor can it be deleted and set up again because it is singleton-class status). Currently the otb::DEMHandler can be used in programs which set it up once and run. But, higher level applications such as, for example, GUI applications and, in particular, Monteverdi, need to set the otb::DEMHandler at initialization time and then allow the user to enable/edit the DEM-directory and Geoid-file.

Implementation details

Classes and files

When ::OpenDEMDirectory() is called, each file of the directory is loaded into the ossimElevManager as an ossimElevDatabase:

  1. Add a ::ClearDEMs() method to clear the ossimElevManager;
  2. Add a ::GetDEMCount() to return the number of ossimElevDatabases contained within the ossimElevManager so the client program can iterate through the DEMs;
  3. (optional) Rename method ::GetDEMDirectory( unsigned int ) method to GetDEM( unsigned int ).

When ::OpenGeoidFile() is called, an EGM96 Geoid-file is added once (and only once) into the ossimGeoidManager which can contain several ones but does not provide a clearing interface such as the ossimElevManager:

  1. Modifiy ::OpenGeoidFile() to return a boolean value informing whether the Geoid-file has been registered into the ossimGeoiManager (so, the client application can react to);
  2. Throw an exception when the Geoid-file has not been correctly loaded so the client program could display an error message.




  • Tests based on otb::DEMHandlerTest, especially uaTvDEMHandler_AboveEllipsoid_SRTM_BadGeoid


Improved documentation of following otb::DEMHandler methods:

  • otb::DEMHandler::ClearDEMs()
  • otb::DEMHandler::GetDEMCount()
  • otb::DEMHandler::OpenDEMDirectory()
  • otb::DEMHandler::OpenGeoidFile()

Additional notes