| 880 | /************************************************************************/ |
| 881 | |
| 882 | GDALRasterCalcAlgorithm::GDALRasterCalcAlgorithm(bool standaloneStep) noexcept |
| 883 | : GDALRasterPipelineStepAlgorithm(NAME, DESCRIPTION, HELP_URL, |
| 884 | ConstructorOptions() |
| 885 | .SetStandaloneStep(standaloneStep) |
| 886 | .SetAddDefaultArguments(false) |
| 887 | .SetAutoOpenInputDatasets(false) |
| 888 | .SetInputDatasetInputFlags(GADV_NAME) |
| 889 | .SetInputDatasetMetaVar("INPUTS") |
| 890 | .SetInputDatasetMaxCount(INT_MAX)) |
| 891 | { |
| 892 | AddRasterInputArgs(false, false); |
| 893 | if (standaloneStep) |
| 894 | { |
| 895 | AddProgressArg(); |
| 896 | AddRasterOutputArgs(false); |
| 897 | } |
| 898 | |
| 899 | AddOutputDataTypeArg(&m_type); |
| 900 | |
| 901 | AddArg("no-check-crs", 0, |
| 902 | _("Do not check consistency of input coordinate reference systems"), |
| 903 | &m_noCheckCRS) |
| 904 | .AddHiddenAlias("no-check-srs"); |
| 905 | AddArg("no-check-extent", 0, _("Do not check consistency of input extents"), |
| 906 | &m_noCheckExtent); |
| 907 | |
| 908 | AddArg("propagate-nodata", 0, |
| 909 | _("Whether to set pixels to the output NoData value if any of the " |
| 910 | "input pixels is NoData"), |
| 911 | &m_propagateNoData); |
| 912 | |
| 913 | AddArg("calc", 0, _("Expression(s) to evaluate"), &m_expr) |
| 914 | .SetRequired() |
| 915 | .SetPackedValuesAllowed(false) |
| 916 | .SetMinCount(1) |
| 917 | .SetAutoCompleteFunction( |
| 918 | [this](const std::string ¤tValue) |
| 919 | { |
| 920 | std::vector<std::string> ret; |
| 921 | if (m_dialect == "builtin") |
| 922 | { |
| 923 | if (currentValue.find('(') == std::string::npos) |
| 924 | return VRTDerivedRasterBand::GetPixelFunctionNames(); |
| 925 | } |
| 926 | return ret; |
| 927 | }); |
| 928 | |
| 929 | AddArg("dialect", 0, _("Expression dialect"), &m_dialect) |
| 930 | .SetDefault(m_dialect) |
| 931 | .SetChoices("muparser", "builtin"); |
| 932 | |
| 933 | AddArg("flatten", 0, |
| 934 | _("Generate a single band output raster per expression, even if " |
| 935 | "input datasets are multiband"), |
| 936 | &m_flatten); |
| 937 | |
| 938 | AddNodataArg(&m_nodata, true); |
| 939 |
nothing calls this directly
no test coverage detected