| 42 | /************************************************************************/ |
| 43 | |
| 44 | GDALRasterEditAlgorithm::GDALRasterEditAlgorithm(bool standaloneStep) |
| 45 | : GDALRasterPipelineStepAlgorithm( |
| 46 | NAME, DESCRIPTION, HELP_URL, |
| 47 | ConstructorOptions().SetAddDefaultArguments(false)) |
| 48 | { |
| 49 | if (standaloneStep) |
| 50 | { |
| 51 | AddProgressArg(); |
| 52 | |
| 53 | AddArg("dataset", 0, |
| 54 | _("Dataset (to be updated in-place, unless --auxiliary)"), |
| 55 | &m_dataset, GDAL_OF_RASTER | GDAL_OF_UPDATE) |
| 56 | .SetPositional() |
| 57 | .SetRequired() |
| 58 | .SetAvailableInPipelineStep(false); |
| 59 | AddOpenOptionsArg(&m_openOptions).SetAvailableInPipelineStep(false); |
| 60 | AddArg("auxiliary", 0, |
| 61 | _("Ask for an auxiliary .aux.xml file to be edited"), |
| 62 | &m_readOnly) |
| 63 | .AddHiddenAlias("ro") |
| 64 | .AddHiddenAlias(GDAL_ARG_NAME_READ_ONLY) |
| 65 | .SetAvailableInPipelineStep(false); |
| 66 | } |
| 67 | else |
| 68 | { |
| 69 | AddRasterHiddenInputDatasetArg(); |
| 70 | } |
| 71 | |
| 72 | AddBandArg(&m_band, _("Active band (1-based index)")); |
| 73 | |
| 74 | AddArg("crs", 0, _("Override CRS (without reprojection)"), &m_overrideCrs) |
| 75 | .AddHiddenAlias("a_srs") |
| 76 | .AddHiddenAlias("srs") |
| 77 | .SetIsCRSArg(/*noneAllowed=*/true); |
| 78 | |
| 79 | AddBBOXArg(&m_bbox); |
| 80 | |
| 81 | AddNodataArg(&m_nodata, /* noneAllowed = */ true); |
| 82 | |
| 83 | AddArg("color-interpretation", 0, _("Set band color interpretation"), |
| 84 | &m_colorInterpretation) |
| 85 | .SetMetaVar("[all|<BAND>=]<COLOR-INTEPRETATION>") |
| 86 | .SetAutoCompleteFunction( |
| 87 | [this](const std::string &s) |
| 88 | { |
| 89 | std::vector<std::string> ret; |
| 90 | int nValues = 0; |
| 91 | const auto paeVals = GDALGetColorInterpretationList(&nValues); |
| 92 | if (s.find('=') == std::string::npos) |
| 93 | { |
| 94 | ret.push_back("all="); |
| 95 | if (auto poDS = m_dataset.GetDatasetRef()) |
| 96 | { |
| 97 | for (int i = 0; i < poDS->GetRasterCount(); ++i) |
| 98 | ret.push_back(std::to_string(i + 1).append("=")); |
| 99 | } |
| 100 | for (int i = 0; i < nValues; ++i) |
| 101 | ret.push_back( |
nothing calls this directly
no test coverage detected