Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main Repositories
otb
Commits
1eabd31e
Commit
1eabd31e
authored
7 years ago
by
Antoine Regimbeau
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Get rid of static member and use temporary FileNameHelper
parent
33179fa7
No related branches found
No related tags found
1 merge request
!24
Handle extended filename for DataSource class
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.h
+2
-3
2 additions, 3 deletions
...s/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.h
Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx
+13
-11
13 additions, 11 deletions
...les/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx
with
15 additions
and
14 deletions
Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.h
+
2
−
3
View file @
1eabd31e
...
...
@@ -513,7 +513,7 @@ protected:
/** Init constructor.
* \post The newly constructed object owns the \c source parameter.
*/
DataSource
(
ogr
::
version_proxy
::
GDALDatasetType
*
source
,
Modes
::
type
mode
);
DataSource
(
ogr
::
version_proxy
::
GDALDatasetType
*
source
,
Modes
::
type
mode
,
std
::
vector
<
std
::
string
>
layerOption
=
std
::
vector
<
std
::
string
>
()
);
/** Destructor.
* \post The \c GDALDataset owned is released (if not null).
*/
...
...
@@ -550,9 +550,8 @@ private:
std
::
string
GetDatasetDescription
()
const
;
private
:
static
FileNameHelperType
::
Pointer
staticFileNameHelper
;
ogr
::
version_proxy
::
GDALDatasetType
*
m_DataSource
;
FileNameHelperType
::
GDALOptionType
m_LayerOptions
;
std
::
vector
<
std
::
string
>
m_LayerOptions
;
Modes
::
type
m_OpenMode
;
int
m_FirstModifiableLayerID
;
};
// end class DataSource
...
...
This diff is collapsed.
Click to expand it.
Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx
+
13
−
11
View file @
1eabd31e
...
...
@@ -42,10 +42,6 @@
/*=======================[ construction/destruction ]========================*/
/*===========================================================================*/
otb
::
ogr
::
DataSource
::
FileNameHelperType
::
Pointer
otb
::
ogr
::
DataSource
::
staticFileNameHelper
=
otb
::
ogr
::
DataSource
::
FileNameHelperType
::
New
();
bool
otb
::
ogr
::
DataSource
::
Clear
()
{
Reset
(
ITK_NULLPTR
);
...
...
@@ -122,6 +118,7 @@ char const* DeduceDriverName(std::string filename)
otb
::
ogr
::
DataSource
::
DataSource
()
:
m_DataSource
(
ITK_NULLPTR
),
m_LayerOptions
()
,
m_OpenMode
(
Modes
::
Update_LayerUpdate
),
m_FirstModifiableLayerID
(
0
)
{
...
...
@@ -135,9 +132,13 @@ otb::ogr::DataSource::DataSource()
}
}
otb
::
ogr
::
DataSource
::
DataSource
(
otb
::
ogr
::
version_proxy
::
GDALDatasetType
*
source
,
Modes
::
type
mode
)
:
m_DataSource
(
source
),
m_OpenMode
(
mode
),
otb
::
ogr
::
DataSource
::
DataSource
(
otb
::
ogr
::
version_proxy
::
GDALDatasetType
*
source
,
Modes
::
type
mode
,
std
::
vector
<
std
::
string
>
options
/*NULL*/
)
:
m_DataSource
(
source
)
,
m_LayerOptions
(
options
)
,
m_OpenMode
(
mode
)
,
m_FirstModifiableLayerID
(
0
)
{
m_FirstModifiableLayerID
=
GetLayersCount
();
...
...
@@ -145,14 +146,15 @@ otb::ogr::DataSource::DataSource(otb::ogr::version_proxy::GDALDatasetType * sour
otb
::
ogr
::
DataSource
::
Pointer
otb
::
ogr
::
DataSource
::
OpenDataSource
(
std
::
string
const
&
datasourceName
,
Modes
::
type
mode
)
{
FileNameHelperType
::
Pointer
fileNameHelper
=
FileNameHelperType
::
New
();
bool
update
=
(
mode
!=
Modes
::
Read
);
staticF
ileNameHelper
->
SetExtendedFileName
(
datasourceName
.
c_str
()
);
f
ileNameHelper
->
SetExtendedFileName
(
datasourceName
.
c_str
()
);
std
::
string
simpleFileName
=
staticF
ileNameHelper
->
GetSimpleFileName
();
std
::
string
simpleFileName
=
f
ileNameHelper
->
GetSimpleFileName
();
ogr
::
version_proxy
::
GDALDatasetType
*
source
=
ogr
::
version_proxy
::
Open
(
simpleFileName
.
c_str
()
,
!
update
,
staticF
ileNameHelper
->
GetGDALOpenOptions
()
);
f
ileNameHelper
->
GetGDALOpenOptions
()
);
if
(
!
source
)
{
// In read mode, this is a failure
...
...
@@ -181,7 +183,7 @@ otb::ogr::DataSource::Pointer otb::ogr::DataSource::OpenDataSource(std::string c
source
=
ogr
::
version_proxy
::
Create
(
d
,
simpleFileName
.
c_str
()
,
staticF
ileNameHelper
->
GetGDALCreationOptions
()
);
f
ileNameHelper
->
GetGDALCreationOptions
()
);
if
(
!
source
)
{
itkGenericExceptionMacro
(
<<
"Failed to create GDALDataset <"
<<
datasourceName
<<
"> (driver name: <"
<<
driverName
<<
">: "
<<
CPLGetLastErrorMsg
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment