Tulip  5.7.4
Large graphs analysis and drawing
ColorScalesManager.h
1 /*
2  *
3  * This file is part of Tulip (https://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 
20 ///@cond DOXYGEN_HIDDEN
21 
22 #ifndef COLORSCALESMANAGER_H
23 #define COLORSCALESMANAGER_H
24 
25 #include <tulip/ColorScale.h>
26 
27 #include <list>
28 
29 namespace tlp {
30 
31 /**
32  * @brief Helper class for handling Tulip color scales
33  *
34  * @since Tulip 4.10
35  *
36  * That static class aims to facilitate working with Tulip color scales.
37  * It allows to easily retrieve Tulip predefined ones but also to register new ones
38  * in a persistent database for further reuse.
39  *
40  */
41 class TLP_QT_SCOPE ColorScalesManager {
42 
43 public:
44  /**
45  * @brief Returns a list of the registered color scales names.
46  *
47  */
48  static std::list<std::string> getColorScalesList();
49 
50  /**
51  * @brief Returns the color scale registered with the provided name.
52  *
53  * @warning If there is no such colorscale, the returned one will be empty.
54  *
55  */
56  static tlp::ColorScale getColorScale(const std::string &colorScaleName);
57 
58  /**
59  * @brief Registers a color scale in the persistent database for further reuse.
60  *
61  * @warning If there is already a color scale registered with such a name, it will not be
62  * overwritten.
63  *
64  */
65  static void registerColorScale(const std::string &colorScaleName,
66  const tlp::ColorScale &colorScale);
67 
68  /**
69  * @brief Removes the color scale registered with the provided name from the persistent database.
70  *
71  */
72  static void removeColorScale(const std::string &colorScaleName);
73 
74  static ColorScale getLatestColorScale();
75  static void setLatestColorScale(ColorScale &cs);
76 
77 private:
78  static void getColorScalesFromDir(const std::string &colorScalesDir,
79  std::list<std::string> &colorScalesList);
80  static std::string findColorScaleFile(const std::string &rootDir,
81  const std::string &colorScaleName);
82 };
83 } // namespace tlp
84 
85 #endif
86 
87 ///@endcond
This class represents a color scale to perform color mapping. The color scale can be either a gradien...
Definition: ColorScale.h:62