| 247 | |
| 248 | |
| 249 | void 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 |
nothing calls this directly
no test coverage detected