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/PlotTurns.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

50 lines
990 B
C++

#include "PlotTurns.h"
#include <QPainter>
PlotTurns::PlotTurns(QWidget *parent) : QWidget(parent) {
setMinimumWidth(96);
setMinimumHeight(96);
resize(96, 96);
// setMaximumWidth(64);
// setMaximumHeight(64);
}
void PlotTurns::add(const Timestamp ts, const TurnData& data) {
(void) ts;
this->data = data;
static int i = 0;
if (++i % 4 == 0) {
QMetaObject::invokeMethod(this, "update", Qt::QueuedConnection);
}
}
void PlotTurns::paintEvent(QPaintEvent* evt) {
(void) evt;
QPainter p(this);
const float s = std::min(width(), height());
const float s1 = s / 1.9;
const float cx = width() / 2;
const float cy = height() / 2;
const float x1 = cx + std::cos(data.radSinceStart-M_PI_2) * s1;
const float y1 = cy + std::sin(data.radSinceStart-M_PI_2) * s1;
p.fillRect(0,0,width(),height(),QColor(255,255,255,192));
p.setPen(Qt::black);
p.drawRect(0,0,width()-1,height()-1);
const QPen pen(Qt::black, 2);
p.setPen(pen);
p.drawLine(cx, cy, x1, y1);
p.end();
}