| 279 | /************************************************************************/ |
| 280 | |
| 281 | GDALRasterBlendAlgorithm::GDALRasterBlendAlgorithm(bool standaloneStep) |
| 282 | : GDALRasterPipelineStepAlgorithm( |
| 283 | NAME, DESCRIPTION, HELP_URL, |
| 284 | ConstructorOptions() |
| 285 | .SetStandaloneStep(standaloneStep) |
| 286 | .SetAddDefaultArguments(false) |
| 287 | .SetInputDatasetHelpMsg(_("Input raster dataset")) |
| 288 | .SetInputDatasetAlias("color-input") |
| 289 | .SetInputDatasetMetaVar("COLOR-INPUT") |
| 290 | .SetOutputDatasetHelpMsg(_("Output raster dataset"))) |
| 291 | { |
| 292 | const auto AddOverlayDatasetArg = [this]() |
| 293 | { |
| 294 | auto &arg = AddArg("overlay", 0, _("Overlay dataset"), |
| 295 | &m_overlayDataset, GDAL_OF_RASTER) |
| 296 | .SetPositional() |
| 297 | .SetRequired(); |
| 298 | |
| 299 | SetAutoCompleteFunctionForFilename(arg, GDAL_OF_RASTER); |
| 300 | }; |
| 301 | |
| 302 | if (standaloneStep) |
| 303 | { |
| 304 | AddRasterInputArgs(false, false); |
| 305 | AddOverlayDatasetArg(); |
| 306 | AddProgressArg(); |
| 307 | AddRasterOutputArgs(false); |
| 308 | } |
| 309 | else |
| 310 | { |
| 311 | AddRasterHiddenInputDatasetArg(); |
| 312 | AddOverlayDatasetArg(); |
| 313 | } |
| 314 | |
| 315 | const std::vector<std::string> compositionModeChoices{ |
| 316 | CompositionModesIdentifiers()}; |
| 317 | AddArg("operator", 0, _("Composition operator"), &m_operatorIdentifier) |
| 318 | .SetChoices(compositionModeChoices) |
| 319 | .SetDefault(CompositionModeToString(CompositionMode::SRC_OVER)) |
| 320 | .AddAction( |
| 321 | [this]() |
| 322 | { m_operator = CompositionModeFromString(m_operatorIdentifier); }); |
| 323 | |
| 324 | AddArg("opacity", 0, |
| 325 | _("Opacity percentage to apply to the overlay dataset (0=fully " |
| 326 | "transparent, 100=full use of overlay opacity)"), |
| 327 | &m_opacity) |
| 328 | .SetDefault(m_opacity) |
| 329 | .SetMinValueIncluded(0) |
| 330 | .SetMaxValueIncluded(OPACITY_INPUT_RANGE); |
| 331 | |
| 332 | AddValidationAction([this]() { return ValidateGlobal(); }); |
| 333 | } |
| 334 | |
| 335 | namespace |
| 336 | { |
nothing calls this directly
no test coverage detected