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

Method parseDimensions

plugins/draco/io/DracoWriter.cpp:172–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172void DracoWriter::parseDimensions(BasePointTable &table)
173{
174 PointLayoutPtr layout = table.layout();
175 pdal::Dimension::IdList dimensions = layout->dims();
176 for (auto& dim : dimensions)
177 {
178 std::string dimString = Dimension::name(dim);
179 //if it doesn't exist in the json, then skip it
180 if (!m_userDimJson.contains(dimString)) continue;
181 //else add it to the list
182 auto dataType = m_userDimJson[dimString].get<std::string>();
183
184 log()->get(LogLevel::Info) << "Key: " << dimString << ", Value: "
185 << dataType << std::endl;
186 const auto it = dimMap.find(dim);
187 Dimension::Type pdalType = layout->dimType(dim);
188 if (it != dimMap.end())
189 {
190 //get draco type associated with the current dimension in loop
191 draco::GeometryAttribute::Type dracoType = it->second;
192 //search through DimInfo vector to see if we already have the draco attribute
193 bool found = false;
194 for (auto &dimInfo: m_dims) {
195 if (dimInfo.dracoAtt == dracoType) {
196 dimInfo.pdalDims.push_back(DimType(dim, pdalType));
197 found = true;
198 break;
199 }
200 }
201 //if it's not there, add it to the vector
202 if (!found) {
203 DimensionInfo d = {
204 dracoType,
205 -1, //default attribute id to -1
206 { DimType(dim, pdalType) }
207 };
208 m_dims.push_back(d);
209 }
210 }
211 else //not a "known" draco type
212 {
213 //add generic dimension to DimensionInfo vector
214 DimensionInfo d = {
215 draco::GeometryAttribute::GENERIC,
216 -1, //default attribute id to -1
217 { DimType(dim, pdalType) }
218 };
219 m_dims.push_back(d);
220 }
221
222 }
223
224 //go through types of m_dims pdal ids and make sure they're consistent
225 for (auto &dimInfo: m_dims) {
226 int numDims = dimInfo.pdalDims.size();
227 //start with first type
228 DimType preType = dimInfo.pdalDims[0];
229 //go through following types and make sure they match

Callers

nothing calls this directly

Calls 9

DimTypeClass · 0.85
nameFunction · 0.50
logFunction · 0.50
containsMethod · 0.45
getMethod · 0.45
findMethod · 0.45
dimTypeMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected