Files
seaclient/seaplot.h

98 lines
2.0 KiB
C++

#ifndef SEAPLOT_H
#define SEAPLOT_H
#include <stddef.h>
#include <qwt_plot.h>
#include <qlayout.h>
#include <qbitarray.h>
#include "seaset.h"
class SeaSet;
class SeaData;
class SeaZoomer;
class SeaCurve;
class LegendButton;
class QGrid;
class QLineEdit;
class SeaPlot : public QwtPlot
{
Q_OBJECT
public:
SeaPlot(QWidget *p, SeaSet *set, const QString &name);
void removeAll();
LegendButton *putCurve(SeaData *d, QWidget *parent, LegendButton *legButton = NULL);
int replotRange(double from, double to, double tick);
int replotRange();
void refresh();
void switchBold(SeaCurve *crv);
void setOneBold(SeaCurve *crv);
void showAgain();
SeaSet *set;
QString tag;
void autoZoom(bool on);
QwtDoubleRect undoRect;
void zoomTo(QwtDoubleRect old, QwtDoubleRect &r);
void undoZoom(QwtDoubleRect &r);
bool toggleLinLog();
void autoColors();
long marker;
void setMarker(double x);
bool logarithmic;
QBitArray usedColors;
signals:
void setAutoOff(bool off);
private slots:
void zoomOut();
void zoomMax();
void shiftUp();
void shiftDown();
private:
SeaZoomer *zoom;
double y1, y2;
};
class FlatButton;
class LegendButton : public QwtLegendButton {
Q_OBJECT
public:
LegendButton(QWidget *parent, SeaPlot *plot, SeaCurve *crv);
void init(SeaPlot *plot, SeaCurve *crv);
void setTitle(const QString &title);
FlatButton *label;
QLabel *valueLabel;
SeaPlot *plot;
QTimer clickTimer;
protected:
void mousePressEvent(QMouseEvent *e);
public slots:
void legendClicked();
void longClick();
void handleClickTimer();
void mousePressed();
private:
SeaCurve *crv;
bool clickDone;
};
class SeaCurve : public QwtPlotCurve {
public:
SeaCurve(QwtPlot *parent, const QString &title);
void draw(QPainter *p, const QwtDiMap &xMap, const QwtDiMap &yMap, int from, int to);
void setPen(const QPen &p);
void setTitle(const QString &t);
void yBounds(double from, double to, double &ymin, double &ymax);
void changeBold();
SeaData *data;
bool bold;
int iColor;
bool autoColor;
LegendButton *leg;
};
#endif