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/iPlotCurveT/Objects/ZxObjLineSlr.h

95 lines
2.5 KiB
C

#pragma once
#include "ZxObjLine.h"
class I_PLOTCURVE_T_EXPORT ZxObjLineSlr : public ZxObjLine
{
Q_OBJECT
ZX_DECLARE_DYNAMIC
public:
ZxObjLineSlr();
ZxObjLineSlr(const QString& sName,
ZxSubAxisX* pAxisX,
ZxSubAxisY* pAxisY);
~ZxObjLineSlr();
virtual void init(const QString& sName,
ZxSubAxisX* pAxisX,
ZxSubAxisY* pAxisY);
// 击中
virtual bool hitTest(const QPointF& pt);
// 具体击中实现的函数,单纯击中,不做选项的改变
// nOption用int是因为Rect类的击中选项不一致
// nOption为负值表示未击中此时返回false
virtual bool _runHitTest(const QPointF& pt, int& nOption, int& nSubIndex);
// 击中后ButtonUp后的处理
// pt1:鼠标Down点pt2鼠标Up点
virtual bool runMove(const QPointF& pt1, const QPointF& pt2);
// 鼠标移动时,限制斜率得到的新点
QPointF calFitPoint(const QPointF& ptNew);
// 封装
virtual void initTools();
// 辅助信息
virtual void initSubObjs();
virtual void resetOthers();
protected:
// 设置图元对象的属性标志
virtual void initFlags();
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:
// 根据某点以及斜率,计算两点,屏幕坐标
// fLen如果为-1.f则默认取坐标轴网格长度的一半
virtual QVector<QPointF> calLinePoints(const QPointF& pt,
double fRatio,
double fLen = -1.f);
// 根据某点以及斜率,计算两点,屏幕坐标
static QVector<QPointF> calLinePointsEx(const QPointF& pt,
double fRatio,
double fLen);
// 特征线斜率 Special line ratio
// 斜率
void setSlope(double f);
virtual double getSlope() const;
// 计算线斜率,得到字符串
virtual QString getLineExp();
// 默认的长度
void setLen(double f);
double getLen() const;
public:
double m_fSlope; //这是针对特征线时后的斜率值
double m_fLen; //默认的长度
};