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

Method morton

filters/MortonOrderFilter.cpp:183–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183PointViewSet MortonOrderFilter::morton(PointViewPtr inView)
184{
185 PointViewSet viewSet;
186 if (!inView->size())
187 return viewSet;
188 CmpZOrder compare;
189 std::multimap<Coord, PointId, CmpZOrder> sorted(compare);
190
191 BOX2D buffer_bounds;
192 inView->calculateBounds(buffer_bounds);
193 double xrange = buffer_bounds.maxx - buffer_bounds.minx;
194 double yrange = buffer_bounds.maxy - buffer_bounds.miny;
195
196 for (PointId idx = 0; idx < inView->size(); idx++)
197 {
198 double xpos = (inView->getFieldAs<double>(Dimension::Id::X, idx) -
199 buffer_bounds.minx) / xrange;
200 double ypos = (inView->getFieldAs<double>(Dimension::Id::Y, idx) -
201 buffer_bounds.miny) / yrange;
202 Coord loc(xpos, ypos);
203 sorted.insert(std::make_pair(loc, idx));
204 }
205
206 PointViewPtr outView = inView->makeNew();
207 std::multimap<Coord, PointId, CmpZOrder>::iterator pos;
208 for (pos = sorted.begin(); pos != sorted.end(); ++pos)
209 {
210 outView->appendPoint(*inView, pos->second);
211 }
212 viewSet.insert(outView);
213
214 return viewSet;
215}
216
217PointViewSet MortonOrderFilter::run(PointViewPtr inView)
218{

Callers

nothing calls this directly

Calls 6

calculateBoundsMethod · 0.80
appendPointMethod · 0.80
sizeMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected