source: trunk/FACT++/gui/BasicGlCamera.h@ 12219

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