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:
20  static ccColorScalesManager* GetUniqueInstance();
21 
23  static void ReleaseUniqueInstance();
24 
26  virtual ~ccColorScalesManager();
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 
76  void addScale(ccColorScale::Shared scale);
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 
93  void fromPersistentSettings();
94 
96  void toPersistentSettings() const;
97 
98 protected:
101 
103  static ccColorScale::Shared Create(DEFAULT_SCALES scaleType);
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.
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)
static QString GetDefaultScaleUUID(int scale)
Returns a pre-defined color scale UUID.
ccColorScale::Shared getDefaultScale(DEFAULT_SCALES scale) const
Returns a pre-defined color scale.
ScalesMap m_scales
Color scales.