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
e26a057d
Commit
e26a057d
authored
15 years ago
by
Emmanuel Christophe
Browse files
Options
Downloads
Patches
Plain Diff
STYLE: remove tabs, fix indentation
parent
4ec87103
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Testing/Code/IO/otbImageKeywordlist.cxx
+71
-73
71 additions, 73 deletions
Testing/Code/IO/otbImageKeywordlist.cxx
with
71 additions
and
73 deletions
Testing/Code/IO/otbImageKeywordlist.cxx
+
71
−
73
View file @
e26a057d
...
...
@@ -30,13 +30,11 @@
#include
"projection/ossimProjectionFactoryRegistry.h"
#include
"ossim/ossimPluginProjectionFactory.h"
int
otbImageKeywordlist
(
int
argc
,
char
*
argv
[]
)
int
otbImageKeywordlist
(
int
argc
,
char
*
argv
[])
{
if
(
argc
!=
4
)
if
(
argc
!=
4
)
{
std
::
cout
<<
argv
[
0
]
<<
" <input filename> <output filename> <output filename2>"
<<
std
::
endl
;
std
::
cout
<<
argv
[
0
]
<<
" <input filename> <output filename> <output filename2>"
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
...
...
@@ -55,77 +53,77 @@ int otbImageKeywordlist( int argc, char* argv[] )
bool
hasMetaData
=
false
;
ossimKeywordlist
geom_kwl
,
geom_kwl2
,
geom_kwl3
;
/** Don't use FactoryRegistry because of its default factory that can be conflicted
with plug
o
ns factor (cf. TSX .tif image read as QB)*/
/** Don't use FactoryRegistry because of its default factory that can conflict
*
with plug
i
ns factor (cf. TSX .tif image read as QB)*/
// test ossim plugin factory
ossimProjection
*
projection
=
ossimplugins
::
ossimPluginProjectionFactory
::
instance
()
->
createProjection
(
ossimFilename
(
filename
),
0
);
ossimProjection
*
projection
=
ossimplugins
::
ossimPluginProjectionFactory
::
instance
()
->
createProjection
(
ossimFilename
(
filename
),
0
);
// if ossim plugins factory failed, then test ossim factory
if
(
!
projection
)
if
(
!
projection
)
{
projection
=
ossimProjectionFactoryRegistry
::
instance
()
->
createProjection
(
ossimFilename
(
filename
),
0
);
if
(
!
projection
)
{
projection
=
ossimProjectionFactoryRegistry
::
instance
()
->
createProjection
(
ossimFilename
(
filename
),
0
);
if
(
!
projection
)
{
itkGenericExceptionMacro
(
<<
"OSSIM Instanciate projection FAILED ! "
);
return
EXIT_FAILURE
;
}
itkGenericExceptionMacro
(
<<
"OSSIM Instanciate projection FAILED ! "
);
return
EXIT_FAILURE
;
}
}
hasMetaData
=
projection
->
saveState
(
geom_kwl
);
otb
::
ImageKeywordlist
otb_kwl
;
otb_kwl
.
SetKeywordlist
(
geom_kwl
);
otb_kwl
.
convertToOSSIMKeywordlist
(
geom_kwl2
);
hasMetaData
=
projection
->
loadState
(
geom_kwl2
);
hasMetaData
=
projection
->
saveState
(
geom_kwl3
);
otb
::
ImageKeywordlist
otb_kwl2
;
otb_kwl2
.
SetKeywordlist
(
geom_kwl3
);
file
<<
"*** KEYWORD LIST ***
\n
"
;
file
<<
otb_kwl
;
file2
<<
"*** KEYWORD LIST ***
\n
"
;
file2
<<
otb_kwl2
;
/** Search keyword in meter_per_pixel to truncate precision */
ossimString
s
;
double
valueX
,
valueY
;
otb_kwl
.
convertToOSSIMKeywordlist
(
geom_kwl2
);
file
<<
std
::
fixed
<<
std
::
setprecision
(
5
);
file2
<<
std
::
fixed
<<
std
::
setprecision
(
5
);
s
=
geom_kwl2
.
find
(
"meters_per_pixel_x"
);
if
(
s
!=
""
)
{
valueX
=
s
.
toDouble
();
file
<<
"truncate_meter_per_pixel_x "
<<
valueX
<<
std
::
endl
;
}
s
=
geom_kwl2
.
find
(
"meters_per_pixel_y"
);
if
(
s
!=
""
)
{
valueY
=
s
.
toDouble
();
file
<<
"truncate_meter_per_pixel_y "
<<
valueY
<<
std
::
endl
;
}
otb_kwl2
.
convertToOSSIMKeywordlist
(
geom_kwl3
);
s
=
geom_kwl3
.
find
(
"meters_per_pixel_x"
);
if
(
s
!=
""
)
{
valueX
=
s
.
toDouble
();
file2
<<
"truncate_meter_per_pixel_x "
<<
valueX
<<
std
::
endl
;
}
s
=
geom_kwl3
.
find
(
"meters_per_pixel_y"
);
if
(
s
!=
""
)
{
valueY
=
s
.
toDouble
();
file2
<<
"truncate_meter_per_pixel_y "
<<
valueY
<<
std
::
endl
;
}
file
.
close
();
file2
.
close
();
return
EXIT_SUCCESS
;
}
hasMetaData
=
projection
->
saveState
(
geom_kwl
);
otb
::
ImageKeywordlist
otb_kwl
;
otb_kwl
.
SetKeywordlist
(
geom_kwl
);
otb_kwl
.
convertToOSSIMKeywordlist
(
geom_kwl2
);
hasMetaData
=
projection
->
loadState
(
geom_kwl2
);
hasMetaData
=
projection
->
saveState
(
geom_kwl3
);
otb
::
ImageKeywordlist
otb_kwl2
;
otb_kwl2
.
SetKeywordlist
(
geom_kwl3
);
file
<<
"*** KEYWORD LIST ***
\n
"
;
file
<<
otb_kwl
;
file2
<<
"*** KEYWORD LIST ***
\n
"
;
file2
<<
otb_kwl2
;
/** Search keyword in meter_per_pixel to truncate precision */
ossimString
s
;
double
valueX
,
valueY
;
otb_kwl
.
convertToOSSIMKeywordlist
(
geom_kwl2
);
file
<<
std
::
fixed
<<
std
::
setprecision
(
5
);
file2
<<
std
::
fixed
<<
std
::
setprecision
(
5
);
s
=
geom_kwl2
.
find
(
"meters_per_pixel_x"
);
if
(
s
!=
""
)
{
valueX
=
s
.
toDouble
();
file
<<
"truncate_meter_per_pixel_x "
<<
valueX
<<
std
::
endl
;
}
s
=
geom_kwl2
.
find
(
"meters_per_pixel_y"
);
if
(
s
!=
""
)
{
valueY
=
s
.
toDouble
();
file
<<
"truncate_meter_per_pixel_y "
<<
valueY
<<
std
::
endl
;
}
otb_kwl2
.
convertToOSSIMKeywordlist
(
geom_kwl3
);
s
=
geom_kwl3
.
find
(
"meters_per_pixel_x"
);
if
(
s
!=
""
)
{
valueX
=
s
.
toDouble
();
file2
<<
"truncate_meter_per_pixel_x "
<<
valueX
<<
std
::
endl
;
}
s
=
geom_kwl3
.
find
(
"meters_per_pixel_y"
);
if
(
s
!=
""
)
{
valueY
=
s
.
toDouble
();
file2
<<
"truncate_meter_per_pixel_y "
<<
valueY
<<
std
::
endl
;
}
file
.
close
();
file2
.
close
();
return
EXIT_SUCCESS
;
}
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