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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
David Youssefi
otb
Commits
ca153c0f
Commit
ca153c0f
authored
12 years ago
by
Aurélien Bricier
Browse files
Options
Downloads
Patches
Plain Diff
ENH: added class for writer option support
parent
1f5ced44
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/IO/otbExtendedFilenameToWriterOptions.cxx
+127
-0
127 additions, 0 deletions
Code/IO/otbExtendedFilenameToWriterOptions.cxx
Code/IO/otbExtendedFilenameToWriterOptions.h
+88
-0
88 additions, 0 deletions
Code/IO/otbExtendedFilenameToWriterOptions.h
with
215 additions
and
0 deletions
Code/IO/otbExtendedFilenameToWriterOptions.cxx
0 → 100644
+
127
−
0
View file @
ca153c0f
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include
"otbExtendedFilenameToWriterOptions.h"
#include
<boost/algorithm/string.hpp>
namespace
otb
{
ExtendedFilenameToWriterOptions
::
ExtendedFilenameToWriterOptions
()
:
itk
::
Object
()
{
m_FilenameHelper
=
FNameHelperType
::
New
();
m_Options
.
simpleFileName
.
first
=
false
;
m_Options
.
simpleFileName
.
second
=
""
;
m_Options
.
writeGEOMFile
.
first
=
false
;
m_Options
.
writeGEOMFile
.
second
=
false
;
m_Options
.
gdalCreationOptions
.
first
=
false
;
m_Options
.
nbSetOptions
=
0
;
}
void
ExtendedFilenameToWriterOptions
::
SetExtendedFileName
(
const
char
*
extFname
)
{
this
->
m_FilenameHelper
->
SetExtendedFileName
(
extFname
);
MapType
map
=
this
->
m_FilenameHelper
->
GetOptionMap
();
unsigned
int
nbOpts
=
map
.
size
();
m_Options
.
simpleFileName
.
first
=
true
;
m_Options
.
simpleFileName
.
second
=
this
->
m_FilenameHelper
->
GetSimpleFileName
();
if
(
!
map
[
"writegeom"
].
empty
())
{
m_Options
.
writeGEOMFile
.
first
=
true
;
m_Options
.
nbSetOptions
++
;
if
(
map
[
"writegeom"
]
==
"On"
||
map
[
"writegeom"
]
==
"on"
||
map
[
"writegeom"
]
==
"ON"
||
map
[
"writegeom"
]
==
"true"
||
map
[
"writegeom"
]
==
"True"
||
map
[
"writegeom"
]
==
"1"
)
{
m_Options
.
writeGEOMFile
.
second
=
true
;
}
}
MapIteratorType
it
;
for
(
it
=
map
.
begin
()
;
it
!=
map
.
end
();
it
++
)
{
std
::
vector
<
std
::
string
>
tmp
;
boost
::
split
(
tmp
,
it
->
first
,
boost
::
is_any_of
(
":"
),
boost
::
token_compress_on
);
if
(
tmp
.
size
()
>
2
)
if
((
tmp
[
0
]
==
"gdal"
)
&&
(
tmp
[
1
]
==
"co"
))
{
m_Options
.
gdalCreationOptions
.
first
=
true
;
m_Options
.
gdalCreationOptions
.
second
.
push_back
(
tmp
[
2
]
+
"="
+
it
->
second
);
m_Options
.
nbSetOptions
++
;
}
}
if
(
m_Options
.
nbSetOptions
<
nbOpts
)
{
itkWarningMacro
(
"Some unknown reader options have been detected"
)
}
}
bool
ExtendedFilenameToWriterOptions
::
SimpleFileNameIsSet
()
const
{
return
m_Options
.
simpleFileName
.
first
;
}
const
char
*
ExtendedFilenameToWriterOptions
::
GetSimpleFileName
()
const
{
return
m_Options
.
simpleFileName
.
second
.
c_str
();
}
bool
ExtendedFilenameToWriterOptions
::
WriteGEOMFileIsSet
()
const
{
return
m_Options
.
writeGEOMFile
.
first
;
}
bool
ExtendedFilenameToWriterOptions
::
GetWriteGEOMFile
()
const
{
return
m_Options
.
writeGEOMFile
.
second
;
}
bool
ExtendedFilenameToWriterOptions
::
gdalCreationOptionsIsSet
()
const
{
return
m_Options
.
gdalCreationOptions
.
first
;
}
ExtendedFilenameToWriterOptions
::
GDALCOType
ExtendedFilenameToWriterOptions
::
GetgdalCreationOptions
()
const
{
return
m_Options
.
gdalCreationOptions
.
second
;
}
}
// end namespace otb
This diff is collapsed.
Click to expand it.
Code/IO/otbExtendedFilenameToWriterOptions.h
0 → 100644
+
88
−
0
View file @
ca153c0f
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __otbExtendedFilenameToWriterOptions_h
#define __otbExtendedFilenameToWriterOptions_h
#include
"itkObject.h"
#include
"otbExtendedFilenameHelper.h"
#include
"otbGDALImageIO.h"
namespace
otb
{
/** \class ExtendedFilenameToWriterOptions
* \brief Converts an extended filename to writer options.
*
* Available options for extended file name are:
* - &geomwrite : to specify an external geom file
* - &gdal:co:<KEY> : sub-dataset index for composite files
*
* \sa ImageFileWriter
*/
class
ITK_EXPORT
ExtendedFilenameToWriterOptions
:
public
itk
::
Object
{
public:
/** Standard class typedefs. */
typedef
ExtendedFilenameToWriterOptions
Self
;
typedef
itk
::
SmartPointer
<
Self
>
Pointer
;
typedef
itk
::
SmartPointer
<
const
Self
>
ConstPointer
;
typedef
itk
::
Object
Superclass
;
itkTypeMacro
(
ExtendedFilenameToWriterOptions
,
itk
::
Object
);
itkNewMacro
(
Self
);
typedef
ExtendedFilenameHelper
FNameHelperType
;
typedef
FNameHelperType
::
OptionMapType
MapType
;
typedef
MapType
::
iterator
MapIteratorType
;
/** The writer option structure. */
typedef
GDALImageIO
::
GDALCreationOptionsType
GDALCOType
;
struct
OptionType
{
std
::
pair
<
bool
,
std
::
string
>
simpleFileName
;
std
::
pair
<
bool
,
bool
>
writeGEOMFile
;
std
::
pair
<
bool
,
GDALCOType
>
gdalCreationOptions
;
unsigned
int
nbSetOptions
;
};
/* Set Methods */
void
SetExtendedFileName
(
const
char
*
extFname
);
/* Get Methods */
bool
SimpleFileNameIsSet
()
const
;
const
char
*
GetSimpleFileName
()
const
;
bool
WriteGEOMFileIsSet
()
const
;
bool
GetWriteGEOMFile
()
const
;
bool
gdalCreationOptionsIsSet
()
const
;
GDALCOType
GetgdalCreationOptions
()
const
;
protected
:
ExtendedFilenameToWriterOptions
();
virtual
~
ExtendedFilenameToWriterOptions
()
{}
private
:
ExtendedFilenameToWriterOptions
(
const
Self
&
);
//purposely not implemented
void
operator
=
(
const
Self
&
);
//purposely not implemented
FNameHelperType
::
Pointer
m_FilenameHelper
;
OptionType
m_Options
;
};
}
// end namespace otb
#endif // __otbExtendedFilenameToWriterOptions_h
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