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

Method read

plugins/icebridge/io/IcebridgeReader.cpp:115–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113
114
115point_count_t IcebridgeReader::read(PointViewPtr view, point_count_t count)
116{
117 //All data we read for icebridge is currently 4 bytes wide, so
118 // just allocate once and forget it.
119 //This could be a huge allocation. Perhaps we should do something
120 // in the icebridge handler?
121
122 PointId startId = view->size();
123 point_count_t remaining = m_hdf5Handler.getNumPoints() - m_index;
124 count = (std::min)(count, remaining);
125
126 std::vector<uint8_t> rawData(count * sizeof(float));
127
128 //Not loving the position-linked data, but fine for now.
129 Dimension::IdList dims = dimensions();
130 auto di = dims.begin();
131 for (auto ci = hdf5Columns.begin(); ci != hdf5Columns.end(); ++ci, ++di)
132 {
133 PointId nextId = startId;
134 PointId idx = m_index;
135 const hdf5::Hdf5ColumnData& column = *ci;
136
137 try
138 {
139 m_hdf5Handler.getColumnEntries(rawData.data(), column.name, count,
140 m_index);
141 void *p = (void *)rawData.data();
142
143 // This is ugly but avoids a test in a tight loop.
144 if (column.predType == H5::PredType::NATIVE_FLOAT)
145 {
146 // Offset time is in ms but icebridge stores in seconds.
147 if (*di == Dimension::Id::OffsetTime)
148 {
149 float *fval = (float *)p;
150 for (PointId i = 0; i < count; ++i)
151 {
152 view->setField(*di, nextId++, *fval * 1000);
153 fval++;
154 }
155 }
156 else if (*di == Dimension::Id::X)
157 {
158 float *fval = (float *)p;
159 for (PointId i = 0; i < count; ++i)
160 {
161 double dval = (double)(*fval);
162 // Longitude is 0-360. Convert
163 dval = Utils::normalizeLongitude(dval);
164 view->setField(*di, nextId++, dval);
165 fval++;
166 }
167
168 }
169 else
170 {
171 float *fval = (float *)p;
172 for (PointId i = 0; i < count; ++i)

Callers 1

getColumnEntriesMethod · 0.45

Calls 9

dimensionsFunction · 0.85
getColumnEntriesMethod · 0.80
sizeMethod · 0.45
getNumPointsMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
dataMethod · 0.45
setFieldMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected