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

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