FACT++  1.0
BasicGlCamera.h
Go to the documentation of this file.
1 #ifndef BASIC_GL_CAMERA_H_
2 #define BASIC_GL_CAMERA_H_
3 
4 #define NBOARDS 40 // max. number of boards
5 #define NPIX 1440 // max. number of pixels
6 #define NTMARK 160 // max. number of timeMarker signals
7 
8 #define MAX_NUM_PIXELS 1600
9 #define ACTUAL_NUM_PIXELS 1440
10 
11 #include <vector>
12 
13 #include <QtOpenGL/QGLWidget>
14 
15 #include "externals/PixelMap.h"
16 
17 class QMouseEvent;
18 class QRadioButton;
19 class QLabel;
20 class QButtonGroup;
21 
23 struct edge
24 {
25  int first;
26  int second;
27 };
28 
31 {
32  //neighbors. clockwise, starting from top
33  int neighbors[6];
35  {
36  for (int i=0;i<6;i++)
37  neighbors[i] = -1;
38  }
39  int& operator[](int index){return neighbors[index];}
40 };
41 
42 class BasicGlCamera : public QGLWidget
43 {
44  Q_OBJECT
45 
46 public:
47  BasicGlCamera(QWidget* parent = 0);
48  ~BasicGlCamera();
49 
50  int fWhite;
52 
53  int64_t fMin;
54  int64_t fMax;
55  float fScaleLimit;
56  void setAutoscaleLowerLimit(float);
57 
58  int fTextSize;
59 
61  static int pixelsPatch[NPIX];
62 
64 
65  GLfloat patchColour[3];
66  GLfloat pixelContourColour[3];
67  GLfloat patchesCoulour[3];
68  GLfloat highlightedPatchesCoulour[3];
69  GLfloat highlightedPixelsCoulour[3];
70  GLfloat tooHighValueCoulour[3];
71  GLfloat tooLowValueCoulour[3];
72 
73  std::string dataText;
74  std::string unitsText;
75  std::string titleText;
76 
77  void setUnits(const std::string& units);
78  void setTitle(const std::string& title);
79  void SetWhite(int idx);
80  void SetMin(int64_t min);
81  void SetMax(int64_t max);
82  void SetAutoRefresh(bool on);
83  void updateCamera();
84  void assignPixelMap(const PixelMap& );
85  void enableText(bool);
86 
88 
89  float ss[5];// = {0.00, 0.25, 0.5, 0.75, 1.00};
90  float rr[5];// = {0.15, 0.00, 0.00, 1.00, 0.85};
91  float gg[5];// = {0.15, 0.00, 1.00, 0.00, 0.85};
92  float bb[5];// = {0.15, 1.00, 0.00, 0.00, 0.85};
93 
94 public Q_SLOTS:
95  void linearScalePlease(bool);
96  void logScalePlease(bool);
97  void regularPalettePlease(bool);
98  void prettyPalettePlease(bool);
99  void greyScalePalettePlease(bool);
100  void glowingPalettePlease(bool);
101  void zeroRotationPlease(bool);
102  void plus90RotationPlease(bool);
103  void minus90RotationPlease(bool);
104  void timedUpdate();
105 
106 Q_SIGNALS:
107  void signalCurrentPixel(int pixel);
108  void signalPixelMoveOver(int pixel);
109  void signalPixelDoubleClick(int pixel);
110  void colorPaletteHasChanged();
111  void signalUpdateCamera();
112 
113 
114 
115 protected:
116  virtual void initializeGL();
117  virtual void resizeGL(int width, int height);
118  virtual void paintGL();
119  virtual void mousePressEvent(QMouseEvent *event);
120  virtual void mouseMoveEvent(QMouseEvent *event);
121  virtual void mouseDoubleClickEvent(QMouseEvent *event);
122  virtual void drawCamera(bool alsoWire);
123  virtual void drawPatches();
124  virtual void setPatchColor(int id, float color[3]);
125  virtual int PixelAtPosition(const QPoint &pos);
126  virtual void DrawCameraText();
127  void drawHexagon(int index, bool solid);
128 
130  int fcSlice;
131  std::vector<double>fData;
132 
133  // bool recalcColorPlease;
134  static GLfloat pixelsCoords[MAX_NUM_PIXELS][3];
135  static PixelsNeighbors neighbors[MAX_NUM_PIXELS];
136  static int hardwareMapping[NPIX];
137  GLfloat pixelsColor[NPIX][3];
138  static GLfloat verticesList[NPIX*6][2];
139  static std::vector<edge> patchesIndices[160];
140  static int verticesIndices[NPIX][6];
141  static int softwareMapping[NPIX];
142  float shownSizex;
143  float shownSizey;
144  float pixelSize;
145  virtual void UpdateText();
146  void DrawScale();
147  void toggleInterfaceDisplay();
148  QRadioButton* linearButton;
149  QRadioButton* logButton;
150  QRadioButton* regularPaletteButton;
151  QRadioButton* prettyPaletteButton;
152  QRadioButton* greyScalePaletteButton;
153  QRadioButton* glowingPaletteButton;
154  QRadioButton* zeroRotationButton;
155  QRadioButton* minus90RotationButton;
156  QRadioButton* plus90Rotationbutton;
157  QLabel* scaleLabel;
159  QLabel* rotationLabel;
160  QButtonGroup* scaleGroup;
161  QButtonGroup* colorGroup;
162  QButtonGroup* rotationGroup;
163 
164 
165  bool logScale;
167  void buildVerticesList();
168  virtual void buildPatchesIndices();
169  void updateNeighbors(int currentPixel);
170  void calculatePixelsCoords();
171  float viewSize;
173 
174  private:
175  void skipPixels(int start, int howMany);
176  float hexRadius;
179  protected:
180  float fmin, fmax, fmean, frms, fmedian;
181 
182 
183 };
184 
185 #endif
int start(int initState)
Definition: feeserver.c:1740
QRadioButton * minus90RotationButton
QButtonGroup * colorGroup
int first
Definition: BasicGlCamera.h:25
QRadioButton * linearButton
structure for storing edges of hexagons (for blurry display)
Definition: BasicGlCamera.h:23
int i
Definition: db_dim_client.c:21
QRadioButton * glowingPaletteButton
structure for storing neighbors of pixels. For camera position calculation and blurry display ...
Definition: BasicGlCamera.h:30
QLabel * rotationLabel
int & operator[](int index)
Definition: BasicGlCamera.h:39
int second
Definition: BasicGlCamera.h:26
std::string dataText
Definition: BasicGlCamera.h:73
#define MAX_NUM_PIXELS
Definition: BasicGlCamera.h:8
QRadioButton * logButton
QRadioButton * zeroRotationButton
std::vector< double > fData
std::string titleText
Definition: BasicGlCamera.h:75
QLabel * scaleLabel
#define NPIX
Definition: BasicGlCamera.h:5
QButtonGroup * scaleGroup
QLabel * colorPaletteLabel
float height
Definition: HeadersGPS.h:26
QRadioButton * regularPaletteButton
QButtonGroup * rotationGroup
static PixelMap fPixelMap
Definition: BasicGlCamera.h:60
function color(col)
Definition: color.js:31
QRadioButton * prettyPaletteButton
QRadioButton * greyScalePaletteButton
QRadioButton * plus90Rotationbutton
bool pixelColorUpToDate
Definition: BasicGlCamera.h:63
std::string unitsText
Definition: BasicGlCamera.h:74