| 159 | } |
| 160 | |
| 161 | PointViewSet GridDecimationFilter::run(PointViewPtr view) |
| 162 | { |
| 163 | PointViewSet viewSet; |
| 164 | |
| 165 | BOX2D bounds; |
| 166 | view->calculateBounds(bounds); |
| 167 | createGrid(bounds); |
| 168 | |
| 169 | for (PointId i = 0; i < view->size(); ++i) |
| 170 | { |
| 171 | PointRef point = view->point(i); |
| 172 | processOne(bounds,point,view); |
| 173 | } |
| 174 | |
| 175 | std::set<PointId> keepPoint; |
| 176 | for (auto it : this->grid) |
| 177 | if (it.second != -1) |
| 178 | keepPoint.insert(it.second); |
| 179 | |
| 180 | for (PointId i = 0; i < view->size(); ++i) |
| 181 | { |
| 182 | if (keepPoint.find(view->point(i).pointId()) != keepPoint.end()) |
| 183 | { |
| 184 | PointRef point = view->point(i); |
| 185 | for (expr::AssignStatement& expr : m_args->m_statements) |
| 186 | if (expr.conditionalExpr().eval(point)) |
| 187 | point.setField(expr.identExpr().eval(), expr.valueExpr().eval(point)); |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | viewSet.insert(view); |
| 192 | return viewSet; |
| 193 | } |
| 194 | |
| 195 | } // namespace pdal |
nothing calls this directly
no test coverage detected