Commit 2c0f23cd authored by Cédric Traizet's avatar Cédric Traizet

ENH: remove function IsOFTInteger64(field) and replace it with a direct test on the field type

parent 1adbb63a
......@@ -48,12 +48,6 @@ namespace ogr
namespace version_proxy
{
/**
* With Gdal >= 2.0, this function will test equality between type and
* OFTInteger64 enum. Otherwise, it returns false.
*/
OTBGdalAdapters_EXPORT bool IsOFTInteger64(OGRFieldType type);
/**
* This namespace holds proxy functions hiding interface changes in gdal 2.0
*
......
......@@ -49,18 +49,6 @@ namespace ogr
namespace version_proxy
{
/*-------------------------[GDAL v2 API change]-------------------------------*/
OTBGdalAdapters_EXPORT bool IsOFTInteger64(OGRFieldType type)
{
#if GDAL_VERSION_NUM<2000000
(void)type;
return false;
#else
return type == OFTInteger64;
#endif
}
GDALDatasetType * Open(const char * filename, bool readOnly , std::vector< std::string > const & options )
{
#if GDAL_VERSION_NUM<2000000
......
......@@ -204,7 +204,7 @@ private:
OGRFieldType fieldType = feature.ogr().GetFieldDefnRef(iField)->GetType();
if(fieldType == OFTString || fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64(fieldType))
if(fieldType == OFTString || fieldType == OFTInteger || fieldType == OFTInteger64)
{
std::string tmpKey="ref.vector.field."+key.substr(0, end - key.begin());
AddChoice(tmpKey,item);
......
......@@ -148,7 +148,7 @@ private:
OGRFieldType fieldType = feature.ogr().GetFieldDefnRef(iField)->GetType();
if(fieldType == OFTString || fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64(fieldType))
if(fieldType == OFTString || fieldType == OFTInteger || fieldType == OFTInteger64)
{
std::string tmpKey="field."+key.substr(0, end - key.begin());
AddChoice(tmpKey,item);
......
......@@ -168,7 +168,7 @@ private:
OGRFieldType fieldType = feature.ogr().GetFieldDefnRef(iField)->GetType();
if(fieldType == OFTString || fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64(fieldType))
if(fieldType == OFTString || fieldType == OFTInteger || fieldType == OFTInteger64)
{
std::string tmpKey="field."+key.substr(0, end - key.begin());
AddChoice(tmpKey,item);
......
......@@ -140,7 +140,7 @@ private:
OGRFieldType fieldType = feature.ogr().GetFieldDefnRef(iField)->GetType();
if(fieldType == OFTString || fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64(fieldType))
if(fieldType == OFTString || fieldType == OFTInteger || fieldType == OFTInteger64)
{
std::string tmpKey="field."+key.substr(0, end - key.begin());
AddChoice(tmpKey,item);
......
......@@ -248,7 +248,7 @@ private:
OGRFieldType fieldType = feature.ogr().GetFieldDefnRef(iField)->GetType();
if(fieldType == OFTString || fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64(fieldType))
if(fieldType == OFTString || fieldType == OFTInteger || fieldType == OFTInteger64)
{
std::string tmpKey="field."+key.substr(0, end - key.begin());
AddChoice(tmpKey,item);
......
......@@ -183,7 +183,7 @@ private:
std::transform(key.begin(), key.end(), key.begin(), tolower);
OGRFieldType fieldType = layerDefn.GetFieldDefn(iField)->GetType();
if(fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64(fieldType) || fieldType == OFTReal)
if(fieldType == OFTInteger || fieldType == OFTInteger64 || fieldType == OFTReal)
{
std::string tmpKey="feat."+key;
AddChoice(tmpKey,item);
......
......@@ -131,12 +131,12 @@ void TrainVectorBase::DoUpdateParameters()
OGRFieldType fieldType = feature.ogr().GetFieldDefnRef( iField )->GetType();
if( fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64( fieldType ) || fieldType == OFTReal )
if( fieldType == OFTInteger || fieldType == OFTInteger64 || fieldType == OFTReal )
{
std::string tmpKey = "feat." + key.substr( 0, static_cast<unsigned long>( end - key.begin() ) );
AddChoice( tmpKey, item );
}
if( fieldType == OFTString || fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64( fieldType ) )
if( fieldType == OFTString || fieldType == OFTInteger || fieldType == OFTInteger64 )
{
std::string tmpKey = "cfield." + key.substr( 0, static_cast<unsigned long>( end - key.begin() ) );
AddChoice( tmpKey, item );
......
......@@ -247,7 +247,7 @@ SampleAugmentationFilter
{
OGRFieldType fieldType = feature.ogr().GetFieldDefnRef(idx)->GetType();
return (fieldType == OFTInteger
|| ogr::version_proxy::IsOFTInteger64( fieldType )
|| fieldType == OFTInteger64
|| fieldType == OFTReal);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment