MatrixDisplayWidget.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package
19 * @author
20 * @date
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24#pragma once
25
26#include <valarray>
27
28#include <QMutex>
29#include <QWidget>
30
31#include <Eigen/Dense>
32
33using Eigen::MatrixXf;
34
35namespace Ui
36{
37 class MatrixDisplayWidget;
38}
39
40namespace armarx
41{
42 class MatrixDisplayWidget : public QWidget
43 {
44 Q_OBJECT
45
46 signals:
47 void doUpdate();
48
49 public slots:
50
51 void
52 setData(MatrixXf data)
53 {
54 mtx.lock();
55 this->data = data;
56 mtx.unlock();
57 //this->update();
58 }
59
60 public:
61 explicit MatrixDisplayWidget(QWidget* parent = 0);
62 ~MatrixDisplayWidget() override;
63 void paintEvent(QPaintEvent*) override;
64
65 void
66 setRange(float min, float max)
67 {
68 this->min = min;
69 this->max = max;
70 }
71
72 QColor getColor(float value, float min, float max);
73
74 void
76 {
77 emit doUpdate();
78 }
79
80 void
81 setInfoOverlay(QString infoOverlay)
82 {
83 mtx.lock();
84 this->infoOverlay = infoOverlay;
85 mtx.unlock();
86 }
87
88 private:
89 Ui::MatrixDisplayWidget* ui;
90 MatrixXf data;
91 float min, max;
92 std::valarray<QColor> colors;
93 QMutex mtx;
94 QString infoOverlay;
95 };
96} // namespace armarx
void paintEvent(QPaintEvent *) override
void setRange(float min, float max)
void setInfoOverlay(QString infoOverlay)
QColor getColor(float value, float min, float max)
ArmarX Headers.
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::vector< T > max(const std::vector< T > &v1, const std::vector< T > &v2)
std::vector< T > min(const std::vector< T > &v1, const std::vector< T > &v2)