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

Method processOne

io/PcdReader.cpp:159–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159bool PcdReader::processOne(PointRef& point)
160{
161 switch (m_header.m_dataStorage)
162 {
163 case PcdDataStorage::ASCII:
164 if (!fillFields())
165 return false;
166
167 double d;
168 for (size_t i = 0; i < m_fields.size(); ++i)
169 {
170 if (!Utils::fromString(m_fields[i], d))
171 {
172 log()->get(LogLevel::Error)
173 << "Can't convert field '" << m_fields[i]
174 << "' to numeric value on line " << m_line << " in '"
175 << m_filename << "'. Setting to 0." << std::endl;
176 d = 0;
177 }
178 point.setField(m_dims[i], d);
179 }
180 return true;
181 case PcdDataStorage::BINARY:
182 if (!m_stream.good())
183 return false;
184
185 if ((m_index >= m_count) ||
186 (m_index >= (point_count_t)m_header.m_pointCount))
187 return false;
188
189 for (auto const& i : m_header.m_fields)
190 {
191 switch (i.m_type)
192 {
193 case PcdFieldType::I:
194 if (i.m_size == 1)
195 {
196 int8_t ival;
197 m_stream >> ival;
198 point.setField(i.m_id, ival);
199 }
200 if (i.m_size == 2)
201 {
202 int16_t ival;
203 m_stream >> ival;
204 point.setField(i.m_id, ival);
205 }
206 if (i.m_size == 4)
207 {
208 int32_t ival;
209 m_stream >> ival;
210 point.setField(i.m_id, ival);
211 }
212 if (i.m_size == 8)
213 {
214 int64_t ival;
215 m_stream >> ival;
216 point.setField(i.m_id, ival);

Callers

nothing calls this directly

Calls 5

fromStringFunction · 0.70
logFunction · 0.50
sizeMethod · 0.45
getMethod · 0.45
setFieldMethod · 0.45

Tested by

no test coverage detected