This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
YASMIN/ui/debug/PlotWiFiScan.cpp
kazu 075d8bb633 a lot!!! of changes
added main menu
added debug display
many debug widgets for plotting live data
worked on android live sensors
added offline-data sensor feeding
some dummy data sensors
worked on the map display
added ui debug for grid-points, particles and weights
added a cool dude to display the estimation
added real filtering based on the Indoor components
c++11 fixes for android compilation
online and offline filtering support
new resampling technique for testing
map loading via dialog
2016-09-16 19:30:04 +02:00

54 lines
1.1 KiB
C++

#include "../misc/fixc11.h"
#include "PlotWiFiScan.h"
#include <QPainter>
#include <QStaticText>
PlotWiFiScan::PlotWiFiScan(QWidget *parent) : QWidget(parent) {
setMinimumWidth(96);
setMinimumHeight(96);
//setAutoFillBackground(false);
}
void PlotWiFiScan::add(const Timestamp ts, const WiFiMeasurements& data) {
(void) ts;
this->data = data;
QMetaObject::invokeMethod(this, "update", Qt::QueuedConnection);
}
void PlotWiFiScan::paintEvent(QPaintEvent* evt) {
(void) evt;
QPainter p(this);
const int x0 = 4; const int xw = 150;
const int y0 = 3;
const int lh = 13;
int x = x0;
int y = y0;
p.fillRect(0,0,width(),height(),QColor(255,255,255,192));
p.setPen(Qt::black);
p.drawRect(0,0,width()-1,height()-1);
const QFont font("Arial", 9);
p.setFont(font);
p.setPen(Qt::black);
for (const WiFiMeasurement& m : data.entries) {
const std::string& mac = m.getAP().getMAC().asString();
std::string str = mac + ": " + std::to_string((int)m.getRSSI());
p.drawStaticText(x, y, QStaticText(str.c_str()));
y += lh;
if (y > 90) {y = y0; x += xw;}
}
p.end();
}