ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvColorScalesManager.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // Local
11 #include "ecvColorScale.h"
12 
13 // Qt
14 #include <QMap>
15 
18 public:
21 
23  static void ReleaseUniqueInstance();
24 
27 
30  BGYR = 0,
32  GREY = 1,
33  BWR = 2,
34  RY = 3,
35  RW = 4,
36  ABS_NORM_GREY = 5,
38  HSV_360_DEG = 6,
39  VERTEX_QUALITY = 7,
41  DIP_BRYW = 8,
42  DIP_DIR_REPEAT = 9,
43  VIRIDIS = 10,
45  BROWN_YELLOW = 11,
46  YELLOW_BROWN = 12,
47  TOPO_LANDSERF = 13,
48  HIGH_CONTRAST = 14,
49  CIVIDIS =
50  15,
53  };
54 
56  static QString GetDefaultScaleUUID(int scale) {
57  return QString::number(scale);
58  }
59 
62  ccColorScalesManager* instance = GetUniqueInstance();
63  return instance ? instance->getDefaultScale(scale)
64  : ccColorScale::Shared(nullptr);
65  }
66 
69  return getScale(GetDefaultScaleUUID(scale));
70  }
71 
73  ccColorScale::Shared getScale(QString UUID) const;
74 
77 
79 
81  void removeScale(QString UUID);
82 
84  typedef QMap<QString, ccColorScale::Shared> ScalesMap;
85 
87  ScalesMap& map() { return m_scales; }
88 
90  const ScalesMap& map() const { return m_scales; }
91 
94 
96  void toPersistentSettings() const;
97 
98 protected:
101 
104 
107 };
#define CV_DB_LIB_API
Definition: CV_db.h:15
QSharedPointer< ccColorScale > Shared
Shared pointer type.
Definition: ecvColorScale.h:74
Color scales manager/container.
ccColorScale::Shared getScale(QString UUID) const
Returns a color scale based on its UUID.
void addScale(ccColorScale::Shared scale)
Adds a new color scale.
const ScalesMap & map() const
Access to the internal map (const)
ScalesMap & map()
Access to the internal map.
QMap< QString, ccColorScale::Shared > ScalesMap
Color scales map type.
static ccColorScale::Shared GetDefaultScale(DEFAULT_SCALES scale=BGYR)
Returns a pre-defined color scale (static shortcut)
DEFAULT_SCALES
Pre-defined color scales (all relative - i.e. expand to actual SF)
void removeScale(QString UUID)
Removes a color scale.
static ccColorScale::Shared Create(DEFAULT_SCALES scaleType)
Creates a pre-defined color scale.
virtual ~ccColorScalesManager()
Destructor.
static QString GetDefaultScaleUUID(int scale)
Returns a pre-defined color scale UUID.
void toPersistentSettings() const
Save custom color scales to persistent settings.
ccColorScalesManager()
Default constructor.
static void ReleaseUniqueInstance()
Releases unique instance.
void fromPersistentSettings()
Loads custom color scales from persistent settings.
ccColorScale::Shared getDefaultScale(DEFAULT_SCALES scale) const
Returns a pre-defined color scale.
static ccColorScalesManager * GetUniqueInstance()
Returns unique instance.
ScalesMap m_scales
Color scales.