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/ZxObjLineSpecial.h

89 lines
2.7 KiB
C

#pragma once
#include "ZxObjLine.h"
//ZXF2024特征线优化
class I_PLOTCURVE_T_EXPORT ZxObjLineSpecial : public ZxObjLine
{
Q_OBJECT
ZX_DECLARE_DYNAMIC
public:
ZxObjLineSpecial();
ZxObjLineSpecial(const QString& sName,
ZxSubAxisX* pAxisX,
ZxSubAxisY* pAxisY);
~ZxObjLineSpecial();
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);
// pt1:鼠标Down点pt2鼠标Up点
QPointF offsetPoint(QPointF& pt,
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);
virtual void paintWhenMoving(QPainter* painter, \
const ZxPaintParam& param, \
QPointF& ptOld, \
QPointF& ptNew, \
ObjHitOption op);
public:
//根据两点计算出多个点斜率为1的最大最小点与斜率为0的焦点及斜率为0的最大点
virtual QVector<QPointF> calLinePoints(const QPointF& pt1,
const QPointF& pt0);
//计算交点(P1和P2是线P4是水平最后点, p3是交点)
void getInCrossPt(const QPointF& p1, const QPointF& p3, QPointF& pt2);
// 特征线斜率 Special line ratio组合斜率
// 斜率
QPointF getSlopeOnePt() const; //斜率为1
QPointF getSlopeZeroPt() const; //斜率为0
//计算与边界的交点(三个点,一个边界最低点,一个交点,一个上面点)
bool getBoundCrossPts(QPointF pt1, QPointF pt2, QVector<QPointF>& vecPts);
};