MCPcopy Create free account
hub / github.com/OSGeo/gdal / GDALRasterEditAlgorithm

Method GDALRasterEditAlgorithm

apps/gdalalg_raster_edit.cpp:44–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42/************************************************************************/
43
44GDALRasterEditAlgorithm::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(

Callers

nothing calls this directly

Calls 14

ConstructorOptionsClass · 0.85
CPLGetValueTypeFunction · 0.85
GetGCPFilenameFunction · 0.85
CSLTokenizeString2Function · 0.85
SetPositionalMethod · 0.80
to_stringFunction · 0.50
ReportErrorFunction · 0.50
push_backMethod · 0.45
GetRasterCountMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected