From 570807bf6a0e22b03216985781baced50c06df86 Mon Sep 17 00:00:00 2001 From: Cedric <cedric.traizet@c-s.fr> Date: Fri, 4 Jan 2019 10:04:48 +0100 Subject: [PATCH] ENH: remove version_proxy::GetDriverByName --- .../GdalAdapters/include/otbOGRVersionProxy.h | 15 --------------- .../GdalAdapters/src/otbOGRDataSourceWrapper.cxx | 4 ++-- .../GdalAdapters/src/otbOGRVersionProxy.cxx | 9 --------- Modules/IO/IOGDAL/src/otbOGRIOHelper.cxx | 2 +- Modules/IO/IOGDAL/src/otbOGRVectorDataIO.cxx | 2 +- 5 files changed, 4 insertions(+), 28 deletions(-) diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h index 9194ef811d..85e48a0dcb 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h +++ b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h @@ -122,21 +122,6 @@ namespace version_proxy OTBGdalAdapters_EXPORT bool Delete(const char * name); - /** - * This function returns a pointer to the driver from its name. - * - * Calls OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName() for - * gdal 1.x implementation and - * GetGDALDriverManager()->GetDriverByName() for gdal 2.x - * implementation. - * - * \param name Name of the driver to retrieve - * - * \return NULL if no driver could be retrieved. - */ - OTBGdalAdapters_EXPORT - GDALDriverType * GetDriverByName(const char * name); - /** * Return the list of files composing the dataset. * diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx index a5d4cf4747..a57d56c9c1 100644 --- a/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx @@ -127,7 +127,7 @@ otb::ogr::DataSource::DataSource() Drivers::Init(); ogr::version_proxy::GDALDriverType * d = - ogr::version_proxy::GetDriverByName("Memory"); + GetGDALDriverManager()->GetDriverByName("Memory"); assert(d && "OGR Memory driver not found"); m_DataSource = ogr::version_proxy::Create(d,"in-memory"); if (!m_DataSource) { @@ -179,7 +179,7 @@ otb::ogr::DataSource::Pointer otb::ogr::DataSource::OpenDataSource(std::string c } ogr::version_proxy::GDALDriverType * d = - ogr::version_proxy::GetDriverByName( driverName ); + GetGDALDriverManager()->GetDriverByName( driverName ); if(!d) { diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy.cxx index 7a70e6efb2..f2a8e90a7b 100644 --- a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy.cxx @@ -119,15 +119,6 @@ bool Delete(const char * name) return false; } -GDALDriverType * GetDriverByName(const char * name) -{ -#if GDAL_VERSION_NUM<2000000 - return OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(name); -#else - return GetGDALDriverManager()->GetDriverByName(name); -#endif -} - #if GDAL_VERSION_NUM>=2000000 namespace raii { diff --git a/Modules/IO/IOGDAL/src/otbOGRIOHelper.cxx b/Modules/IO/IOGDAL/src/otbOGRIOHelper.cxx index c27c152502..13985f4ac3 100644 --- a/Modules/IO/IOGDAL/src/otbOGRIOHelper.cxx +++ b/Modules/IO/IOGDAL/src/otbOGRIOHelper.cxx @@ -1036,7 +1036,7 @@ std::vector<OGRLayer*> OGRIOHelper if (inMemoryDataSource == nullptr) { const char * driverName = "Memory"; - ogr::version_proxy::GDALDriverType * ogrDriver = ogr::version_proxy::GetDriverByName(driverName); + ogr::version_proxy::GDALDriverType * ogrDriver = GetGDALDriverManager()->GetDriverByName(driverName); inMemoryDataSource = ogr::version_proxy::Create(ogrDriver,"tempDataSource"); } diff --git a/Modules/IO/IOGDAL/src/otbOGRVectorDataIO.cxx b/Modules/IO/IOGDAL/src/otbOGRVectorDataIO.cxx index f47b192d7e..8f1205d0ae 100644 --- a/Modules/IO/IOGDAL/src/otbOGRVectorDataIO.cxx +++ b/Modules/IO/IOGDAL/src/otbOGRVectorDataIO.cxx @@ -216,7 +216,7 @@ void OGRVectorDataIO::Write(const itk::DataObject* datag, char ** /** unused */) //Find first the OGR driver ogr::version_proxy::GDALDriverType * ogrDriver = - ogr::version_proxy::GetDriverByName(this->GetOGRDriverName(this->m_FileName).data()); + GetGDALDriverManager()->GetDriverByName(this->GetOGRDriverName(this->m_FileName).data()); if (ogrDriver == nullptr) { -- GitLab