-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMapWidget.h
95 lines (71 loc) · 2.35 KB
/
MapWidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//
// MapWidget.h: Map widget
// Copyright (C) 2022 Gonzalo José Carracedo Carballal
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program. If not, see
// <http://www.gnu.org/licenses/>
//
#ifndef MAPWIDGET_H
#define MAPWIDGET_H
#include <QWidget>
#include <vector>
class MapWidget : public QWidget
{
Q_OBJECT
public:
enum Channel {
MAP_WIDGET_CHANNEL_A,
MAP_WIDGET_CHANNEL_B
};
private:
Channel channel = MAP_WIDGET_CHANNEL_A;
QRgb colormap[256];
bool haveGeometry = false;
float pxToLine = 0;
unsigned int lineOff = 0;
bool autoScroll = true;
bool falseColor = false;
QPixmap mapPixmap;
std::vector<uint8_t> channelAdata;
std::vector<uint8_t> channelBdata;
std::vector<QRgb> falseColorData;
void redrawChannel(Channel);
void redrawChannels();
void redrawFalseColor();
void recalcFalseColor();
std::vector<uint8_t> *getData(void);
const std::vector<uint8_t> *getData(void) const;
void paintEvent(QPaintEvent *ev) override;
void resizeEvent(QResizeEvent *ev) override;
public:
explicit MapWidget(QWidget *parent = 0);
void pushLine(Channel, const uint8_t *, size_t, bool highsnr = true);
void setGradient(QColor const *gradient);
void setFalseColorEnabled(bool);
bool isFalseColorEnabled(void) const;
void setAutoScrollEnabled(bool);
bool isAutoScrollEnabled(void) const;
void setCurrentChannel(Channel);
Channel currentChannel(void) const;
void setOffset(unsigned int);
unsigned int offset(void) const;
unsigned int lines(void) const;
unsigned int viewPortLines(void) const;
void saveTo(QString);
signals:
void geometryChanged();
void offsetChanged(int);
public slots:
};
#endif // MAPWIDGET_H