2 ******************************************************************************
4 * @file mixercurvewidget.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * @addtogroup GCSPlugins GCS Plugins
8 * @addtogroup UAVObjectWidgetUtils Plugin
10 * @brief Utility plugin for UAVObject to Widget relation management
11 *****************************************************************************/
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #ifndef MIXERCURVEWIDGET_H_
29 #define MIXERCURVEWIDGET_H_
32 #include <QGraphicsView>
33 #include <QtSvg/QSvgRenderer>
34 #include <QtSvg/QGraphicsSvgItem>
35 #include <QtCore/QPointer>
36 #include "mixercurvepoint.h"
37 #include "mixercurveline.h"
38 #include "uavobjectwidgetutils_global.h"
40 class UAVOBJECTWIDGETUTILS_EXPORT MixerCurveWidget
: public QGraphicsView
{
44 static const int NODE_NUMELEM
= 5;
46 MixerCurveWidget(QWidget
*parent
= 0);
49 friend class MixerCurve
;
51 void itemMoved(double itemValue
); // Callback when a point is moved, to be updated
52 void initCurve(const QList
<double> *points
);
53 QList
<double> getCurve();
54 void initLinearCurve(int numPoints
, double maxValue
= 1, double minValue
= 0);
55 void setCurve(const QList
<double> *points
);
56 void setMin(double value
);
58 void setMax(double value
);
60 double setRange(double min
, double max
);
63 void setXAxisLabel(QString label
);
64 void setYAxisLabel(QString label
);
68 void curveMinChanged(double value
);
69 void curveMaxChanged(double value
);
72 void showEvent(QShowEvent
*event
);
73 void resizeEvent(QResizeEvent
*event
);
74 void changeEvent(QEvent
*event
);
77 void positionAxisLabels();
80 QGraphicsSvgItem
*m_plot
;
81 QGraphicsTextItem
*m_xAxisTextItem
;
82 QGraphicsTextItem
*m_yAxisTextItem
;
84 QList
<Edge
*> m_edgeList
;
85 QList
<MixerNode
*> m_nodeList
;
87 QString m_xAxisString
;
88 QString m_yAxisString
;
94 void initNodes(int numPoints
);
95 void setupXAxisLabel();
96 void setupYAxisLabel();
97 void setPositiveColor(QString color
);
98 void setNegativeColor(QString color
);
100 void resizeCommands();
102 #endif /* MIXERCURVEWIDGET_H_ */