MeshLib C++ Docs
Loading...
Searching...
No Matches
MRColorMapAggregator.h
Go to the documentation of this file.
1#pragma once
2#include "MRMeshFwd.h"
3#include "MRVector.h"
4#include "MRColor.h"
5#include "MRId.h"
6#include "MRBitSet.h"
7
8
9namespace MR
10{
13
18template<typename Tag>
20{
21public:
23 using ElementBitSet = TaggedBitSet<Tag>;
24
25 ColorMapAggregator() = default;
26
28 MRMESH_API void setDefaultColor( const Color& color );
29
36
38 MRMESH_API void pushBack( const PartialColorMap& partitialColorMap );
39
41 MRMESH_API void insert( int i, const PartialColorMap& partitialColorMap );
42
44 MRMESH_API void replace( int i, const PartialColorMap& partitialColorMap );
45
48
50 size_t getColorMapNumber() { return dataSet_.size(); };
51
53 const PartialColorMap& getPartialColorMap( int i ) { return dataSet_[i]; }
54
56 MRMESH_API void erase( int i, int n = 1 );
57
59 enum class AggregateMode
60 {
63 };
64
67
69 MRMESH_API ColorMap aggregate( const ElementBitSet& elementBitSet );
70private:
71 Color defaultColor_;
72
73 std::vector<PartialColorMap> dataSet_;
74
75 ColorMap aggregatedColorMap_;
76 bool needUpdate_{ true };
78
80 bool checkInputData_( const PartialColorMap& partitialColorMap );
81 void updateAggregated_( int newSize );
82};
83
84}
#define MRMESH_API
Definition MRMeshFwd.h:85
Vector<T> is indexed by size_t.
Definition MRVector.h:24
void reset()
reset all accumulated color map
Vector< Color, Id< Tag > > ColorMap
Definition MRColorMapAggregator.h:22
ColorMap aggregate(const ElementBitSet &elementBitSet)
get aggregated color map for active elements
TaggedBitSet< Tag > ElementBitSet
Definition MRColorMapAggregator.h:23
const PartialColorMap & getPartialColorMap(int i)
get partial color map map by index
Definition MRColorMapAggregator.h:53
void erase(int i, int n=1)
erase n color map from i
size_t getColorMapNumber()
get number of accumulated color maps
Definition MRColorMapAggregator.h:50
void insert(int i, const PartialColorMap &partitialColorMap)
insert color map before element i (0 - minimum priority)
void setDefaultColor(const Color &color)
set default (background) color
ColorMap colorMap
Definition MRColorMapAggregator.h:33
void pushBack(const PartialColorMap &partitialColorMap)
add color map after all (more priority)
ColorMapAggregator()=default
AggregateMode
color map aggregating mode
Definition MRColorMapAggregator.h:60
ElementBitSet elements
color map
Definition MRColorMapAggregator.h:34
void replace(int i, const PartialColorMap &partitialColorMap)
replace color map at position i
void setMode(AggregateMode mode)
set color map aggregating mode
@ Overlay
Definition MRColorMapAggregator.h:61
@ Blending
result element color is element color of more priority color map (or default color,...
Definition MRColorMapAggregator.h:62
Only strictly necessary for the bindings (to make MR::MeshIntersectionResult a complete type).
Definition MRCameraOrientationPlugin.h:8
partial color map
Definition MRColorMapAggregator.h:32
Definition MRColor.h:12