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
5d29e045
Commit
5d29e045
authored
13 years ago
by
Otmane Lahlou
Browse files
Options
Downloads
Patches
Plain Diff
ENH: use geoid file only when dem is set
parent
c847d0bb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/ApplicationEngine/otbWrapperElevationParametersHandler.cxx
+37
-22
37 additions, 22 deletions
...pplicationEngine/otbWrapperElevationParametersHandler.cxx
Code/ApplicationEngine/otbWrapperElevationParametersHandler.h
+1
-0
1 addition, 0 deletions
.../ApplicationEngine/otbWrapperElevationParametersHandler.h
with
38 additions
and
22 deletions
Code/ApplicationEngine/otbWrapperElevationParametersHandler.cxx
+
37
−
22
View file @
5d29e045
...
...
@@ -33,12 +33,20 @@ void ElevationParametersHandler::AddElevationParameters(Application::Pointer app
std
::
ostringstream
oss
;
oss
<<
key
<<
".dem"
;
app
->
AddChoice
(
oss
.
str
(),
"DEM directory"
);
oss
<<
".
value
"
;
oss
<<
".
path
"
;
app
->
AddParameter
(
ParameterType_Directory
,
oss
.
str
(),
"DEM directory"
);
app
->
SetParameterDescription
(
oss
.
str
(),
"This parameter allows to select a directory containing Digital Elevation Model tiles"
);
app
->
SetParameterString
(
oss
.
str
(),
otb
::
ConfigurationFile
::
GetInstance
()
->
GetDEMDirectory
());
// Geoid file
oss
.
str
(
""
);
oss
<<
key
<<
".dem.geoid"
;
app
->
AddParameter
(
ParameterType_Filename
,
oss
.
str
(),
"Geoid File"
);
app
->
SetParameterDescription
(
oss
.
str
(),
"Use a geoid grid to get the height above the ellipsoid used"
);
app
->
SetParameterString
(
oss
.
str
(),
otb
::
ConfigurationFile
::
GetInstance
()
->
GetGeoidFile
());
app
->
MandatoryOff
(
oss
.
str
());
// Average elevation
oss
.
str
(
""
);
oss
<<
key
<<
".average"
;
...
...
@@ -48,21 +56,12 @@ void ElevationParametersHandler::AddElevationParameters(Application::Pointer app
app
->
SetParameterDescription
(
oss
.
str
(),
"This parameter allows to pick up an average elevation for all the points of the image."
);
app
->
SetDefaultParameterFloat
(
oss
.
str
(),
0.
);
// // TODO : not implemented yet
// // // Tiff image
// // oss << ".tiff";
// // app->AddChoice(oss.str(), "Tiff file");
// // app->AddParameter(ParameterType_InputImage, oss.str(), "Tiff file");
// // app->SetParameterDescription(oss.str(),"Tiff file used to get elevation for each location in the image");
// Geoid file
oss
.
str
(
""
);
oss
<<
key
<<
".geoid"
;
app
->
AddChoice
(
oss
.
str
(),
"Geoid file"
);
oss
<<
".value"
;
app
->
AddParameter
(
ParameterType_Filename
,
oss
.
str
(),
"Geoid File"
);
app
->
SetParameterDescription
(
oss
.
str
(),
"Use a geoid grid to get the height above the ellipsoid used"
);
app
->
SetParameterString
(
oss
.
str
(),
otb
::
ConfigurationFile
::
GetInstance
()
->
GetGeoidFile
());
// TODO : not implemented yet
// // Tiff image
// oss << ".tiff";
// app->AddChoice(oss.str(), "Tiff file");
// app->AddParameter(ParameterType_InputImage, oss.str(), "Tiff file");
// app->SetParameterDescription(oss.str(),"Tiff file used to get elevation for each location in the image");
// Set the default value
app
->
SetParameterString
(
key
,
"average"
);
...
...
@@ -77,7 +76,7 @@ const std::string
ElevationParametersHandler
::
GetDEMDirectory
(
const
Application
::
Pointer
app
,
const
std
::
string
&
key
)
{
std
::
ostringstream
oss
;
oss
<<
key
<<
".dem.
value
"
;
oss
<<
key
<<
".dem.
path
"
;
return
app
->
GetParameterString
(
oss
.
str
());
}
...
...
@@ -100,8 +99,13 @@ const std::string
ElevationParametersHandler
::
GetGeoidFile
(
const
Application
::
Pointer
app
,
const
std
::
string
&
key
)
{
std
::
ostringstream
oss
;
oss
<<
key
<<
".geoid.value"
;
return
app
->
GetParameterString
(
oss
.
str
());
oss
<<
key
<<
".dem.geoid"
;
if
(
IsGeoidUsed
(
app
,
key
))
{
return
app
->
GetParameterString
(
oss
.
str
());
}
return
""
;
}
/**
...
...
@@ -122,11 +126,22 @@ ElevationParametersHandler::GetElevationType(const Application::Pointer app, con
// case Elevation_Tiff:
// return Eleavation_Tiff;
// break;
case
Elevation_Geoid
:
return
Elevation_Geoid
;
break
;
}
}
/**
*
* Is Geoid used
*/
bool
ElevationParametersHandler
::
IsGeoidUsed
(
const
Application
::
Pointer
app
,
const
std
::
string
&
key
)
{
std
::
ostringstream
geoidKey
;
geoidKey
<<
key
<<
"dem.geoid"
;
return
app
->
IsParameterEnabled
(
geoidKey
.
str
())
&&
app
->
HasValue
(
geoidKey
.
str
());
}
}
// End namespace Wrapper
}
// End namespace otb
This diff is collapsed.
Click to expand it.
Code/ApplicationEngine/otbWrapperElevationParametersHandler.h
+
1
−
0
View file @
5d29e045
...
...
@@ -58,6 +58,7 @@ public:
static
const
std
::
string
GetDEMDirectory
(
const
Application
::
Pointer
app
,
const
std
::
string
&
key
);
static
float
GetAverageElevation
(
const
Application
::
Pointer
app
,
const
std
::
string
&
key
);
static
const
std
::
string
GetGeoidFile
(
const
Application
::
Pointer
app
,
const
std
::
string
&
key
);
static
bool
IsGeoidUsed
(
const
Application
::
Pointer
app
,
const
std
::
string
&
key
);
protected:
ElevationParametersHandler
();
// not implemented
...
...
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