Aperture/mycanvas.h

49 lines
1 KiB
C
Raw Permalink Normal View History

2023-05-16 14:58:12 +00:00
#ifndef MYCANVAS_H
#define MYCANVAS_H
#include <QChart>
#include <QChartView>
2023-05-17 23:08:48 +00:00
#include <QPaintEvent>
#include <QPainter>
#include <QScatterSeries>
2023-05-16 14:58:12 +00:00
#include <QValueAxis>
2023-05-17 23:08:48 +00:00
#include <QWidget>
#include <qwidget.h>
2023-05-16 14:58:12 +00:00
#include "RadarExt.h"
2023-05-17 23:08:48 +00:00
struct TColPoint {
double x, y, amp;
QColor col;
2023-05-16 14:58:12 +00:00
};
2023-05-17 23:08:48 +00:00
class ToPaintState {
2023-05-16 14:58:12 +00:00
public:
2023-05-17 23:08:48 +00:00
ToPaintState() {}
ToPaintState(int type) : type(type) {}
2023-05-16 14:58:12 +00:00
2023-05-17 23:08:48 +00:00
int type = 0;
double pointSize = 5;
double axisX = 1;
double axisY = 1;
2023-05-16 14:58:12 +00:00
};
2023-05-17 23:08:48 +00:00
class MyCanvas : public QWidget {
Q_OBJECT
2023-05-16 14:58:12 +00:00
public:
2023-05-17 23:08:48 +00:00
explicit MyCanvas(QWidget *parent = nullptr);
TRadar radar = TRadar();
QVector<QVector<TColPoint>> FDNMass;
void drawState(ToPaintState);
2023-05-24 00:04:44 +00:00
void ColorAxis(QPaintEvent *event, QPainter *painter, double step, double max);
2023-05-17 23:08:48 +00:00
private:
ToPaintState state = ToPaintState();
QRectF transposeRect(double x, double y, double x2, double y2, double axisX, double axisY);
QPointF transposePoint(double x, double y, double axisX, double axisY);
protected:
void paintEvent(QPaintEvent *event);
2023-05-16 14:58:12 +00:00
};
#endif // MYCANVAS_H