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
9a2b5bfe
Commit
9a2b5bfe
authored
12 years ago
by
Aurélien Bricier
Browse files
Options
Downloads
Patches
Plain Diff
ENH: encapsulated the extended filename interpretation inside a class dedicated to the reading part
parent
30bd858c
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/otbExtendedFilenameToReaderOptions.cxx
+164
-0
164 additions, 0 deletions
Code/IO/otbExtendedFilenameToReaderOptions.cxx
Code/IO/otbExtendedFilenameToReaderOptions.h
+87
-0
87 additions, 0 deletions
Code/IO/otbExtendedFilenameToReaderOptions.h
with
251 additions
and
0 deletions
Code/IO/otbExtendedFilenameToReaderOptions.cxx
0 → 100644
+
164
−
0
View file @
9a2b5bfe
/*=========================================================================
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
"otbExtendedFilenameToReaderOptions.h"
namespace
otb
{
ExtendedFilenameToReaderOptions
::
ExtendedFilenameToReaderOptions
()
:
itk
::
Object
()
{
m_FilenameHelper
=
FNameHelperType
::
New
();
m_Options
.
simpleFileName
.
first
=
false
;
m_Options
.
simpleFileName
.
second
=
""
;
m_Options
.
extGEOMFileName
.
first
=
false
;
m_Options
.
extGEOMFileName
.
second
=
""
;
m_Options
.
subDatasetIndex
.
first
=
false
;
m_Options
.
subDatasetIndex
.
second
=
0
;
m_Options
.
resolutionFactor
.
first
=
false
;
m_Options
.
resolutionFactor
.
second
=
0
;
m_Options
.
skipCarto
.
first
=
false
;
m_Options
.
skipCarto
.
second
=
false
;
m_Options
.
nbSetOptions
=
0
;
std
::
cout
<<
"Done"
<<
std
::
endl
;
}
void
ExtendedFilenameToReaderOptions
::
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
[
"geom"
].
empty
())
{
m_Options
.
extGEOMFileName
.
first
=
true
;
m_Options
.
extGEOMFileName
.
second
=
map
[
"geom"
];
m_Options
.
nbSetOptions
++
;
}
if
(
!
map
[
"sdataidx"
].
empty
())
{
m_Options
.
subDatasetIndex
.
first
=
true
;
m_Options
.
subDatasetIndex
.
second
=
atoi
(
map
[
"sdataidx"
].
c_str
());
m_Options
.
nbSetOptions
++
;
}
if
(
!
map
[
"resol"
].
empty
())
{
m_Options
.
resolutionFactor
.
first
=
true
;
m_Options
.
resolutionFactor
.
second
=
atoi
(
map
[
"resol"
].
c_str
());
m_Options
.
nbSetOptions
++
;
}
if
(
!
map
[
"skipcarto"
].
empty
())
{
m_Options
.
skipCarto
.
first
=
true
;
m_Options
.
nbSetOptions
++
;
if
(
map
[
"skipcarto"
]
==
"On"
||
map
[
"skipcarto"
]
==
"on"
||
map
[
"skipcarto"
]
==
"True"
||
map
[
"skipcarto"
]
==
"true"
||
map
[
"skipcarto"
]
==
"True"
||
map
[
"skipcarto"
]
==
"1"
)
{
m_Options
.
skipCarto
.
second
=
true
;
}
}
if
(
m_Options
.
nbSetOptions
<
nbOpts
)
{
itkWarningMacro
(
"Some unknown reader options have been detected"
)
}
}
bool
ExtendedFilenameToReaderOptions
::
SimpleFileNameIsSet
()
const
{
return
m_Options
.
simpleFileName
.
first
;
}
const
char
*
ExtendedFilenameToReaderOptions
::
GetSimpleFileName
()
const
{
return
m_Options
.
simpleFileName
.
second
.
c_str
();
}
bool
ExtendedFilenameToReaderOptions
::
ExtGEOMFileNameIsSet
()
const
{
return
m_Options
.
extGEOMFileName
.
first
;
}
const
char
*
ExtendedFilenameToReaderOptions
::
GetExtGEOMFileName
()
const
{
return
m_Options
.
extGEOMFileName
.
second
.
c_str
();
}
bool
ExtendedFilenameToReaderOptions
::
SubDatasetIndexIsSet
()
const
{
return
m_Options
.
subDatasetIndex
.
first
;
}
unsigned
int
ExtendedFilenameToReaderOptions
::
GetSubDatasetIndex
()
const
{
return
m_Options
.
subDatasetIndex
.
second
;
}
bool
ExtendedFilenameToReaderOptions
::
ResolutionFactorIsSet
()
const
{
return
m_Options
.
resolutionFactor
.
first
;
}
unsigned
int
ExtendedFilenameToReaderOptions
::
GetResolutionFactor
()
const
{
return
m_Options
.
resolutionFactor
.
second
;
}
bool
ExtendedFilenameToReaderOptions
::
SkipCartoIsSet
()
const
{
return
m_Options
.
skipCarto
.
first
;
}
bool
ExtendedFilenameToReaderOptions
::
GetSkipCarto
()
const
{
return
m_Options
.
skipCarto
.
second
;
}
}
// end namespace otb
This diff is collapsed.
Click to expand it.
Code/IO/otbExtendedFilenameToReaderOptions.h
0 → 100644
+
87
−
0
View file @
9a2b5bfe
/*=========================================================================
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 __otbExtendedFilenameToReaderOptions_h
#define __otbExtendedFilenameToReaderOptions_h
#include
"itkObject.h"
#include
"otbExtendedFilenameHelper.h"
namespace
otb
{
/** \class ExtendedFilenameToReaderOptions
* \brief Converts an extended filename to reader options.
*
* \sa ImageFileReader
*/
class
ITK_EXPORT
ExtendedFilenameToReaderOptions
:
public
itk
::
Object
{
public:
/** Standard class typedefs. */
typedef
ExtendedFilenameToReaderOptions
Self
;
typedef
itk
::
SmartPointer
<
Self
>
Pointer
;
typedef
itk
::
SmartPointer
<
const
Self
>
ConstPointer
;
typedef
itk
::
Object
Superclass
;
itkTypeMacro
(
ExtendedFilenameToReaderOptions
,
itk
::
Object
);
itkNewMacro
(
Self
);
typedef
ExtendedFilenameHelper
FNameHelperType
;
typedef
FNameHelperType
::
OptionMapType
MapType
;
/** The reader option structure. */
struct
OptionType
{
std
::
pair
<
bool
,
std
::
string
>
simpleFileName
;
std
::
pair
<
bool
,
std
::
string
>
extGEOMFileName
;
std
::
pair
<
bool
,
unsigned
int
>
subDatasetIndex
;
std
::
pair
<
bool
,
unsigned
int
>
resolutionFactor
;
std
::
pair
<
bool
,
bool
>
skipCarto
;
unsigned
int
nbSetOptions
;
};
/* Set Methods */
void
SetExtendedFileName
(
const
char
*
extFname
);
/* Get Methods */
bool
SimpleFileNameIsSet
()
const
;
const
char
*
GetSimpleFileName
()
const
;
bool
ExtGEOMFileNameIsSet
()
const
;
const
char
*
GetExtGEOMFileName
()
const
;
bool
SubDatasetIndexIsSet
()
const
;
unsigned
int
GetSubDatasetIndex
()
const
;
bool
ResolutionFactorIsSet
()
const
;
unsigned
int
GetResolutionFactor
()
const
;
bool
SkipCartoIsSet
()
const
;
bool
GetSkipCarto
()
const
;
protected
:
ExtendedFilenameToReaderOptions
();
virtual
~
ExtendedFilenameToReaderOptions
()
{}
private
:
ExtendedFilenameToReaderOptions
(
const
Self
&
);
//purposely not implemented
void
operator
=
(
const
Self
&
);
//purposely not implemented
FNameHelperType
::
Pointer
m_FilenameHelper
;
OptionType
m_Options
;
};
}
// end namespace otb
#endif // __otbExtendedFilenameToReaderOptions_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