Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
otb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
273
Issues
273
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Main Repositories
otb
Commits
1c38cb95
Commit
1c38cb95
authored
Nov 18, 2016
by
Julien Michel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
COMP: Use the OGR version proxy to hide that OFTInteger64 type only exists for gdal>=2.0
parent
386d0971
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
32 additions
and
5 deletions
+32
-5
Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h
Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h
+16
-0
Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx
Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx
+6
-0
Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy2x.cxx
Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy2x.cxx
+5
-0
Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx
...tions/AppClassification/app/otbPolygonClassStatistics.cxx
+1
-1
Modules/Applications/AppClassification/app/otbSampleExtraction.cxx
...pplications/AppClassification/app/otbSampleExtraction.cxx
+1
-1
Modules/Applications/AppClassification/app/otbSampleSelection.cxx
...Applications/AppClassification/app/otbSampleSelection.cxx
+1
-1
Modules/Applications/AppClassification/app/otbTrainVectorClassifier.cxx
...ations/AppClassification/app/otbTrainVectorClassifier.cxx
+2
-2
No files found.
Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h
View file @
1c38cb95
...
@@ -23,6 +23,16 @@
...
@@ -23,6 +23,16 @@
#include "otbConfigure.h"
#include "otbConfigure.h"
#include "itkMacro.h"
#include "itkMacro.h"
#if defined(_MSC_VER)
#pragma warning ( push )
#pragma warning ( disable: 4251 )
#include "ogr_core.h" // OGR enums
#pragma warning ( pop )
#else
#include "ogr_core.h" // OGR enums
#endif
#ifdef OTB_USE_GDAL_20
#ifdef OTB_USE_GDAL_20
class
GDALDataset
;
class
GDALDataset
;
class
GDALDriver
;
class
GDALDriver
;
...
@@ -40,6 +50,12 @@ namespace ogr
...
@@ -40,6 +50,12 @@ namespace ogr
namespace
version_proxy
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
* This namespace holds proxy functions hiding interface changes in gdal 2.0
*
*
...
...
Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx
View file @
1c38cb95
...
@@ -33,6 +33,12 @@ namespace ogr
...
@@ -33,6 +33,12 @@ namespace ogr
namespace
version_proxy
namespace
version_proxy
{
{
OTBGdalAdapters_EXPORT
bool
IsOFTInteger64
(
OGRFieldType
type
)
{
return
false
;
}
GDALDatasetType
*
Open
(
const
char
*
filename
,
bool
readOnly
)
GDALDatasetType
*
Open
(
const
char
*
filename
,
bool
readOnly
)
{
{
return
OGRSFDriverRegistrar
::
Open
(
filename
,
!
readOnly
);
return
OGRSFDriverRegistrar
::
Open
(
filename
,
!
readOnly
);
...
...
Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy2x.cxx
View file @
1c38cb95
...
@@ -34,6 +34,11 @@ namespace ogr
...
@@ -34,6 +34,11 @@ namespace ogr
namespace
version_proxy
namespace
version_proxy
{
{
OTBGdalAdapters_EXPORT
bool
IsOFTInteger64
(
OGRFieldType
type
)
{
return
type
==
OFTInteger64
;
}
GDALDatasetType
*
Open
(
const
char
*
filename
,
bool
readOnly
)
GDALDatasetType
*
Open
(
const
char
*
filename
,
bool
readOnly
)
{
{
return
(
GDALDatasetType
*
)
GDALOpenEx
(
filename
,
(
readOnly
?
GDAL_OF_READONLY
:
GDAL_OF_UPDATE
)
|
GDAL_OF_VECTOR
,
NULL
,
NULL
,
NULL
);
return
(
GDALDatasetType
*
)
GDALOpenEx
(
filename
,
(
readOnly
?
GDAL_OF_READONLY
:
GDAL_OF_UPDATE
)
|
GDAL_OF_VECTOR
,
NULL
,
NULL
,
NULL
);
...
...
Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx
View file @
1c38cb95
...
@@ -140,7 +140,7 @@ private:
...
@@ -140,7 +140,7 @@ private:
OGRFieldType
fieldType
=
feature
.
ogr
().
GetFieldDefnRef
(
iField
)
->
GetType
();
OGRFieldType
fieldType
=
feature
.
ogr
().
GetFieldDefnRef
(
iField
)
->
GetType
();
if
(
fieldType
==
OFTInteger
||
fieldType
==
OFTInteger64
)
if
(
fieldType
==
OFTInteger
||
ogr
::
version_proxy
::
IsOFTInteger64
(
fieldType
)
)
{
{
std
::
string
tmpKey
=
"field."
+
key
.
substr
(
0
,
end
-
key
.
begin
());
std
::
string
tmpKey
=
"field."
+
key
.
substr
(
0
,
end
-
key
.
begin
());
AddChoice
(
tmpKey
,
item
);
AddChoice
(
tmpKey
,
item
);
...
...
Modules/Applications/AppClassification/app/otbSampleExtraction.cxx
View file @
1c38cb95
...
@@ -135,7 +135,7 @@ private:
...
@@ -135,7 +135,7 @@ private:
OGRFieldType
fieldType
=
feature
.
ogr
().
GetFieldDefnRef
(
iField
)
->
GetType
();
OGRFieldType
fieldType
=
feature
.
ogr
().
GetFieldDefnRef
(
iField
)
->
GetType
();
if
(
fieldType
==
OFTInteger
||
fieldType
==
OFTInteger64
)
if
(
fieldType
==
OFTInteger
||
fieldType
==
ogr
::
version_proxy
::
IsOFTInteger64
(
fieldType
)
)
{
{
std
::
string
tmpKey
=
"field."
+
key
.
substr
(
0
,
end
-
key
.
begin
());
std
::
string
tmpKey
=
"field."
+
key
.
substr
(
0
,
end
-
key
.
begin
());
AddChoice
(
tmpKey
,
item
);
AddChoice
(
tmpKey
,
item
);
...
...
Modules/Applications/AppClassification/app/otbSampleSelection.cxx
View file @
1c38cb95
...
@@ -242,7 +242,7 @@ private:
...
@@ -242,7 +242,7 @@ private:
OGRFieldType
fieldType
=
feature
.
ogr
().
GetFieldDefnRef
(
iField
)
->
GetType
();
OGRFieldType
fieldType
=
feature
.
ogr
().
GetFieldDefnRef
(
iField
)
->
GetType
();
if
(
fieldType
==
OFTInteger
||
fieldType
==
OFTInteger64
)
if
(
fieldType
==
OFTInteger
||
ogr
::
version_proxy
::
IsOFTInteger64
(
fieldType
)
)
{
{
std
::
string
tmpKey
=
"field."
+
key
.
substr
(
0
,
end
-
key
.
begin
());
std
::
string
tmpKey
=
"field."
+
key
.
substr
(
0
,
end
-
key
.
begin
());
AddChoice
(
tmpKey
,
item
);
AddChoice
(
tmpKey
,
item
);
...
...
Modules/Applications/AppClassification/app/otbTrainVectorClassifier.cxx
View file @
1c38cb95
...
@@ -166,12 +166,12 @@ private:
...
@@ -166,12 +166,12 @@ private:
OGRFieldType
fieldType
=
feature
.
ogr
().
GetFieldDefnRef
(
iField
)
->
GetType
();
OGRFieldType
fieldType
=
feature
.
ogr
().
GetFieldDefnRef
(
iField
)
->
GetType
();
if
(
fieldType
==
OFTInteger
||
fieldType
==
OFTInteger64
||
fieldType
==
OFTReal
)
if
(
fieldType
==
OFTInteger
||
ogr
::
version_proxy
::
IsOFTInteger64
(
fieldType
)
||
fieldType
==
OFTReal
)
{
{
std
::
string
tmpKey
=
"feat."
+
key
.
substr
(
0
,
end
-
key
.
begin
());
std
::
string
tmpKey
=
"feat."
+
key
.
substr
(
0
,
end
-
key
.
begin
());
AddChoice
(
tmpKey
,
item
);
AddChoice
(
tmpKey
,
item
);
}
}
if
(
fieldType
==
OFTInteger
||
fieldType
==
OFTInteger64
)
if
(
fieldType
==
OFTInteger
||
ogr
::
version_proxy
::
IsOFTInteger64
(
fieldType
)
)
{
{
std
::
string
tmpKey
=
"cfield."
+
key
.
substr
(
0
,
end
-
key
.
begin
());
std
::
string
tmpKey
=
"cfield."
+
key
.
substr
(
0
,
end
-
key
.
begin
());
AddChoice
(
tmpKey
,
item
);
AddChoice
(
tmpKey
,
item
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment