| 181 | } |
| 182 | |
| 183 | PointViewSet 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 | |
| 217 | PointViewSet MortonOrderFilter::run(PointViewPtr inView) |
| 218 | { |
nothing calls this directly
no test coverage detected