Commit 7f62f27fdcb59934d15e991a4a8329ffd92b4e19

Authored by Benjamin Renard
1 parent 266c1fa7

Add the possibility to associate a color to a status

src/Info/ParamInfo.hh
... ... @@ -294,10 +294,11 @@ public:
294 294 /*
295 295 * @brief Add parameter status for a given min/max values
296 296 */
297   - void addStatus(double minVal, double maxVal, std::string name) {
  297 + void addStatus(double minVal, double maxVal, std::string name, std::string color = "") {
298 298 StatusInfo info;
299 299 info.setRange(minVal,maxVal);
300 300 info.setName(name);
  301 + info.setColor(color);
301 302 _statusDef.push_back(info);
302 303 }
303 304  
... ...
src/Info/StatusDefNode.cc
... ... @@ -59,7 +59,16 @@ public:
59 59 xmlFree(value);
60 60 }
61 61  
62   - pParamInfo->addStatus(minVal,maxVal,name);
  62 + //Get color
  63 + value = xmlGetProp(pNode, (const xmlChar *) "color");
  64 + std::string color = "";
  65 + if (value != NULL)
  66 + {
  67 + color = std::string((const char*)value);
  68 + xmlFree(value);
  69 + }
  70 +
  71 + pParamInfo->addStatus(minVal,maxVal,name, color);
63 72 }
64 73 };
65 74  
... ...
src/Info/StatusInfo.hh
... ... @@ -19,7 +19,7 @@ namespace Info {
19 19 class StatusInfo
20 20 {
21 21 public:
22   - StatusInfo() : _minValue(0.0), _maxValue(0.0), _name("")
  22 + StatusInfo() : _minValue(0.0), _maxValue(0.0), _name(""), _color("")
23 23 {
24 24 }
25 25  
... ... @@ -68,6 +68,22 @@ public:
68 68 return _name;
69 69 }
70 70  
  71 + /*
  72 + * @brief Set color
  73 + */
  74 + void setColor(std::string color)
  75 + {
  76 + _color = color;
  77 + }
  78 +
  79 + /*
  80 + * @brief Get color name
  81 + */
  82 + const std::string& getColor() const
  83 + {
  84 + return _color;
  85 + }
  86 +
71 87 private:
72 88 /*
73 89 * @brief min value for the range of this status
... ... @@ -83,6 +99,11 @@ private:
83 99 * @brief status name
84 100 */
85 101 std::string _name;
  102 +
  103 + /*
  104 + * @brief status color. Format: [R,G,B]. Empty if not defined
  105 + */
  106 + std::string _color;
86 107 };
87 108  
88 109 }
... ...