|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QPen>
|
|
|
|
|
#include <QFont>
|
|
|
|
|
#include <QColor>
|
|
|
|
|
#include <QVector>
|
|
|
|
|
|
|
|
|
|
#include "Defines.h"
|
|
|
|
|
#include "ZxRenderItem.h"
|
|
|
|
|
#include "ZxDrawHelper.h"
|
|
|
|
|
#include "iPlotBase_global.h"
|
|
|
|
|
|
|
|
|
|
// 该类主要是为了坐标轴在显示方面的复原
|
|
|
|
|
class I_PLOTBASE_EXPORT iAxisTickInfo
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
iAxisTickInfo();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
double m_fMax;
|
|
|
|
|
double m_fMin;
|
|
|
|
|
VecDouble m_vecTicks;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class IxPtyItem;
|
|
|
|
|
class ZxAxisHelper;
|
|
|
|
|
|
|
|
|
|
// 坐标轴基类
|
|
|
|
|
class I_PLOTBASE_EXPORT ZxSubAxisBase : public ZxRenderItem
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
ZX_DECLARE_DYNAMIC
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
ZxSubAxisBase();
|
|
|
|
|
ZxSubAxisBase(const QString& name);
|
|
|
|
|
|
|
|
|
|
ZxSubAxisBase* clone();
|
|
|
|
|
void copyToThis(ZxSubAxisBase *pAxisBase);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
virtual void paintBack(QPainter* painter, const ZxPaintParam& param);
|
|
|
|
|
|
|
|
|
|
// 序列化
|
|
|
|
|
virtual void onSerialize(ZxSerializer* ser);
|
|
|
|
|
virtual void onDeserialize(ZxSerializer* ser);
|
|
|
|
|
|
|
|
|
|
// 模版
|
|
|
|
|
virtual void onLoadTempl(ZxSerializer* ser);
|
|
|
|
|
virtual void onSaveTempl(ZxSerializer* ser);
|
|
|
|
|
|
|
|
|
|
// 属性
|
|
|
|
|
virtual void fillPtyPano(IxPtyPano* sheet);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// 数值转换(屏幕坐标与实际值)
|
|
|
|
|
virtual double getValueForPos(double fPos) const;
|
|
|
|
|
virtual double getPosForValue(double fVal) const;
|
|
|
|
|
|
|
|
|
|
// 标题显示内容
|
|
|
|
|
QString getLabelOfTitle();
|
|
|
|
|
|
|
|
|
|
// 当图形Move时,刷新坐标轴以及发送信号,(仅仅对数坐标有用)
|
|
|
|
|
void runFreshWithLogMove();
|
|
|
|
|
|
|
|
|
|
// 获取坐标轴大刻度的间隔长度,屏幕坐标
|
|
|
|
|
// 为了特征线的默认效果
|
|
|
|
|
virtual double getPerCellLenByPos();
|
|
|
|
|
|
|
|
|
|
// Plot整体移动时的处理,20190222
|
|
|
|
|
void changeRangeWithMove(const QPointF& ptStart, \
|
|
|
|
|
const QPointF& ptEnd);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// 名称
|
|
|
|
|
QString getName(void) const;
|
|
|
|
|
void setName(QString name); //不发送信号
|
|
|
|
|
void setNameEx(QString name); //发送信号
|
|
|
|
|
|
|
|
|
|
// 别名
|
|
|
|
|
QString getAlias(void) const;
|
|
|
|
|
void setAlias(QString name);
|
|
|
|
|
|
|
|
|
|
// 范围
|
|
|
|
|
double getRangeMin(void) const;
|
|
|
|
|
double getRangeMax(void) const;
|
|
|
|
|
void setRangeMin(double f);
|
|
|
|
|
void setRangeMax(double f);
|
|
|
|
|
|
|
|
|
|
// 范围(针对实时增加)
|
|
|
|
|
double getRangeMinEx(void) const;
|
|
|
|
|
double getRangeMaxEx(void) const;
|
|
|
|
|
void setRangeMinEx(double f);
|
|
|
|
|
void setRangeMaxEx(double f);
|
|
|
|
|
|
|
|
|
|
// 主区间
|
|
|
|
|
double getMainInterval(void) const;
|
|
|
|
|
void setMainInterval(double fValue);
|
|
|
|
|
double getMainIntervalCount();
|
|
|
|
|
double getMainInterval(int nIndex);
|
|
|
|
|
|
|
|
|
|
// 到次区间
|
|
|
|
|
double getSubInterval(void) const;
|
|
|
|
|
void setSubInterval(double fValue);
|
|
|
|
|
|
|
|
|
|
// 小数点个数
|
|
|
|
|
int getDecimalNumber(void) const;
|
|
|
|
|
void setDecimalNumber(int n);
|
|
|
|
|
|
|
|
|
|
// 轴类型 log对数,Linear常规
|
|
|
|
|
AxisType getAxisType(void) const;
|
|
|
|
|
void setAxisType(AxisType type);
|
|
|
|
|
int getAxisTypeEx(void) const;
|
|
|
|
|
void setAxisTypeEx(int type);
|
|
|
|
|
|
|
|
|
|
// 轴位置(不涉及属性页,不涉及update,在外界布局中处理)
|
|
|
|
|
AxisPos getAxisPos() const;
|
|
|
|
|
void setAxisPos(AxisPos pos);
|
|
|
|
|
|
|
|
|
|
// 画笔颜色
|
|
|
|
|
QColor getColor(void) const;
|
|
|
|
|
void setColor(QColor clr);
|
|
|
|
|
|
|
|
|
|
// 大刻度个数
|
|
|
|
|
int getBigScaleCount(void) const;
|
|
|
|
|
void setBigScaleCount(int nCount);
|
|
|
|
|
|
|
|
|
|
// 小刻度个数
|
|
|
|
|
int getSmallScaleCount(void) const;
|
|
|
|
|
void setSmallScaleCount(int nCount);
|
|
|
|
|
|
|
|
|
|
// 是否显示刻度
|
|
|
|
|
bool isBigScaleVisible();
|
|
|
|
|
void setBigScaleVisible(bool bVisible);
|
|
|
|
|
bool isSmallScaleVisible();
|
|
|
|
|
void setSmallScaleVisible(bool bVisible);
|
|
|
|
|
void setBigScaleVisibleEx(bool bVisible); //仅仅设置状态,不做其他
|
|
|
|
|
void setSmallScaleVisibleEx(bool bVisible);
|
|
|
|
|
|
|
|
|
|
// 刻度向外
|
|
|
|
|
bool isScaleOutward();
|
|
|
|
|
void setScaleOutward(bool bScaleOutward);
|
|
|
|
|
|
|
|
|
|
// 是否以对数模式显示
|
|
|
|
|
bool isExpTickMode();
|
|
|
|
|
void setExpTickMode(bool b);
|
|
|
|
|
|
|
|
|
|
// 单位
|
|
|
|
|
void setUnit(QString strUnit);
|
|
|
|
|
QString getUnit(void) const;
|
|
|
|
|
|
|
|
|
|
// 标注
|
|
|
|
|
virtual QStringList getTickLabels(void) const;
|
|
|
|
|
virtual void setTickLabels(QStringList list);
|
|
|
|
|
|
|
|
|
|
// 这是设置一些辅助信息,比如Date起始,就是0的位置
|
|
|
|
|
void setTickExs(QVariant o);
|
|
|
|
|
QVariant getTickExs();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 主次刻度的画笔
|
|
|
|
|
QPen getBigGridPen();
|
|
|
|
|
QPen getSmallGridPen();
|
|
|
|
|
|
|
|
|
|
// 名称字体
|
|
|
|
|
void setNameFont(QFont font);
|
|
|
|
|
QFont getNameFont(void) const;
|
|
|
|
|
|
|
|
|
|
// 数字字体
|
|
|
|
|
void setNumberFont(QFont font);
|
|
|
|
|
QFont getNumberFont(void) const;
|
|
|
|
|
|
|
|
|
|
// 指数字体
|
|
|
|
|
QFont getLogIndexFont(void) const;
|
|
|
|
|
void setLogIndexFont(QFont font);
|
|
|
|
|
|
|
|
|
|
// 间隔设置
|
|
|
|
|
void setScaleTicks(VecDouble& vecTicks);
|
|
|
|
|
VecDouble getScaleTicks();
|
|
|
|
|
|
|
|
|
|
// 设置范围和间隔
|
|
|
|
|
void setScaleAndTicks(iAxisTickInfo& o);
|
|
|
|
|
void getScaleAndTicks(iAxisTickInfo& o);
|
|
|
|
|
|
|
|
|
|
// 获取预估大小
|
|
|
|
|
void getPreferedAxisSize(QPainter* painter, \
|
|
|
|
|
double& w, double& h);
|
|
|
|
|
|
|
|
|
|
// 是否竖轴(Y)
|
|
|
|
|
virtual bool isVertical();
|
|
|
|
|
|
|
|
|
|
// 是否最小化
|
|
|
|
|
void setMinimizeAxis(bool b);
|
|
|
|
|
bool isMinimizeAxis();
|
|
|
|
|
|
|
|
|
|
// 是否主轴
|
|
|
|
|
void setMainAxis(bool b);
|
|
|
|
|
bool isMainAxis();
|
|
|
|
|
|
|
|
|
|
// 是否系统轴
|
|
|
|
|
void setSysAxis(bool b);
|
|
|
|
|
bool isSysAxis();
|
|
|
|
|
|
|
|
|
|
// 宽度Span
|
|
|
|
|
double getSpan();
|
|
|
|
|
void setSpan(double f);
|
|
|
|
|
|
|
|
|
|
void setIntervalRatio(double f);
|
|
|
|
|
|
|
|
|
|
// 设置坐标轴的基准时间,通常针对X轴而言
|
|
|
|
|
void setBaseDt(QDateTime dt);
|
|
|
|
|
QDateTime getBaseDt() const;
|
|
|
|
|
|
|
|
|
|
// 框选放大缩小过程中,坐标轴范围的比累计,通常为x轴,这是为了大数据量动态显示用的
|
|
|
|
|
// 不涉及序列化
|
|
|
|
|
double getRectZoomRatio() const;
|
|
|
|
|
void setRectZoomRatio(double f); //设为f
|
|
|
|
|
void resetRectZoomRatio(); //设为1.f
|
|
|
|
|
void accuRectZoomRatio(double f); //累积乘以f
|
|
|
|
|
|
|
|
|
|
ZxAxisHelper* getAxisHelper();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
// 根据类型创建Helper
|
|
|
|
|
virtual void resetHelper();
|
|
|
|
|
|
|
|
|
|
// 把参数传递到Helper(Date类型)
|
|
|
|
|
void setConfigsToDateHelper();
|
|
|
|
|
double adjustConfigsByDateHelper(double& fMin, \
|
|
|
|
|
double& fMax, \
|
|
|
|
|
QVector<double>* pVecTicks = NULL,
|
|
|
|
|
bool bConsiderRectZoom = false);
|
|
|
|
|
|
|
|
|
|
// 重载刷新函数,主要是调整范围
|
|
|
|
|
void update();
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
|
|
void sigNameChanged(const QString& sName);
|
|
|
|
|
void sigAliasChanged(const QString& sName);
|
|
|
|
|
void sigAxisDigitChanged(int nNumber);
|
|
|
|
|
void sigColorChanged(QColor clr);
|
|
|
|
|
void sigBigScaleCountChanged(int nNumber);
|
|
|
|
|
void sigSmallScaleCountChanged(int nNumber);
|
|
|
|
|
|
|
|
|
|
void sigRangeChanged(double fMin, double fMax, \
|
|
|
|
|
bool bRecalTicks = true, \
|
|
|
|
|
bool bAdjustRectZoomRatio = false);
|
|
|
|
|
|
|
|
|
|
void sigRangeChangedEx();
|
|
|
|
|
|
|
|
|
|
// 触发信号获取当前坐标轴上对应数据中的最小的正值
|
|
|
|
|
void sigGetLeastPositive(double& f);
|
|
|
|
|
|
|
|
|
|
// 由于刻度显示与Plot相互关联,所以此处进行额外处理
|
|
|
|
|
void sigScaleVisibleChanged(bool bBigScale, bool bVisible);
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
|
|
void setRangeMinMax(double fMin, double fMax, \
|
|
|
|
|
bool bRecalTicks = true, \
|
|
|
|
|
bool bAdjustRectZoomRatio = false);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
// 名称、别称、单位
|
|
|
|
|
QString m_strName;
|
|
|
|
|
QString m_strAlias;
|
|
|
|
|
QString m_strUnit;
|
|
|
|
|
|
|
|
|
|
// 范围
|
|
|
|
|
double m_fStart;
|
|
|
|
|
double m_fEnd;
|
|
|
|
|
|
|
|
|
|
// 刻度相关
|
|
|
|
|
double m_fMainInterval;
|
|
|
|
|
double m_fSubInterval;
|
|
|
|
|
int m_nDecimalNumber;
|
|
|
|
|
int m_nBigScaleCount;
|
|
|
|
|
int m_nSmallScaleCount;
|
|
|
|
|
QVector<double> m_vecMainValues;
|
|
|
|
|
|
|
|
|
|
QStringList m_listTickLabels; //对于规定的标题,如日期,而不是数值
|
|
|
|
|
|
|
|
|
|
// 类型
|
|
|
|
|
AxisType m_oAxisType;
|
|
|
|
|
AxisPos m_oAxisPos;
|
|
|
|
|
|
|
|
|
|
// 颜色
|
|
|
|
|
QColor m_clr;
|
|
|
|
|
|
|
|
|
|
// 显示控制
|
|
|
|
|
bool m_bBigScaleVisible;
|
|
|
|
|
bool m_bSmallScaleVisible;
|
|
|
|
|
bool m_bScaleOutward;
|
|
|
|
|
bool m_bExpTickMode;
|
|
|
|
|
|
|
|
|
|
// 画笔
|
|
|
|
|
QPen m_penBigGrid;
|
|
|
|
|
QPen m_penSmallGrid;
|
|
|
|
|
|
|
|
|
|
// 字体
|
|
|
|
|
QFont m_fontName;
|
|
|
|
|
QFont m_fontNumber;
|
|
|
|
|
QFont m_fontLogIndex;
|
|
|
|
|
|
|
|
|
|
ZxAxisHelper* m_pAxisHelper;
|
|
|
|
|
|
|
|
|
|
// 坐标轴最小化显示,基本上类似隐藏
|
|
|
|
|
bool m_bMinimizeAxis;
|
|
|
|
|
|
|
|
|
|
// 是否x或y当前的主坐标轴
|
|
|
|
|
bool m_bMainAxis;
|
|
|
|
|
|
|
|
|
|
// 是否系统自带,Plot自动带四个
|
|
|
|
|
bool m_bSysAxis;
|
|
|
|
|
|
|
|
|
|
// y轴宽度或x轴高度,20190123
|
|
|
|
|
double m_fSpan;
|
|
|
|
|
|
|
|
|
|
// 这是设置一些辅助信息,比如Date起始,就是0的位置 20190222
|
|
|
|
|
QVariant m_oTickExs;
|
|
|
|
|
|
|
|
|
|
// 临时,不涉及序列化,实时右键间隔比例,秒换成分钟
|
|
|
|
|
double m_nIntervalRatio;
|
|
|
|
|
|
|
|
|
|
// 坐标轴的基准时间,通常针对X轴而言
|
|
|
|
|
QDateTime m_dtBase; //
|
|
|
|
|
|
|
|
|
|
// 框选放大缩小过程中,坐标轴范围的比累计,通常为x轴,这是为了大数据量动态显示用的
|
|
|
|
|
// 不涉及序列化
|
|
|
|
|
double m_fRectZoomRatio;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|