|
|
#pragma once
|
|
|
|
|
|
#include "ZxAxisHelper.h"
|
|
|
|
|
|
// 日期类
|
|
|
class I_PLOTBASE_EXPORT ZxAxisHelperDate : public ZxAxisHelper
|
|
|
{
|
|
|
Q_OBJECT
|
|
|
|
|
|
public:
|
|
|
|
|
|
enum TimeTextFormat //刻度文本显示样式
|
|
|
{
|
|
|
TTF_Relative_TIU = 0, //相对时间,多少分或多少秒等等
|
|
|
TTF_Relative_Normal, //相对时间,1'35.24'',时分秒模式
|
|
|
|
|
|
TTF_Absolute_Time //绝对时间,格式由format来定
|
|
|
|
|
|
};
|
|
|
|
|
|
public:
|
|
|
|
|
|
explicit ZxAxisHelperDate(ZxSubAxisBase* p);
|
|
|
~ZxAxisHelperDate();
|
|
|
|
|
|
protected:
|
|
|
|
|
|
virtual QRectF getAxisRect(); //最大外范围
|
|
|
|
|
|
// 裁剪区
|
|
|
virtual void clipBounds(QPainter* painter, QRectF& rt);
|
|
|
|
|
|
// 绘制函数
|
|
|
virtual void drawTickAndTags(QPainter* painter, QRectF& rt);
|
|
|
virtual void drawOneTickTag(QPainter* painter, double fPos, QString s);
|
|
|
|
|
|
// 取得待显示的刻度文本标识
|
|
|
virtual QMap<double, QString> getTickInfos();
|
|
|
|
|
|
// 预估大小
|
|
|
virtual QRectF getPreferedTickSumRect(QPainter* painter);
|
|
|
virtual void adjustPreferedSize(double& w, double& h);
|
|
|
|
|
|
// 获取绘制的位置信息
|
|
|
virtual void locateOneTickTag(QPainter* painter, double fPos, QString s, \
|
|
|
QRectF& rt, int& flag);
|
|
|
virtual void metricStr(QPainter* painter, QString s, double& w, double& h);
|
|
|
|
|
|
// s1:time, s2:date
|
|
|
QString sumFromDateTime(QString s1, QString s2);
|
|
|
void parseToDateTime(QString s, QString& s1, QString& s2);
|
|
|
|
|
|
// 是否可以显示
|
|
|
virtual bool canTickShow(QRectF rt);
|
|
|
|
|
|
public:
|
|
|
|
|
|
// 刻度标识
|
|
|
QString getLabelStr(double d);
|
|
|
|
|
|
// 内部调整
|
|
|
double adjustScaleAndTicks(double& fMin, double& fMax, \
|
|
|
QVector<double>* pVecTicks = NULL, \
|
|
|
bool bConsiderRectZoom = false);
|
|
|
|
|
|
// 基准时间设置
|
|
|
void setBaseDt(QDateTime& dt);
|
|
|
QDateTime getBaseDt();
|
|
|
|
|
|
// 时间设置
|
|
|
void setTtf(TimeTextFormat o);
|
|
|
TimeTextFormat getTtf();
|
|
|
void setTtfFormat(QString s);
|
|
|
QString getTtfFormat();
|
|
|
void setTtfUnit(QString s);
|
|
|
QString getTtfUnit();
|
|
|
QString getTimeBaseUnit();
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
protected:
|
|
|
|
|
|
// 起始时间,对应数据深度0
|
|
|
QDateTime m_dtBase;
|
|
|
TimeTextFormat m_oTtf;
|
|
|
QString m_sTtfUnit; //对于相对时间,是单位
|
|
|
QString m_sTtfFormat; //对于绝对时间,是format
|
|
|
};
|