NDEVR
API Documentation
PointSmootherBlockFilter.hpp
1#pragma once
2#include "RasterPointScanner/Headers/ViewportPointSmoother.hpp"
3#include "BlockModel/Headers/BlockModelRaster.h"
4namespace NDEVR
5{
6 template<class t_point_type, class t_smooth_type>
7 class PointSmootherBlockFilter : public BlockModelFilteringCache<t_point_type, uint04>
8 {
9 public:
10 PointSmootherBlockFilter(ViewportPointSmoother<t_smooth_type>* smoother)
11 : m_smoother(smoother)
12 {}
13 bool shouldFilter(const Vertex<3, uint04>& location, const t_point_type& node, uint04) const final override
14 {
15 return m_smoother->contains(location.as<3, fltp04>(), node);
16 }
17 void onFiltered(const Vertex<3, uint04>& location, const t_point_type& node, uint04 weight) const final override
18 {
19 Vector<3, fltp04> flocation = location.as<3, fltp04>();
20 if constexpr (t_point_type::HasOffset())
21 flocation += node.offset();
22 m_filtered_locations.add(flocation);
23 m_filtered_colors.add(node.template getAs<t_smooth_type>());
24 m_filtered_weights.add(weight);
25 }
26 void setSmoother(ViewportPointSmoother<t_smooth_type>* smoother)
27 {
28 m_smoother = smoother;
29 }
30 IntersectionTypes classifyToFilter(const Bounds<3, uint04>& value) const override
31 {
32 return m_smoother->classifyBlock(value.as<3, fltp04>());
33 }
34 void* gridLocationLockPtr()
35 {
36 return &m_filtered_locations;
37 }
38 void transferActiveLocations()
39 {
40 WLock lock(gridLocationLockPtr());
41 m_smoother->addBlockPoints(m_filtered_locations, m_filtered_colors, m_filtered_weights);
42 m_filtered_locations.clear();
43 m_filtered_colors.clear();
44 m_filtered_weights.clear();
45 }
46 void clearAll()
47 {
48 WLock lock(gridLocationLockPtr());
49 m_filtered_locations.clear();
50 m_filtered_colors.clear();
51 m_filtered_weights.clear();
52 }
53 mutable Buffer<Vertex<3, fltp04>> m_filtered_locations;
54 mutable Buffer<t_smooth_type> m_filtered_colors;
55 mutable Buffer<uint04> m_filtered_weights;
56 ViewportPointSmoother<t_smooth_type>* m_smoother;
57 };
58}
Abstract cache interface for filtering block model raster data based on spatial criteria.
The primary namespace for the NDEVR SDK.
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
IntersectionTypes
Used for classifying shape intersections.