You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWATI/Include/iPlot/iPlotWxT/iPlotBaseWxT.h

115 lines
2.8 KiB
C

#pragma once
#include "Defines.h"
#include "IxSerDes.h"
#include "ZxXpf.h"
#include "ZxSerializer.h"
#include "iPlotWxT_global.h"
class tCurvePlotScene;
class tCurvePlotView;
class ZxPlot;
class ZxObjCurve;
class tCurveObjFlow;
class ZxSubAxisBase;
class ZxObjCurveBase;
// 这是最基础的绘图窗体
class I_PLOTWX_T_EXPORT iPlotBaseWxT : public QWidget,
virtual public IxSerDes
{
Q_OBJECT
public:
explicit iPlotBaseWxT(QWidget *parent = 0);
~iPlotBaseWxT();
// 初始化UI
virtual void initUI(QString sTitle,
QSize szDefault = QSize(265, 203));
virtual void clearAllPlots();
public:
// 坐标轴相关设置
virtual void setAxisX(QString sName, QString sUnit = "");
virtual void setAxisY(QString sName, QString sUnit = "", bool bY2 = false);
virtual void setAxisXY(int nIndexXY, QString sName, QString sUnit = "");
virtual void setAxisScaleX(float fMin, float fMax, VecFloat& vecTicks);
virtual void setAxisScaleY(float fMin, float fMax, VecFloat& vecTicks);
virtual void setAxisScaleY2(float fMin, float fMax, VecFloat& vecTicks);
virtual void setAxisScaleXY(int nIndexXY, float& fMin, float& fMax, VecFloat& vecTicks);
virtual void setAxisXYLog(bool bLogAxis, int nIndexXY);
// nIndexXY:0 x轴1 左侧y轴2 右侧y轴
ZxSubAxisBase* getAxisOf(int nIndexXY);
void copyAxisScalesTo(iPlotBaseWxT* pDest, int nIndexXY = -1);
// 设置x轴的基准时间
void setAxisBaseDtX(QDateTime dt);
QDateTime getAxisBaseDtX() const;
virtual void connectSignals();
// 序列化
virtual void onSerialize(ZxSerializer* ser);
virtual void onDeserialize(ZxSerializer* ser);
virtual void resetAfterDeserialized();
protected:
virtual void initChartView(QString sTitle, QSize szDefault);
virtual void resizeEvent(QResizeEvent *);
virtual void paintEvent(QPaintEvent *);
// 窗体关闭的情形
virtual void closeEvent(QCloseEvent *);
// 处理Resize主要是正方形网格
bool changeToSize(QSize sz, bool bResizeMode);
public slots:
virtual void slotChangeSizeWithChangedXY();
// 缩放复原
virtual void zoomReset();
signals:
void sigZoomReset();
// 在关闭的消息函数中触发
void sigConfirmClosing(bool& bClosable);
public:
// 内部变量
tCurvePlotView* m_pPlotView;
tCurvePlotScene* m_pPlotScene;
ZxPlot* m_pPlot;
protected:
QLayout* m_pMainLayout;
// 记录各坐标轴原始状态
// 为了回归原始
float m_fMaxX;
float m_fMinX;
float m_fMaxY;
float m_fMinY;
float m_fMaxY2;
float m_fMinY2;
VecFloat m_vecTicksX;
VecFloat m_vecTicksY;
VecFloat m_vecTicksY2;
// 信号槽标识开关
bool m_bUnableSP;
// 是否启用新的样式表ZXF202407
bool m_bNovelQss;
};