hyperion.ng
LedString.h
1 
2 #pragma once
3 
4 // STL includes
5 #include <ctime>
6 #include <vector>
7 
8 // Local includes
9 #include <utils/ColorRgb.h>
10 
11 // QT includes
12 #include <QString>
13 
14 // Forward class declarations
15 namespace Json { class Value; }
16 
18 enum ColorOrder
19 {
20  ORDER_RGB, ORDER_RBG, ORDER_GRB, ORDER_BRG, ORDER_GBR, ORDER_BGR
21 };
22 
23 inline QString colorOrderToString(const ColorOrder colorOrder)
24 {
25  switch (colorOrder)
26  {
27  case ORDER_RGB:
28  return "rgb";
29  case ORDER_RBG:
30  return "rbg";
31  case ORDER_GRB:
32  return "grb";
33  case ORDER_BRG:
34  return "brg";
35  case ORDER_GBR:
36  return "gbr";
37  case ORDER_BGR:
38  return "bgr";
39  default:
40  return "not-a-colororder";
41  }
42 }
43 inline ColorOrder stringToColorOrder(const QString & order)
44 {
45  if (order == "rgb")
46  {
47  return ORDER_RGB;
48  }
49  else if (order == "bgr")
50  {
51  return ORDER_BGR;
52  }
53  else if (order == "rbg")
54  {
55  return ORDER_RBG;
56  }
57  else if (order == "brg")
58  {
59  return ORDER_BRG;
60  }
61  else if (order == "gbr")
62  {
63  return ORDER_GBR;
64  }
65  else if (order == "grb")
66  {
67  return ORDER_GRB;
68  }
69 
70  std::cout << "Unknown color order defined (" << order.toStdString() << "). Using RGB." << std::endl;
71  return ORDER_RGB;
72 }
73 
89 struct Led
90 {
92  unsigned index;
93 
95  double minX_frac;
97  double maxX_frac;
99  double minY_frac;
101  double maxY_frac;
103  int clone;
105  ColorOrder colorOrder;
106 };
107 
112 {
113 public:
117  LedString();
118 
122  ~LedString();
123 
129  std::vector<Led>& leds();
130 
136  const std::vector<Led>& leds() const;
137 
138 private:
140  std::vector<Led> mLeds;
141 };
double maxY_frac
The maximum horizontal scan line included for this leds color.
Definition: LedString.h:101
double maxX_frac
The maximum vertical scan line included for this leds color.
Definition: LedString.h:97
ColorOrder colorOrder
the color order
Definition: LedString.h:105
double minY_frac
The minimum horizontal scan line included for this leds color.
Definition: LedString.h:99
unsigned index
The index of the led.
Definition: LedString.h:92
The Led structure contains the definition of the image portion used to determine a single led&#39;s color...
Definition: LedString.h:89
int clone
id to clone
Definition: LedString.h:103
Definition: LedString.h:15
double minX_frac
The minimum vertical scan line included for this leds color.
Definition: LedString.h:95
The LedString contains the image integration information of the leds.
Definition: LedString.h:111