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.
nmWTAI-Platform/Include/iPlot/iPlotBase/ZxSubAxisX.h

48 lines
1.4 KiB
C

#pragma once
#include <QDateTime>
#include "ZxSubAxisBase.h"
// 坐标轴X
class I_PLOTBASE_EXPORT ZxSubAxisX : public ZxSubAxisBase
{
Q_OBJECT
ZX_DECLARE_DYNAMIC
public:
ZxSubAxisX();
ZxSubAxisX(const QString& name);
ZxSubAxisX(const ZxSubAxisX & c);
public:
virtual void paintBack(QPainter* painter, const ZxPaintParam& param);
// 坐标数值转换(屏幕坐标与实际坐标)
// 注意:Value表示实际坐标、Pos表示屏幕坐标
// getValueForPos: 已知屏幕坐标,求实际坐标
// getPosForValue: 已知实际坐标,求屏幕坐标
virtual double getValueForPos(double dPos) const;
virtual double getPosForValue(double dVal) const;
// ===== 时间轴快捷方法(仅 X 轴) =====
// 约定:Value 的单位是"小时",基准时间是 m_dtBase(基类已有)
// 这些方法只在 AXIS_Date 时才有意义,其它类型也可以调但结果不保证
// 用 QDateTime 设范围(内部把秒差换算成小时)
void setRangeByDateTime(const QDateTime& dtMin, const QDateTime& dtMax);
// 屏幕位置 ↔ 绝对时间
QDateTime getDateTimeForPos(double dPos) const;
double getPosForDateTime(const QDateTime& dt) const;
// 值(小时) ↔ 绝对时间
double getValueForDateTime(const QDateTime& dt) const;
QDateTime getDateTimeForValue(double dVal) const;
};