UFO 1.0.0
An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
Loading...
Searching...
No Matches
has_color.hpp
1
42#ifndef UFO_MAP_COLOR_PREDICATE_HAS_COLOR_HPP
43#define UFO_MAP_COLOR_PREDICATE_HAS_COLOR_HPP
44
45// UFO
46#include <ufo/map/color/color.hpp>
47#include <ufo/map/predicate/predicate.hpp>
48#include <ufo/map/types.hpp>
49
50namespace ufo::pred
51{
52template <bool Negated = false>
53struct HasColor {
54};
55
56template <bool Negated>
58{
59 return {};
60}
61
62template <bool Negated>
63struct InnerCheck<HasColor<Negated>> {
64 using Pred = HasColor<Negated>;
65
66 template <class Map, class Node>
67 static constexpr bool apply(Pred p, Map const& m, Node const& n)
68 {
69 if constexpr (Negated) {
70 return true;
71 } else {
72 return ColorBlendingMode::NONE == m.colorPropagationBlendingMode() ||
73 !m.colorEmpty(n.index());
74 }
75 }
76};
77
78template <bool Negated>
79struct ValueCheck<HasColor<Negated>> {
80 using Pred = HasColor<Negated>;
81
82 template <class Map, class Node>
83 static constexpr bool apply(Pred, Map const& m, Node n)
84 {
85 if constexpr (Negated) {
86 return m.colorEmpty(n.index());
87 } else {
88 return !m.colorEmpty(n.index());
89 }
90 }
91};
92} // namespace ufo::pred
93
94#endif // UFO_MAP_COLOR_PREDICATE_HAS_COLOR_HPP