1 | #ifndef Q_CAMERA_WIDGET_H_
|
---|
2 | #define Q_CAMERA_WIDGET_H_
|
---|
3 |
|
---|
4 | #include "BasicGlCamera.h"
|
---|
5 | #include <valarray>
|
---|
6 | #include <set>
|
---|
7 |
|
---|
8 | #include <QtGui/QRadioButton>
|
---|
9 | #include <QtGui/QLabel>
|
---|
10 | #include <QtGui/QButtonGroup>
|
---|
11 |
|
---|
12 | using namespace std;
|
---|
13 |
|
---|
14 | class QCameraWidget : public BasicGlCamera
|
---|
15 | {
|
---|
16 | Q_OBJECT
|
---|
17 |
|
---|
18 | typedef pair<double, double> Position;
|
---|
19 | typedef vector<Position> Positions;
|
---|
20 |
|
---|
21 | Positions fGeom;
|
---|
22 |
|
---|
23 | vector<bool> fBold;
|
---|
24 | vector<bool> fEnable;
|
---|
25 |
|
---|
26 | vector<int> highlightedPatches;
|
---|
27 | vector<int> highlightedPixels;
|
---|
28 |
|
---|
29 | int fWhite;
|
---|
30 | int fWhitePatch;
|
---|
31 |
|
---|
32 | int64_t fMin;
|
---|
33 | int64_t fMax;
|
---|
34 |
|
---|
35 | int lastFace;
|
---|
36 |
|
---|
37 | bool pixelColorUpToDate;
|
---|
38 |
|
---|
39 | GLfloat patchColour[3];
|
---|
40 | GLfloat pixelContourColour[3];
|
---|
41 | GLfloat patchesCoulour[3];
|
---|
42 | GLfloat highlightedPatchesCoulour[3];
|
---|
43 | GLfloat highlightedPixelsCoulour[3];
|
---|
44 | GLfloat tooHighValueCoulour[3];
|
---|
45 | GLfloat tooLowValueCoulour[3];
|
---|
46 |
|
---|
47 | string dataText;
|
---|
48 | string unitsText;
|
---|
49 | string titleText;
|
---|
50 |
|
---|
51 | public:
|
---|
52 | void highlightPixel(int idx);
|
---|
53 | void highlightPatch(int idx);
|
---|
54 | void clearHighlightedPatches();
|
---|
55 | void clearHighlightedPixels();
|
---|
56 | void setUnits(const string& units);
|
---|
57 | void setTitle(const string& title);
|
---|
58 | QCameraWidget(QWidget *pparent = 0);
|
---|
59 | void paintGL();
|
---|
60 | void mousePressEvent(QMouseEvent *cEvent);
|
---|
61 | void mouseMoveEvent(QMouseEvent *event);
|
---|
62 | void mouseDoubleClickEvent(QMouseEvent *event);
|
---|
63 | void Reset();
|
---|
64 | void drawCamera(bool alsoWire);
|
---|
65 | void drawPatches();
|
---|
66 | void SetWhite(int idx);
|
---|
67 | void SetEnable(int idx, bool b);
|
---|
68 | double GetData(int idx);
|
---|
69 | void SetMin(int64_t min);
|
---|
70 | void SetMax(int64_t max);
|
---|
71 | const char *GetName();
|
---|
72 |
|
---|
73 | int GetIdx(float px, float py);
|
---|
74 | char *GetObjectInfo(int px, int py);
|
---|
75 |
|
---|
76 | void SetData(const valarray<double> &ddata);
|
---|
77 |
|
---|
78 | public Q_SLOTS:
|
---|
79 | void linearScalePlease(bool);
|
---|
80 | void logScalePlease(bool);
|
---|
81 | void regularPalettePlease(bool);
|
---|
82 | void prettyPalettePlease(bool);
|
---|
83 | void greyScalePalettePlease(bool);
|
---|
84 | void glowingPalettePlease(bool);
|
---|
85 | void zeroRotationPlease(bool);
|
---|
86 | void plus90RotationPlease(bool);
|
---|
87 | void minus90RotationPlease(bool);
|
---|
88 |
|
---|
89 | Q_SIGNALS:
|
---|
90 | void signalCurrentPixel(int pixel);
|
---|
91 | void signalPixelMoveOver(int pixel);
|
---|
92 | void signalPixelDoubleClick(int pixel);
|
---|
93 |
|
---|
94 | private:
|
---|
95 | void CalculatePixelsColor();
|
---|
96 | void CalculatePatchColor();
|
---|
97 | void DrawCameraText();
|
---|
98 | void UpdateText();
|
---|
99 | void DrawScale();
|
---|
100 | void toggleInterfaceDisplay();
|
---|
101 | void repaintInterface();
|
---|
102 | QRadioButton* linearButton;
|
---|
103 | QRadioButton* logButton;
|
---|
104 | QRadioButton* regularPaletteButton;
|
---|
105 | QRadioButton* prettyPaletteButton;
|
---|
106 | QRadioButton* greyScalePaletteButton;
|
---|
107 | QRadioButton* glowingPaletteButton;
|
---|
108 | QRadioButton* zeroRotationButton;
|
---|
109 | QRadioButton* minus90RotationButton;
|
---|
110 | QRadioButton* plus90Rotationbutton;
|
---|
111 | QLabel* scaleLabel;
|
---|
112 | QLabel* colorPaletteLabel;
|
---|
113 | QLabel* rotationLabel;
|
---|
114 | QButtonGroup* scaleGroup;
|
---|
115 | QButtonGroup* colorGroup;
|
---|
116 | QButtonGroup* rotationGroup;
|
---|
117 |
|
---|
118 | bool logScale;
|
---|
119 | int cameraRotation;
|
---|
120 | };
|
---|
121 |
|
---|
122 | typedef QCameraWidget Camera;
|
---|
123 | #endif
|
---|