Skip to content

Commit

Permalink
gdal_viewshed, nearblack, ogr2ogr: call store_into() after default_va…
Browse files Browse the repository at this point in the history
…lue()

In practice this doesn't matter given that we already set the default
value in the bound variable of store_into(), but for clarity call first
default_value() given that store_into() currently depends on
default_value() being called first.
  • Loading branch information
rouault committed Apr 29, 2024
1 parent c73a153 commit 94c80fd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions apps/gdal_viewshed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,33 +81,33 @@ MAIN_START(argc, argv)

double dfObserverHeight = 2;
argParser.add_argument("-oz")
.store_into(dfObserverHeight)
.default_value(dfObserverHeight)
.store_into(dfObserverHeight)
.metavar("<value>")
.nargs(1)
.help(_("The height of the observer above the DEM surface in the "
"height unit of the DEM."));

double dfVisibleVal = 255;
argParser.add_argument("-vv")
.store_into(dfVisibleVal)
.default_value(dfVisibleVal)
.store_into(dfVisibleVal)
.metavar("<value>")
.nargs(1)
.help(_("Pixel value to set for visible areas."));

double dfInvisibleVal = 0.0;
argParser.add_argument("-iv")
.store_into(dfInvisibleVal)
.default_value(dfInvisibleVal)
.store_into(dfInvisibleVal)
.metavar("<value>")
.nargs(1)
.help(_("Pixel value to set for invisible areas."));

double dfOutOfRangeVal = 0.0;
argParser.add_argument("-ov")
.store_into(dfOutOfRangeVal)
.default_value(dfOutOfRangeVal)
.store_into(dfOutOfRangeVal)
.metavar("<value>")
.nargs(1)
.help(
Expand All @@ -128,17 +128,17 @@ MAIN_START(argc, argv)

double dfTargetHeight = 0.0;
argParser.add_argument("-tz")
.store_into(dfTargetHeight)
.default_value(dfTargetHeight)
.store_into(dfTargetHeight)
.metavar("<value>")
.nargs(1)
.help(_("The height of the target above the DEM surface in the height "
"unit of the DEM."));

double dfMaxDistance = 0.0;
argParser.add_argument("-md")
.store_into(dfMaxDistance)
.default_value(dfMaxDistance)
.store_into(dfMaxDistance)
.metavar("<value>")
.nargs(1)
.help(_("Maximum distance from observer to compute visibility."));
Expand All @@ -147,8 +147,8 @@ MAIN_START(argc, argv)
// doc/source/programs/gdal_viewshed.rst
double dfCurvCoeff = 0.85714;
argParser.add_argument("-cc")
.store_into(dfCurvCoeff)
.default_value(dfCurvCoeff)
.store_into(dfCurvCoeff)
.metavar("<value>")
.nargs(1)
.help(_("Coefficient to consider the effect of the curvature and "
Expand All @@ -164,11 +164,11 @@ MAIN_START(argc, argv)

std::string osOutputMode;
argParser.add_argument("-om")
.store_into(osOutputMode)
.choices("NORMAL", "DEM", "GROUND")
.metavar("NORMAL|DEM|GROUND")
.default_value("NORMAL")
.nargs(1)
.store_into(osOutputMode)
.help(_("Sets what information the output contains."));

bool bQuiet = false;
Expand Down
8 changes: 4 additions & 4 deletions apps/nearblack_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,17 +835,17 @@ GDALNearblackOptionsGetParser(GDALNearblackOptions *psOptions,
}

argParser->add_argument("-nb")
.store_into(psOptions->nMaxNonBlack)
.metavar("<non_black_pixels>")
.default_value(psOptions->nMaxNonBlack)
.nargs(1)
.default_value(psOptions->nMaxNonBlack)
.store_into(psOptions->nMaxNonBlack)
.help(_("Number of consecutive non-black pixels."));

argParser->add_argument("-near")
.store_into(psOptions->nNearDist)
.metavar("<dist>")
.default_value(psOptions->nNearDist)
.nargs(1)
.default_value(psOptions->nNearDist)
.store_into(psOptions->nNearDist)
.help(_("Select how far from black, white or custom colors the pixel "
"values can be and still considered."));

Expand Down
2 changes: 1 addition & 1 deletion apps/ogr2ogr_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7221,8 +7221,8 @@ static std::unique_ptr<GDALArgumentParser> GDALVectorTranslateOptionsGetParser(

argParser->add_argument("-datelineoffset")
.metavar("<val_in_degree>")
.store_into(psOptions->dfDateLineOffset)
.default_value(psOptions->dfDateLineOffset)
.store_into(psOptions->dfDateLineOffset)
.help(_("Offset from dateline in degrees."));

argParser->add_argument("-clipsrc")
Expand Down

0 comments on commit 94c80fd

Please sign in to comment.