diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h index 9194ef811de5c4b53e6c8e9a2178079618ef2c20..85e48a0dcbf2d15297579652af0abd3a47475eef 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 a5d4cf474782a408c10f02ebd78c60760c1904e4..a57d56c9c1e1172438061d6f06e5620071b06c4d 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 7a70e6efb2cb676f9cd508f28c51677bc24653eb..f2a8e90a7b57fd62267b99e2067e3095b1d07e40 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 c27c1525025ef3f118cfac387e636e60ad55d584..13985f4ac3a88466f413c705211b136e7b09ba3f 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 f47b192d7ea916632d00f880722f7d7304f1a1b4..8f1205d0aec410e892db1901cb3d3f6795df1f49 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) {