Tulip  5.2.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  * @brief Returns a list of the registered color scales names.
25  *
26  */
27  static std::list<std::string> getColorScalesList();
28 
29  /**
30  * @brief Returns the color scale registered with the provided name.
31  *
32  * @warning If there is no such colorscale, the returned one will be empty.
33  *
34  */
35  static tlp::ColorScale getColorScale(const std::string &colorScaleName);
36 
37  /**
38  * @brief Registers a color scale in the persistent database for further reuse.
39  *
40  * @warning If there is already a color scale registered with such a name, it will not be
41  * overwritten.
42  *
43  */
44  static void registerColorScale(const std::string &colorScaleName,
45  const tlp::ColorScale &colorScale);
46 
47  /**
48  * @brief Removes the color scale registered with the provided name from the persistent database.
49  *
50  */
51  static void removeColorScale(const std::string &colorScaleName);
52 
53  static ColorScale getLatestColorScale();
54  static void setLatestColorScale(ColorScale &cs);
55 
56 private:
57  static void getColorScalesFromDir(const std::string &colorScalesDir,
58  std::list<std::string> &colorScalesList);
59  static std::string findColorScaleFile(const std::string &rootDir,
60  const std::string &colorScaleName);
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:62
Helper class for handling Tulip color scales.