OTB
9.0.0
Orfeo Toolbox
|
#include <otbDEMHandler.h>
Public Types | |
using | PointType = itk::Point< double, 2 > |
using | Self = DEMHandler |
Public Member Functions | |
double | GetHeightAboveEllipsoid (const PointType &geoPoint) const |
double | GetHeightAboveEllipsoid (double lon, double lat) const |
bool | IsValidDEMDirectory (const std::string &DEMDirectory) const |
void | OpenDEMDirectory (std::string DEMDirectory) |
void | OpenDEMFile (std::string path) |
bool | OpenGeoidFile (std::string geoidFile) |
Static Public Member Functions | |
static DEMHandler & | GetInstance () |
static constexpr char const * | DEM_DATASET_PATH = "/vsimem/otb_dem_dataset.vrt" |
static constexpr char const * | DEM_WARPED_DATASET_PATH = "/vsimem/otb_dem_warped_dataset.vrt" |
static constexpr char const * | DEM_SHIFTED_DATASET_PATH = "/vsimem/otb_dem_shifted_dataset.vrt" |
double | m_DefaultHeightAboveEllipsoid |
std::vector< std::string > | m_DEMDirectories |
std::vector< otb::GDALDatasetWrapper::Pointer > | m_DatasetList |
std::string | m_GeoidFilename |
std::list< DEMObserverInterface * > | m_ObserverList |
std::vector< std::shared_ptr< DEMHandlerTLS > > | m_tlses |
double | GetHeightAboveMSL (double lon, double lat) const |
double | GetHeightAboveMSL (const PointType &geoPoint) const |
double | GetGeoidHeight (double lon, double lat) const |
double | GetGeoidHeight (const PointType &geoPoint) const |
std::vcl_size_t | GetDEMCount () const noexcept |
double | GetDefaultHeightAboveEllipsoid () const noexcept |
void | SetDefaultHeightAboveEllipsoid (double height) |
std::string const & | GetDEMDirectory (std::vcl_size_t idx=0) const |
std::vcl_size_t | GetNumberOfDEMDirectories () const noexcept |
std::string const & | GetGeoidFile () const noexcept |
void | ClearElevationParameters () |
void | AttachObserver (DEMObserverInterface *observer) override |
void | DetachObserver (DEMObserverInterface *observer) override |
void | Notify () const override |
DEMHandlerTLS const & | GetHandlerForCurrentThread () const |
DEMHandler () | |
~DEMHandler () | |
std::shared_ptr< DEMHandlerTLS > | DoFetchOrCreateHandler () const |
void | RegisterConfigurationInHandler (DEMHandlerTLS &handler) const |
DEMHandler (const Self &)=delete | |
void | operator= (const Self &)=delete |
Additional Inherited Members | |
Protected Member Functions inherited from otb::DEMSubjectInterface | |
DEMSubjectInterface ()=default | |
DEMSubjectInterface (DEMSubjectInterface const &)=delete | |
DEMSubjectInterface & | operator= (DEMSubjectInterface const &)=delete |
~DEMSubjectInterface ()=default | |
Single access point for DEM data retrieval.
This class is the single configuration and access point for elevation handling in images projections and localization functions. Since this class is a singleton, there is no New()
function. The DEMHandler::GetInstance()
function should be used instead.
Please be aware that a proper instantiation and parameter setting of this class is advised before any call to geometric filters or functionalities.
The class allows configuring a directory containing DEM tiles (raster tiles will be opened by GDAL drivers) using the OpenDEMDirectory()
function. The OpenGeoidFile()
function allows inputting a geoid file as well. Last, a default height above ellipsoid can be set using the SetDefaultHeightAboveEllipsoid()
function.
The class allows retrieving either height above ellipsoid or height above Mean Sea Level (MSL).
Here is the complete description of both functions output depending on the class configuration for the SRTM DEM (in the following, no SRTM means DEMDirectory not set, or no coverage for point, or srtm_value is no_data).
Definition at line 113 of file otbDEMHandler.h.
using otb::DEMHandler::PointType = itk::Point<double, 2> |
Definition at line 117 of file otbDEMHandler.h.
using otb::DEMHandler::Self = DEMHandler |
Definition at line 116 of file otbDEMHandler.h.
|
protected |
Default constructor. Takes care of calling GDALAllRegister()
.
|
protected |
Destructor.
DEM_DATASET_PATH
, DEM_WARPED_DATASET_PATH
and DEM_SHIFTED_DATASET_PATH
files are deleted. DEMHandlerTLS
instances.
|
privatedelete |
Path to the in-memory vrt
|
inlineoverridevirtual |
Add an element to the current list of observers. The obsever will be updated whenever the DEM configuration is modified.
Implements otb::DEMSubjectInterface.
Definition at line 206 of file otbDEMHandler.h.
References m_ObserverList.
void otb::DEMHandler::ClearElevationParameters | ( | ) |
Clear the DEM list and geoid filename, close all elevation datasets and reset the default height above ellipsoid.
|
inlineoverridevirtual |
Remove an element of the current list of observers.
Implements otb::DEMSubjectInterface.
Definition at line 209 of file otbDEMHandler.h.
References m_ObserverList.
|
private |
Internal function to fetch from the pool or create a new `DEMHandlerTLS.
|
noexcept |
Path to the in-memory vrt
|
noexcept |
Return the number of DEM opened
std::string const& otb::DEMHandler::GetDEMDirectory | ( | std::vcl_size_t | idx = 0 | ) | const |
Get n-th DEM directory name.
[in] | idx | directory index |
std::out_of_range | if idx >= GetNumberOfDEMDirectories() |
|
noexcept |
Get Geoid file
double otb::DEMHandler::GetGeoidHeight | ( | const PointType & | geoPoint | ) | const |
Path to the in-memory vrt
double otb::DEMHandler::GetGeoidHeight | ( | double | lon, |
double | lat | ||
) | const |
Return the offset information from the Geoid.
[in] | lon | input longitude |
[in] | lat | input latitude |
DEMHandlerTLS const& otb::DEMHandler::GetHandlerForCurrentThread | ( | ) | const |
Accessor to the current (thread-wise) DEM handler.
Returns the instance of DEMHandlerTLS
that is meant to be used exclusively from the current thread.
As a microoptimisation, this function is public and can be used from places like ThreadedGenerateData()
to extract a local reference to the instance of the handler, which could then be used with GetHeightAboveEllipsoid(DEMHandlerTLS const&, double lon, double lat)
and so on.
double otb::DEMHandler::GetHeightAboveEllipsoid | ( | const PointType & | geoPoint | ) | const |
double otb::DEMHandler::GetHeightAboveEllipsoid | ( | double | lon, |
double | lat | ||
) | const |
Return the height above the ellipsoid.
[in] | lon | input longitude |
[in] | lat | input latitude |
Referenced by otb::GCPsToRPCSensorModelImageFilter< TImage >::AddGCP(), otb::DEMToImageGenerator< TDEMImage >::ThreadedGenerateData(), and otb::SarInverseTransform< TScalarType, NInputDimensions, NOutputDimensions >::TransformPoint().
double otb::DEMHandler::GetHeightAboveMSL | ( | const PointType & | geoPoint | ) | const |
Path to the in-memory vrt
double otb::DEMHandler::GetHeightAboveMSL | ( | double | lon, |
double | lat | ||
) | const |
Return the height above the mean sea level.
[in] | lon | input longitude |
[in] | lat | input latitude |
Referenced by otb::DEMToImageGenerator< TDEMImage >::ThreadedGenerateData().
|
static |
Retrieve the singleton instance
Referenced by otb::GCPsToRPCSensorModelImageFilter< TImage >::AddGCP(), otb::StereoSensorModelToElevationFilter< TInputImage, TOutputHeight >::BeforeThreadedGenerateData(), otb::StereorectificationDisplacementFieldSource< TInputImage, TOutputImage >::GenerateData(), otb::StereorectificationDisplacementFieldSource< TInputImage, TOutputImage >::GenerateOutputInformation(), otb::DEMToImageGenerator< TDEMImage >::ThreadedGenerateData(), and otb::SarInverseTransform< TScalarType, NInputDimensions, NOutputDimensions >::TransformPoint().
|
inlinenoexcept |
Path to the in-memory vrt
Definition at line 191 of file otbDEMHandler.h.
References m_DEMDirectories.
bool otb::DEMHandler::IsValidDEMDirectory | ( | const std::string & | DEMDirectory | ) | const |
Tells whether the directory contains a raster
[in] | DEMDirectory | input directory |
|
overridevirtual |
Update all observers
Implements otb::DEMSubjectInterface.
void otb::DEMHandler::OpenDEMDirectory | ( | std::string | DEMDirectory | ) |
Open all raster in the directory.
[in] | DEMDirectory | input directory |
void otb::DEMHandler::OpenDEMFile | ( | std::string | path | ) |
Try to open the DEM directory.
[in] | path | input path |
bool otb::DEMHandler::OpenGeoidFile | ( | std::string | geoidFile | ) |
Try to open a geoid file
[in] | geoidFile | input geoid path |
|
privatedelete |
Path to the in-memory vrt
|
private |
(Re)sets GEOID and DEM directory information in the handler. This function is meant to be called from DoFetchOrCreateHandler
only: when a thread needs a new DEMHandlerTLS
which is created on the fly. It's not thread safe!
void otb::DEMHandler::SetDefaultHeightAboveEllipsoid | ( | double | height | ) |
Path to the in-memory vrt
|
staticconstexpr |
Path to the in-memory vrt
Definition at line 215 of file otbDEMHandler.h.
|
staticconstexpr |
Path to the in-memory vrt
Definition at line 217 of file otbDEMHandler.h.
|
staticconstexpr |
Path to the in-memory vrt
Definition at line 216 of file otbDEMHandler.h.
|
private |
List of RAII capsules on all opened DEM datasets for memory management
Definition at line 282 of file otbDEMHandler.h.
|
private |
Default height above elliposid, used when no DEM or geoid height is available.
Definition at line 276 of file otbDEMHandler.h.
|
private |
List of the DEM directories currently opened
Definition at line 279 of file otbDEMHandler.h.
Referenced by GetNumberOfDEMDirectories().
|
private |
Filename of the current geoid
Definition at line 285 of file otbDEMHandler.h.
|
private |
Observers on the DEM
Definition at line 288 of file otbDEMHandler.h.
Referenced by AttachObserver(), and DetachObserver().
|
mutableprivate |
Pool of actual thread local DEM handlers.
Definition at line 291 of file otbDEMHandler.h.