From 8c0c0db220afc9dde2d17a33b14ffe189d746bce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Traizet?= <cedric.traizet@c-s.fr> Date: Thu, 20 Dec 2018 16:53:51 +0100 Subject: [PATCH] ENH: removed variable OTB_USE_GDAL_20 as it is now always true --- .../GdalAdapters/include/otbOGRFieldWrapper.hxx | 11 +++-------- .../GdalAdapters/include/otbOGRVersionProxy.h | 12 ------------ Modules/Core/Common/otb-module.cmake | 1 - Modules/Core/Common/src/otbConfigure.h.in | 2 -- .../VectorDataBase/src/otbVectorDataKeywordlist.cxx | 8 -------- .../include/otbOGRLayerStreamStitchingFilter.hxx | 7 ------- Modules/ThirdParty/GDAL/otb-module-init.cmake | 5 ----- 7 files changed, 3 insertions(+), 43 deletions(-) diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.hxx b/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.hxx index 258db5172e..2ac3137985 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.hxx +++ b/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.hxx @@ -97,10 +97,9 @@ typedef mpl::map , mpl::pair<char* , mpl::int_<OFTString> > , mpl::pair<char const* , mpl::int_<OFTString> > , mpl::pair<std::vector<std::string>, mpl::int_<OFTStringList> > - #ifdef OTB_USE_GDAL_20 - , mpl::pair<GIntBig, mpl::int_<OFTInteger64> > - , mpl::pair<std::vector<GIntBig>, mpl::int_<OFTInteger64List> > - #endif + , mpl::pair<GIntBig, mpl::int_<OFTInteger64> > + , mpl::pair<std::vector<GIntBig>, mpl::int_<OFTInteger64List> > + // OFTBinary // OFTDate // OFTTime @@ -341,10 +340,8 @@ typedef mpl::map , mpl::pair<mpl::int_<OFTRealList>, MemberContainerGetterPtr<double, &OGRFeature::GetFieldAsDoubleList> > , mpl::pair<mpl::int_<OFTString>, MemberGetterPtr<char const*, &OGRFeature::GetFieldAsString, std::string> > , mpl::pair<mpl::int_<OFTStringList>, StringListMemberGetterPtr<std::vector<std::string> > > - #ifdef OTB_USE_GDAL_20 , mpl::pair<mpl::int_<OFTInteger64>, MemberGetterPtr<GIntBig, &OGRFeature::GetFieldAsInteger64> > , mpl::pair<mpl::int_<OFTInteger64List>, MemberContainerGetterPtr<GIntBig, &OGRFeature::GetFieldAsInteger64List> > - #endif > FieldGetters_Map; /**\ingroup GeometryInternals @@ -360,10 +357,8 @@ typedef mpl::map , mpl::pair<mpl::int_<OFTRealList>, MemberContainerSetterPtr<double, &OGRFeature::SetField> > , mpl::pair<mpl::int_<OFTString>, MemberSetterPtr<char const*, &OGRFeature::SetField/*, std::string*/> > , mpl::pair<mpl::int_<OFTStringList>, StringListMemberSetterPtr<std::vector<std::string> > > - #ifdef OTB_USE_GDAL_20 , mpl::pair<mpl::int_<OFTInteger64>, MemberSetterPtr<GIntBig, &OGRFeature::SetField> > , mpl::pair<mpl::int_<OFTInteger64List>, MemberContainerSetterPtr<const GIntBig, &OGRFeature::SetField> > - #endif > FieldSetters_Map; /**\ingroup GeometryInternals diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h index 7cae3f6dba..084feff4fe 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h +++ b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h @@ -35,15 +35,8 @@ #include "ogr_core.h" // OGR enums #endif - -#ifdef OTB_USE_GDAL_20 class GDALDataset; class GDALDriver; -#else -class OGRDataSource; -class OGRSFDriver; -#endif - class OGRFeature; #include "OTBGdalAdaptersExport.h" @@ -77,13 +70,8 @@ OTBGdalAdapters_EXPORT bool IsOFTInteger64(OGRFieldType type); * See function documentation for details. */ - #ifdef OTB_USE_GDAL_20 typedef GDALDataset GDALDatasetType; typedef GDALDriver GDALDriverType; - #else - typedef OGRDataSource GDALDatasetType; - typedef OGRSFDriver GDALDriverType; -#endif /** * This function opens a file, possibly in read-only mode, and returns diff --git a/Modules/Core/Common/otb-module.cmake b/Modules/Core/Common/otb-module.cmake index b3276d6942..7f14681266 100644 --- a/Modules/Core/Common/otb-module.cmake +++ b/Modules/Core/Common/otb-module.cmake @@ -25,7 +25,6 @@ ENABLE_SHARED DEPENDS OTBBoost OTBITK - #Add dependency to OTBGDAL as GDAL module need to set OTB_USE_GDAL_20 before configuring otbConfigure.h OTBGDAL #Add dependency for extended filename helper class OTBBoostAdapters diff --git a/Modules/Core/Common/src/otbConfigure.h.in b/Modules/Core/Common/src/otbConfigure.h.in index 2146cf15bf..f93fa266c5 100644 --- a/Modules/Core/Common/src/otbConfigure.h.in +++ b/Modules/Core/Common/src/otbConfigure.h.in @@ -27,8 +27,6 @@ #cmakedefine OTB_BUILD_SHARED_LIBS -#cmakedefine OTB_USE_GDAL_20 - #cmakedefine OTB_USE_OPENMP #cmakedefine OTB_USE_SSE_FLAGS diff --git a/Modules/Core/VectorDataBase/src/otbVectorDataKeywordlist.cxx b/Modules/Core/VectorDataBase/src/otbVectorDataKeywordlist.cxx index 39c3623e1a..c14f3dda5a 100644 --- a/Modules/Core/VectorDataBase/src/otbVectorDataKeywordlist.cxx +++ b/Modules/Core/VectorDataBase/src/otbVectorDataKeywordlist.cxx @@ -106,14 +106,12 @@ VectorDataKeywordlist ss << std::setprecision(15) << m_FieldList[i].second.Integer; return ss.str(); } -#ifdef OTB_USE_GDAL_20 case OFTInteger64: { std::ostringstream ss; ss << std::setprecision(15) << m_FieldList[i].second.Integer64; return ss.str(); } -#endif case OFTReal: { std::ostringstream ss; @@ -183,7 +181,6 @@ VectorDataKeywordlist { return (int)(m_FieldList[i].second.Integer); } -#ifdef OTB_USE_GDAL_20 // Some fields that were OFTInteger with gdal 1.x are now // exposed as OFTInteger64. So as to make the old code still // work with the same data, here we downcast to Integer (if @@ -197,7 +194,6 @@ VectorDataKeywordlist return static_cast<int>(m_FieldList[i].second.Integer64); } -#endif case OFTReal: { return (int)(m_FieldList[i].second.Real); @@ -483,13 +479,11 @@ VectorDataKeywordlist << field.second.Date.Hour << field.second.Date.Minute << field.second.Date.Second; break; } -#ifdef OTB_USE_GDAL_20 case OFTInteger64: { output << std::setprecision(15)<<field.second.Integer64; break; } -#endif default: output << "Type not handled for printing"; break; @@ -511,13 +505,11 @@ VectorDataKeywordlist outField.second.Integer = field.second.Integer; break; } -#ifdef OTB_USE_GDAL_20 case OFTInteger64: { outField.second.Integer64 = field.second.Integer64; break; } -#endif case OFTReal: { outField.second.Real = field.second.Real; diff --git a/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.hxx b/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.hxx index f67d089074..a3c72bb38b 100644 --- a/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.hxx +++ b/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.hxx @@ -321,9 +321,6 @@ OGRLayerStreamStitchingFilter<TInputImage> ogr::Field field = upper.feat[0]; try { - #ifdef OTB_USE_GDAL_20 - // In this case, the feature id can be either - // OFTInteger64 or OFTInteger switch(field.GetType()) { case OFTInteger64: @@ -336,10 +333,6 @@ OGRLayerStreamStitchingFilter<TInputImage> fusionFeature[0].SetValue(field.GetValue<int>()); } } - #else - // Only OFTInteger supported in this case - fusionFeature[0].SetValue(field.GetValue<int>()); - #endif m_OGRLayer.CreateFeature(fusionFeature); m_OGRLayer.DeleteFeature(lower.feat.GetFID()); m_OGRLayer.DeleteFeature(upper.feat.GetFID()); diff --git a/Modules/ThirdParty/GDAL/otb-module-init.cmake b/Modules/ThirdParty/GDAL/otb-module-init.cmake index 45f28be1e3..68bdd5597c 100644 --- a/Modules/ThirdParty/GDAL/otb-module-init.cmake +++ b/Modules/ThirdParty/GDAL/otb-module-init.cmake @@ -95,11 +95,6 @@ if(EXISTS "${TEMP}/gdalVersion.txt") file(READ "${TEMP}/gdalVersion.txt" _GDAL_VERSION_STRING) #can't we use GDAL_VERSION_NUM ? string(SUBSTRING ${_GDAL_VERSION_STRING} 0 2 VER2) - if("${VER2}" STREQUAL "2.") - set(OTB_USE_GDAL_20 true CACHE INTERNAL "True if GDAL >= 2.0.0 has been detected" FORCE ) - else() - set(OTB_USE_GDAL_20 false CACHE INTERNAL "True if GDAL >= 2.0.0 has been detected" FORCE ) - endif() set(GDAL_VERSION_STRING "${_GDAL_VERSION_STRING}" CACHE INTERNAL "" FORCE) else() error_message( "${TEMP}/gdalVersion.txt does not exist. Cannot continue.") -- GitLab