2012-03-08 15:10:25 +00:00
|
|
|
#ifndef _PAYSAGES_QT_WIDGETCURVEEDITOR_H_
|
|
|
|
#define _PAYSAGES_QT_WIDGETCURVEEDITOR_H_
|
|
|
|
|
|
|
|
#include <QWidget>
|
2012-03-31 11:32:03 +00:00
|
|
|
#include <QColor>
|
2012-03-08 15:10:25 +00:00
|
|
|
#include "../lib_paysages/curve.h"
|
|
|
|
|
|
|
|
class WidgetCurveEditor : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2012-06-17 09:40:40 +00:00
|
|
|
WidgetCurveEditor(QWidget* parent, double xmin, double xmax, double ymin, double ymax);
|
2012-03-08 15:10:25 +00:00
|
|
|
~WidgetCurveEditor();
|
|
|
|
|
2012-06-27 12:49:51 +00:00
|
|
|
void setAxisLabels(QString xlabel, QString ylabel);
|
|
|
|
|
2012-03-08 15:56:44 +00:00
|
|
|
void setCurve(Curve* curve);
|
|
|
|
void getCurve(Curve* curve);
|
|
|
|
|
2012-03-31 11:32:03 +00:00
|
|
|
void setPenColor(QColor color);
|
|
|
|
|
2012-03-29 20:19:50 +00:00
|
|
|
signals:
|
|
|
|
void liveChanged();
|
|
|
|
|
2012-03-08 15:10:25 +00:00
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent* event);
|
2012-03-29 20:19:50 +00:00
|
|
|
void mousePressEvent(QMouseEvent* event);
|
|
|
|
void mouseMoveEvent(QMouseEvent* event);
|
|
|
|
void mouseReleaseEvent(QMouseEvent* event);
|
2012-03-31 11:32:03 +00:00
|
|
|
void mouseDoubleClickEvent(QMouseEvent* event);
|
2012-03-08 15:10:25 +00:00
|
|
|
|
|
|
|
private:
|
2012-07-03 09:15:15 +00:00
|
|
|
void curveToScreen(double curve_x, double curve_y, int* screen_x, int* screen_y);
|
|
|
|
void screenToCurve(int screen_x, int screen_y, double* curve_x, double* curve_y);
|
2012-03-31 11:32:03 +00:00
|
|
|
int getPointAt(int x, int y);
|
|
|
|
|
2012-07-03 09:15:15 +00:00
|
|
|
double _xmin;
|
|
|
|
double _xmax;
|
|
|
|
double _ymin;
|
|
|
|
double _ymax;
|
2012-03-08 15:10:25 +00:00
|
|
|
Curve* _curve;
|
2012-03-29 20:19:50 +00:00
|
|
|
int _dragged;
|
2012-03-31 11:32:03 +00:00
|
|
|
QColor _pen;
|
2012-06-27 12:49:51 +00:00
|
|
|
QString _xlabel;
|
|
|
|
QString _ylabel;
|
2012-03-08 15:10:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|