| 104 | } |
| 105 | |
| 106 | void E57Reader::addDimensions(PointLayoutPtr layout) |
| 107 | { |
| 108 | auto supportedFields = e57plugin::supportedE57Types(); |
| 109 | auto numScans = m_data3D->childCount(); |
| 110 | std::unique_ptr<Scan> tempScan; |
| 111 | |
| 112 | for (auto& dimension : supportedFields) |
| 113 | { |
| 114 | // Check if any of the scan have this dimension. |
| 115 | // If any of the scan have this dimension, we cannot ignore it. |
| 116 | for (auto p = 0; p < numScans; ++p) |
| 117 | { |
| 118 | tempScan.reset(new Scan((StructureNode)m_data3D->get(p))); |
| 119 | auto proto = tempScan->getPointPrototype(); |
| 120 | if (proto.isDefined(dimension)) |
| 121 | { |
| 122 | layout->registerDim(e57plugin::e57ToPdal(dimension)); |
| 123 | break; |
| 124 | } |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | if (layout->hasDim(Dimension::Id::SphericalRange) && |
| 129 | layout->hasDim(Dimension::Id::SphericalAzimuth) && |
| 130 | layout->hasDim(Dimension::Id::SphericalElevation)) |
| 131 | { |
| 132 | layout->registerDim(Dimension::Id::X); |
| 133 | layout->registerDim(Dimension::Id::Y); |
| 134 | layout->registerDim(Dimension::Id::Z); |
| 135 | } |
| 136 | |
| 137 | m_extraDims.reset(new e57plugin::ExtraDims()); |
| 138 | m_extraDims->parse(m_extraDimsSpec); |
| 139 | auto i = m_extraDims->begin(); |
| 140 | while (i != m_extraDims->end()) |
| 141 | { |
| 142 | i->m_id = Dimension::Id::Unknown; |
| 143 | // Remove extra dims which are already in layout. |
| 144 | if (layout->hasDim(e57plugin::e57ToPdal(i->m_name))) |
| 145 | { |
| 146 | i = m_extraDims->deleteDim(i); |
| 147 | continue; |
| 148 | } |
| 149 | |
| 150 | // Check if any of the scan have this dimension. |
| 151 | // If any of the scan have this dimension, we cannot ignore it. |
| 152 | for (auto p = 0; p < numScans; ++p) |
| 153 | { |
| 154 | tempScan.reset(new Scan((StructureNode)m_data3D->get(p))); |
| 155 | auto proto = tempScan->getPointPrototype(); |
| 156 | if (proto.isDefined(i->m_name)) |
| 157 | { |
| 158 | i->m_id = layout->registerOrAssignDim(i->m_name, i->m_type); |
| 159 | break; |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | if (i->m_id == Dimension::Id::Unknown) |
nothing calls this directly
no test coverage detected