| 258 | } |
| 259 | |
| 260 | void DracoWriter::createDims(BasePointTable &table) { |
| 261 | PointLayoutPtr layout = table.layout(); |
| 262 | pdal::Dimension::IdList dimensions = layout->dims(); |
| 263 | for (auto& dim : dimensions) |
| 264 | { |
| 265 | //check that dimension exists in the dimension argument |
| 266 | std::string dimStr = Dimension::name(dim); |
| 267 | Dimension::Type pdalType = layout->dimType(dim); |
| 268 | //create list of dimensions needed int numComponents(1); |
| 269 | const auto it = dimMap.find(dim); |
| 270 | if (it != dimMap.end()) |
| 271 | { |
| 272 | //get draco type associated with the current dimension in loop |
| 273 | draco::GeometryAttribute::Type dracoType = it->second; |
| 274 | //search through DimInfo vector to see if we already have the draco attribute |
| 275 | bool found = false; |
| 276 | for (auto &dimInfo: m_dims) { |
| 277 | if (dimInfo.dracoAtt == dracoType) { |
| 278 | dimInfo.pdalDims.push_back(DimType(dim, pdalType)); |
| 279 | found = true; |
| 280 | break; |
| 281 | } |
| 282 | } |
| 283 | //if it's not there, add it to the vector |
| 284 | if (!found) { |
| 285 | DimensionInfo d = { |
| 286 | dracoType, |
| 287 | -1, //default attribute id to -1 |
| 288 | { DimType(dim, pdalType) } |
| 289 | }; |
| 290 | m_dims.push_back(d); |
| 291 | } |
| 292 | |
| 293 | } |
| 294 | else //not a "known" draco type |
| 295 | { |
| 296 | //add generic dimension to DimensionInfo vector |
| 297 | DimensionInfo d = { |
| 298 | draco::GeometryAttribute::GENERIC, |
| 299 | -1, //default attribute id to -1 |
| 300 | { DimType(dim, pdalType) } |
| 301 | }; |
| 302 | m_dims.push_back(d); |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | void DracoWriter::ready(pdal::BasePointTable &table) |
| 308 | { |