109 lines
3.8 KiB
C++
109 lines
3.8 KiB
C++
#pragma once
|
|
#include "HoverInfo.h"
|
|
#include "Spectrum.h"
|
|
|
|
|
|
namespace YSG {
|
|
class FrequentAxis;
|
|
struct SpectrumPrivate;
|
|
class LIB_DECL Spectrum : public RenderAble, public HoverInfoRenderAble<Spectrum> {
|
|
public:
|
|
Q_Ptr2(Spectrum)
|
|
PROP(FrequentAxis*, frequentAxis)
|
|
PROP(Axis*, powerAxis);
|
|
PROP(int, frequentPointSize);
|
|
PROP(Range, frequentRange);
|
|
PROP(double, middleSweepFrequent);
|
|
PROP(Range, sweepFrequentRange);
|
|
PROP(bool, useMaxLine);
|
|
PROP(bool, useMinLine);
|
|
PROP(bool, useMaxMarker);
|
|
PROP(bool, useMinMarker);
|
|
PROP(bool, useSweepFrequentRect);
|
|
PROP(QBrush, maxBrush);
|
|
PROP(QBrush, curBrush);
|
|
PROP(QBrush, minBrush);
|
|
PROP(QPen, maxPen);
|
|
PROP(QPen, curPen);
|
|
PROP(QPen, minPen);
|
|
PROP(QPen, selectMarkerPen);
|
|
PROP(QPen, markerPen);
|
|
PROP(QPen, middleFrequentPen);
|
|
PROP(QBrush, sweepRectBrush);
|
|
void giveData(const QVector<double> &lineData);
|
|
double getPower(double frequent, bool& ok, SRC=SRC::Edit);
|
|
void addCustomMarker(double frequent);
|
|
void addCustomLineMarker(double frequent);
|
|
void removeCustomMarker(double frequent);
|
|
void removeCurrentMarker(SRC=SRC::Edit);
|
|
void clearAllCustomMarker(SRC=SRC::Edit);
|
|
int selectLineMarkerSize(SRC=SRC::Edit);
|
|
int curSelectMarkerIndex(SRC=SRC::Edit);
|
|
void setSelectedLineMarker(int markerIndex);
|
|
void selectNext(SRC=SRC::Edit);
|
|
void unSelectMarker(SRC=SRC::Edit);
|
|
void selectPrevious(SRC=SRC::Edit);
|
|
double getMarkFrequent(int markIndex, SRC=SRC::Edit);
|
|
void setMarkerFrequent(int markerIndex, double frequent);
|
|
void setCurrentMarkerFrequent(double frequent);
|
|
struct Builder;
|
|
};
|
|
|
|
struct Spectrum_PROP {
|
|
FrequentAxis *frequentAxis{};
|
|
Axis *powerAxis{};
|
|
int frequentPointSize{};
|
|
Range frequentRange{};
|
|
double middleSweepFrequent = 50;
|
|
Range sweepFrequentRange{40, 60};
|
|
bool useMaxLine = false;
|
|
bool useMinLine = false;
|
|
bool useMaxMarker = false;
|
|
bool useMinMarker = false;
|
|
bool useSweepFrequentRect = false;
|
|
QBrush maxBrush;
|
|
QBrush curBrush;
|
|
QBrush minBrush;
|
|
QPen maxPen = QPen(Qt::red);
|
|
QPen curPen = QPen(Qt::green);
|
|
QPen minPen = QPen(Qt::white);
|
|
QPen selectMarkerPen = QPen(Qt::darkBlue, 2);
|
|
QPen markerPen = QPen(Qt::red);
|
|
QPen middleFrequentPen = QPen(Qt::red);
|
|
QBrush sweepRectBrush = QBrush(QColor(255, 255, 0, 100));
|
|
Spectrum_PROP() {
|
|
maxBrush = QBrush(QColor(), Qt::NoBrush);
|
|
curBrush = QBrush(QColor(), Qt::NoBrush);
|
|
minBrush = QBrush(QColor(), Qt::NoBrush);
|
|
}
|
|
};
|
|
struct LIB_DECL Spectrum::Builder : Spectrum_PROP {
|
|
PROP_B(FrequentAxis*, frequentAxis)
|
|
PROP_B(Axis*, powerAxis);
|
|
PROP_B(int, frequentPointSize);
|
|
PROP_B(Range, frequentRange);
|
|
PROP_B(double, middleSweepFrequent);
|
|
PROP_B(Range, sweepFrequentRange);
|
|
PROP_B(bool, useMaxLine);
|
|
PROP_B(bool, useMinLine);
|
|
PROP_B(bool, useMaxMarker);
|
|
PROP_B(bool, useMinMarker);
|
|
PROP_B(bool, useSweepFrequentRect);
|
|
PROP_B(QBrush, maxBrush);
|
|
PROP_B(QBrush, curBrush);
|
|
PROP_B(QBrush, minBrush);
|
|
PROP_B(QPen, maxPen);
|
|
PROP_B(QPen, curPen);
|
|
PROP_B(QPen, minPen);
|
|
PROP_B(QPen, selectMarkerPen);
|
|
PROP_B(QPen, markerPen);
|
|
PROP_B(QPen, middleFrequentPen);
|
|
PROP_B(QBrush, sweepRectBrush);
|
|
SETTER(QString, layerName, "plottable")
|
|
Builder(FrequentAxis* frequentAxis, Axis* axis);
|
|
Spectrum* build();
|
|
protected:
|
|
Plot *plot{};
|
|
};
|
|
}
|