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

Last change on this file since 18577 was 15251, checked in by tbretz, 12 years ago
Update include path to PixelMap
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 <vector>
12
13#include <QtOpenGL/QGLWidget>
14
15#include "externals/PixelMap.h"
16
17class QMouseEvent;
18class QRadioButton;
19class QLabel;
20class QButtonGroup;
21
22///structure for storing edges of hexagons (for blurry display)
23struct edge
24{
25 int first;
26 int second;
27};
28
29///structure for storing neighbors of pixels. For camera position calculation and blurry display
30struct PixelsNeighbors
31{
32 //neighbors. clockwise, starting from top
33 int neighbors[6];
34 PixelsNeighbors()
35 {
36 for (int i=0;i<6;i++)
37 neighbors[i] = -1;
38 }
39 int& operator[](int index){return neighbors[index];}
40};
41
42class BasicGlCamera : public QGLWidget
43{
44 Q_OBJECT
45
46public:
47 BasicGlCamera(QWidget* parent = 0);
48 ~BasicGlCamera();
49
50 int fWhite;
51 int fWhitePatch;
52
53 int64_t fMin;
54 int64_t fMax;
55 float fScaleLimit;
56 void setAutoscaleLowerLimit(float);
57
58 int fTextSize;
59
60 static PixelMap fPixelMap;
61 static int pixelsPatch[NPIX];
62
63 bool pixelColorUpToDate;
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
87 bool fTextEnabled;
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
94public 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
106Q_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
115protected:
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
129 int fPixelStride;
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;
158 QLabel* colorPaletteLabel;
159 QLabel* rotationLabel;
160 QButtonGroup* scaleGroup;
161 QButtonGroup* colorGroup;
162 QButtonGroup* rotationGroup;
163
164
165 bool logScale;
166 int cameraRotation;
167 void buildVerticesList();
168 virtual void buildPatchesIndices();
169 void updateNeighbors(int currentPixel);
170 void calculatePixelsCoords();
171 float viewSize;
172 bool autoRefresh;
173
174 private:
175 void skipPixels(int start, int howMany);
176 float hexRadius;
177 float hexTolerance;
178 int numVertices;
179 protected:
180 float fmin, fmax, fmean, frms, fmedian;
181
182
183};
184
185#endif
Note: See TracBrowser for help on using the repository browser.