MCPcopy Create free account
hub / github.com/PDAL/PDAL / initialize

Method initialize

io/GDALWriter.cpp:110–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108
109
110void GDALWriter::initialize()
111{
112 for (auto& ts : m_outputTypeString)
113 {
114 Utils::trim(ts);
115 if (ts == "all")
116 {
117 m_outputTypes = ~0;
118 break;
119 }
120 if (ts == "min")
121 m_outputTypes |= GDALGrid::statMin;
122 else if (ts == "max")
123 m_outputTypes |= GDALGrid::statMax;
124 else if (ts == "count")
125 m_outputTypes |= GDALGrid::statCount;
126 else if (ts == "mean")
127 m_outputTypes |= GDALGrid::statMean;
128 else if (ts == "idw")
129 m_outputTypes |= GDALGrid::statIdw;
130 else if (ts == "stdev")
131 m_outputTypes |= GDALGrid::statStdDev;
132 else if (std::tolower(ts[0]) == 'p' && ts.size() > 1)
133 {
134 int p;
135 if (!Utils::fromString(ts.substr(1), p))
136 throwError("Invalid percentile value: '" + ts + "'.");
137 if (p < 0 || p > 100)
138 throwError("Percentile values must be integers between 1 and 100.");
139 m_percentiles.push_back(p);
140 }
141 else
142 throwError("Invalid output type: '" + ts + "'.");
143 }
144
145 if (m_overrideSrs.valid() && m_defaultSrs.valid())
146 throwError("Can't set both 'override_srs' and 'default_srs'.");
147
148 if (!m_percentiles.empty() && !m_binMode)
149 throwError("Can't output percentiles without 'binmode=true'.");
150
151 if (!m_radiusArg->set())
152 m_radius = m_edgeLength * sqrt(2.0);
153
154 int args = 0;
155 if (m_xOriginArg->set())
156 args |= 1;
157 if (m_yOriginArg->set())
158 args |= 2;
159 if (m_heightArg->set())
160 args |= 4;
161 if (m_widthArg->set())
162 args |= 8;
163 if (args != 0 && args != 15)
164 throwError("Must specify all or none of 'origin_x', 'origin_y', "
165 "'width' and 'height'.");
166 if (args == 15)
167 {

Callers

nothing calls this directly

Calls 9

trimFunction · 0.85
tolowerFunction · 0.85
BoundsFunction · 0.85
to2dMethod · 0.80
fromStringFunction · 0.70
sizeMethod · 0.45
validMethod · 0.45
emptyMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected