2011-03-29 22:32:09 +02:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file mixercurvewidget.h
|
2012-02-05 21:07:19 +01:00
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
2011-03-29 22:32:09 +02:00
|
|
|
* @addtogroup GCSPlugins GCS Plugins
|
|
|
|
* @{
|
2012-02-05 21:07:19 +01:00
|
|
|
* @addtogroup UAVObjectWidgetUtils Plugin
|
2011-03-29 22:32:09 +02:00
|
|
|
* @{
|
2012-02-05 21:07:19 +01:00
|
|
|
* @brief Utility plugin for UAVObject to Widget relation management
|
2011-03-29 22:32:09 +02:00
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU 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 General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MIXERCURVEWIDGET_H_
|
|
|
|
#define MIXERCURVEWIDGET_H_
|
|
|
|
|
|
|
|
#include <QGraphicsView>
|
|
|
|
#include <QtSvg/QSvgRenderer>
|
|
|
|
#include <QtSvg/QGraphicsSvgItem>
|
2012-06-19 19:28:42 +02:00
|
|
|
#include <QtCore/QPointer>
|
2011-03-29 22:32:09 +02:00
|
|
|
#include "mixercurvepoint.h"
|
|
|
|
#include "mixercurveline.h"
|
2012-02-05 19:16:38 +01:00
|
|
|
#include "uavobjectwidgetutils_global.h"
|
2011-03-29 22:32:09 +02:00
|
|
|
|
2012-02-05 19:16:38 +01:00
|
|
|
class UAVOBJECTWIDGETUTILS_EXPORT MixerCurveWidget : public QGraphicsView
|
2011-03-29 22:32:09 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
MixerCurveWidget(QWidget *parent = 0);
|
|
|
|
~MixerCurveWidget();
|
|
|
|
void itemMoved(double itemValue); // Callback when a point is moved, to be updated
|
|
|
|
void initCurve (QList<double> points);
|
|
|
|
QList<double> getCurve();
|
2012-06-19 19:28:42 +02:00
|
|
|
void initLinearCurve(quint32 numPoints, double maxValue = 1, double minValue = 0);
|
2011-03-29 22:32:09 +02:00
|
|
|
void setCurve(QList<double>);
|
|
|
|
void setMin(double value);
|
2012-06-20 01:51:22 +02:00
|
|
|
double getMin();
|
2011-03-29 22:32:09 +02:00
|
|
|
void setMax(double value);
|
2012-06-20 01:51:22 +02:00
|
|
|
double getMax();
|
2011-03-29 22:32:09 +02:00
|
|
|
void setRange(double min, double max);
|
|
|
|
|
2012-06-19 19:28:42 +02:00
|
|
|
static const int NODE_NUMELEM = 5;
|
|
|
|
|
2011-03-29 22:32:09 +02:00
|
|
|
signals:
|
|
|
|
void curveUpdated(QList<double>, double );
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
|
|
private:
|
|
|
|
QGraphicsSvgItem *plot;
|
2012-06-19 19:28:42 +02:00
|
|
|
|
|
|
|
QList<Node*> nodePool;
|
|
|
|
QList<Edge*> edgePool;
|
2011-03-29 22:32:09 +02:00
|
|
|
QList<Node*> nodeList;
|
2012-06-19 19:28:42 +02:00
|
|
|
QList<double> points;
|
|
|
|
|
2011-03-29 22:32:09 +02:00
|
|
|
double curveMin;
|
|
|
|
double curveMax;
|
2012-06-19 19:28:42 +02:00
|
|
|
bool curveUpdating;
|
|
|
|
|
|
|
|
void initNodes(int numPoints);
|
|
|
|
Node* getNode(int index);
|
|
|
|
Edge* getEdge(int index, Node* sourceNode, Node* destNode);
|
2011-03-29 22:32:09 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void showEvent(QShowEvent *event);
|
|
|
|
void resizeEvent(QResizeEvent *event);
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
#endif /* MIXERCURVEWIDGET_H_ */
|