Tulip  5.1.0
Large graphs analysis and drawing
ColorScalesManager.h
1 #ifndef COLORSCALESMANAGER_H
2 #define COLORSCALESMANAGER_H
3 
4 #include <tulip/ColorScale.h>
5 
6 #include <list>
7 
8 namespace tlp {
9 
10 /**
11  * @brief Helper class for handling Tulip color scales
12  *
13  * @since Tulip 4.10
14  *
15  * That static class aims to facilitate working with Tulip color scales.
16  * It allows to easily retrieve Tulip predefined ones but also to register new ones
17  * in a persistent database for further reuse.
18  *
19  */
20 class TLP_QT_SCOPE ColorScalesManager {
21 
22 public:
23 
24  /**
25  * @brief Returns a list of the registered color scales names.
26  *
27  */
28  static std::list<std::string> getColorScalesList();
29 
30  /**
31  * @brief Returns the color scale registered with the provided name.
32  *
33  * @warning If there is no such colorscale, the returned one will be empty.
34  *
35  */
36  static tlp::ColorScale getColorScale(const std::string &colorScaleName);
37 
38  /**
39  * @brief Registers a color scale in the persistent database for further reuse.
40  *
41  * @warning If there is already a color scale registered with such a name, it will not be overwritten.
42  *
43  */
44  static void registerColorScale(const std::string &colorScaleName, const tlp::ColorScale &colorScale);
45 
46  /**
47  * @brief Removes the color scale registered with the provided name from the persistent database.
48  *
49  */
50  static void removeColorScale(const std::string &colorScaleName);
51 
52  static ColorScale getLatestColorScale();
53  static void setLatestColorScale(ColorScale& cs);
54 
55 private:
56 
57  static void getColorScalesFromDir(const std::string &colorScalesDir, std::list<std::string> &colorScalesList);
58  static std::string findColorScaleFile(const std::string &rootDir, const std::string &colorScaleName);
59 
60 };
61 
62 }
63 
64 #endif
This class represents a color scale to perform color mapping. The color scale can be either a gradien...
Definition: ColorScale.h:59
Helper class for handling Tulip color scales.