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

Method addDimensions

io/EsriReader.cpp:249–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247
248
249void EsriReader::addDimensions(PointLayoutPtr layout)
250{
251 using namespace Dimension;
252
253 const NL::json& jsonBody = m_interface->getInfo();
254 if (!jsonBody.contains("attributeStorageInfo"))
255 throwError("Attributes do not exist for this object");
256 const NL::json& attributes = jsonBody["attributeStorageInfo"];
257
258 layout->registerDims({Id::X, Id::Y, Id::Z});
259
260 m_extraDimCount = 0;
261 for (auto el : attributes)
262 {
263 DimData dim;
264
265 dim.name = Utils::toupper(el["name"].get<std::string>());
266 if (!Utils::contains(m_args->dimensions, dim.name))
267 continue;
268
269 dim.key = std::stoi(el["key"].get<std::string>());
270
271 if (!el.contains("attributeValues"))
272 {
273 //Expect that Elevation will be bundled with xyz
274 if (dim.name != "ELEVATION")
275 log()->get(LogLevel::Warning) <<
276 "Attribute does not have a type." <<
277 std::endl;
278 continue;
279 }
280
281 if (dim.name == "RGB")
282 {
283 layout->registerDim(Id::Red);
284 layout->registerDim(Id::Green);
285 layout->registerDim(Id::Blue);
286 }
287 else if (dim.name == "RETURNS")
288 {
289 layout->registerDim(Id::NumberOfReturns);
290 layout->registerDim(Id::ReturnNumber);
291 dim.type = Type::Unsigned8;
292 dim.pos = m_extraDimCount++;
293 }
294 else if (dim.name == "INTENSITY")
295 {
296 layout->registerDim(Id::Intensity);
297 }
298 else
299 {
300 std::string dimTypeName =
301 el["attributeValues"]["valueType"].get<std::string>();
302 auto typeIt = typeMapping.find(dimTypeName);
303 if (typeIt == typeMapping.end())
304 throwError("Invalid dimension type '" + dimTypeName + "'.");
305 dim.type = typeIt->second;
306

Callers

nothing calls this directly

Calls 11

toupperFunction · 0.85
registerDimsMethod · 0.80
registerDimMethod · 0.80
registerOrAssignDimMethod · 0.80
containsFunction · 0.50
logFunction · 0.50
getInfoMethod · 0.45
containsMethod · 0.45
getMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected