Commit 3c2750f0 authored by pixhawk's avatar pixhawk

Performance improvements to widgets, added coordinate frame to 3D widget

parent d8ef1095
......@@ -100,7 +100,7 @@ HSIDisplay::HSIDisplay(QWidget *parent) :
topMargin(3.0f)
{
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*)));
refreshTimer->setInterval(60);
refreshTimer->setInterval(120);
// this->setScene(new QGraphicsScene(-metricWidth/2.0f, -metricWidth/2.0f, metricWidth, metricWidth, this));
......
......@@ -213,8 +213,8 @@ public:
static const int SCALE_BEST_FIT = 1;
static const int SCALE_LOGARITHMIC = 2;
static const int DEFAULT_REFRESH_RATE = 40; ///< The default refresh rate is 25 Hz / every 100 ms
static const int DEFAULT_PLOT_INTERVAL = 1000 * 15; ///< The default plot interval is 15 seconds
static const int DEFAULT_REFRESH_RATE = 50; ///< The default refresh rate is 25 Hz / every 100 ms
static const int DEFAULT_PLOT_INTERVAL = 1000 * 12; ///< The default plot interval is 15 seconds
static const int DEFAULT_SCALE_INTERVAL = 1000 * 5;
public slots:
......
......@@ -90,7 +90,7 @@ updateTimer(new QTimer())
connect(this, SIGNAL(plotWindowPositionUpdated(int)), scrollbar, SLOT(setValue(int)));
connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(setPlotWindowPosition(int)));
updateTimer->setInterval(100);
updateTimer->setInterval(300);
connect(updateTimer, SIGNAL(timeout()), this, SLOT(refresh()));
updateTimer->start();
}
......@@ -247,13 +247,13 @@ void LinechartWidget::refresh()
str.sprintf("%+.2f", activePlot->getMean(j.key()));
j.value()->setText(str);
}
QMap<QString, QLabel*>::iterator k;
for (k = curveMedians->begin(); k != curveMedians->end(); ++k)
{
// Median
str.sprintf("%+.2f", activePlot->getMedian(k.key()));
k.value()->setText(str);
}
// QMap<QString, QLabel*>::iterator k;
// for (k = curveMedians->begin(); k != curveMedians->end(); ++k)
// {
// // Median
// str.sprintf("%+.2f", activePlot->getMedian(k.key()));
// k.value()->setText(str);
// }
}
......@@ -397,11 +397,11 @@ QWidget* LinechartWidget::createCurveItem(QString curve)
curveMeans->insert(curve, mean);
horizontalLayout->addWidget(mean);
// Median
median = new QLabel(form);
value->setNum(0.00);
curveMedians->insert(curve, median);
horizontalLayout->addWidget(median);
// // Median
// median = new QLabel(form);
// value->setNum(0.00);
// curveMedians->insert(curve, median);
// horizontalLayout->addWidget(median);
/* Color picker
QColor color = QColorDialog::getColor(Qt::green, this);
......@@ -418,7 +418,7 @@ QWidget* LinechartWidget::createCurveItem(QString curve)
horizontalLayout->setStretchFactor(label, 80);
horizontalLayout->setStretchFactor(value, 50);
horizontalLayout->setStretchFactor(mean, 50);
horizontalLayout->setStretchFactor(median, 50);
// horizontalLayout->setStretchFactor(median, 50);
// Connect actions
QObject::connect(checkBox, SIGNAL(clicked(bool)), this, SLOT(takeButtonClick(bool)));
......
......@@ -481,18 +481,6 @@ Q3DWidget::initializeGL(void)
glEnable(GL_LIGHT0);
glDisable(GL_LIGHTING);
glEnable(GL_NORMALIZE);
// TODO: Added these, please check
glEnable(GL_MULTISAMPLE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_LINE_SMOOTH);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
}
void
......
......@@ -286,17 +286,33 @@ QMap3DWidget::drawPlatform(float roll, float pitch, float yaw)
{
glPushMatrix();
glRotatef(yaw, 0.0f, 0.0f, 1.0f);
glRotatef(pitch, 0.0f, 1.0f, 0.0f);
glRotatef(roll, 1.0f, 0.0f, 0.0f);
glRotatef((yaw*180.0f)/M_PI, 0.0f, 0.0f, 1.0f);
glRotatef((pitch*180.0f)/M_PI, 0.0f, 1.0f, 0.0f);
glRotatef((roll*180.0f)/M_PI, 1.0f, 0.0f, 0.0f);
glLineWidth(3.0f);
glColor3f(0.0f, 1.0f, 0.0f);
// X AXIS
glColor3f(1.0f, 0.0f, 0.0f);
glBegin(GL_LINES);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(0.3f, 0.0f, 0.0f);
glEnd();
// Y AXIS
glColor3f(0.0f, 1.0f, 0.0f);
glBegin(GL_LINES);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(0.0f, 0.15f, 0.0f);
glEnd();
// Z AXIS
glColor3f(0.0f, 0.0f, 1.0f);
glBegin(GL_LINES);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(0.0f, 0.0f, 0.15f);
glEnd();
cheetahModel->draw();
glPopMatrix();
......
......@@ -331,7 +331,8 @@ void UASView::updateLoad(UASInterface* uas, double load)
void UASView::refresh()
{
//setUpdatesEnabled(false);
setUpdatesEnabled(true);
//setUpdatesEnabled(true);
//repaint();
static quint64 lastupdate = 0;
qDebug() << "UASVIEW update diff: " << MG::TIME::getGroundTimeNow() - lastupdate;
......@@ -438,8 +439,8 @@ void UASView::refresh()
m_ui->heartbeatIcon->setStyleSheet(colorstyle);
m_ui->heartbeatIcon->setAutoFillBackground(true);
//setUpdatesEnabled(true);
repaint();
setUpdatesEnabled(false);
//setUpdatesEnabled(false);
}
void UASView::changeEvent(QEvent *e)
......
......@@ -99,7 +99,7 @@ protected:
float lon;
float alt;
float groundDistance;
static const int updateInterval = 180;
static const int updateInterval = 300;
void mouseDoubleClickEvent (QMouseEvent * event);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment