MeshLib
 
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{
15template<typename Tag>
17{
18public:
21
22 ColorMapAggregator() = default;
23
25 MRMESH_API void setDefaultColor( const Color& color );
26
29 {
30 ColorMap colorMap; // color map
31 ElementBitSet elements; // bitset of elements for which the color map is applied
32 };
33
35 MRMESH_API void pushBack( const PartialColorMap& partitialColorMap );
36
38 MRMESH_API void insert( int i, const PartialColorMap& partitialColorMap );
39
41 MRMESH_API void replace( int i, const PartialColorMap& partitialColorMap );
42
45
47 size_t getColorMapNumber() { return dataSet_.size(); };
48
50 const PartialColorMap& getPartialColorMap( int i ) { return dataSet_[i]; }
51
53 MRMESH_API void erase( int i, int n = 1 );
54
56 enum class AggregateMode
57 {
58 Overlay,
60 };
61
64
66 MRMESH_API ColorMap aggregate( const ElementBitSet& elementBitSet );
67private:
68 Color defaultColor_;
69
70 std::vector<PartialColorMap> dataSet_;
71
72 ColorMap aggregatedColorMap_;
73 bool needUpdate_{ true };
75
77 bool checkInputData_( const PartialColorMap& partitialColorMap );
78 void updateAggregated_( int newSize );
79};
80
81}
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
Class for aggregate several color map in one Color maps are aggregated according order.
Definition MRColorMapAggregator.h:17
MRMESH_API void setDefaultColor(const Color &color)
set default (background) color
const PartialColorMap & getPartialColorMap(int i)
get partial color map map by index
Definition MRColorMapAggregator.h:50
size_t getColorMapNumber()
get number of accumulated color maps
Definition MRColorMapAggregator.h:47
MRMESH_API void pushBack(const PartialColorMap &partitialColorMap)
add color map after all (more priority)
MRMESH_API void erase(int i, int n=1)
erase n color map from #i
MRMESH_API void setMode(AggregateMode mode)
set color map aggregating mode
MRMESH_API ColorMap aggregate(const ElementBitSet &elementBitSet)
get aggregated color map for active elements
ColorMapAggregator()=default
AggregateMode
color map aggregating mode
Definition MRColorMapAggregator.h:57
@ Blending
result element color is element color of more priority color map (or default color,...
MRMESH_API void insert(int i, const PartialColorMap &partitialColorMap)
insert color map before element #i (0 - minimum priority)
MRMESH_API void replace(int i, const PartialColorMap &partitialColorMap)
replace color map in #i position
MRMESH_API void reset()
reset all accumulated color map
Definition MRCameraOrientationPlugin.h:7
partial color map
Definition MRColorMapAggregator.h:29
ColorMap colorMap
Definition MRColorMapAggregator.h:30
ElementBitSet elements
Definition MRColorMapAggregator.h:31
Definition MRColor.h:9