|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "ZxObjBase.h"
|
|
|
|
|
#include "ZxDot.h"
|
|
|
|
|
|
|
|
|
|
class ZxObjText;
|
|
|
|
|
class I_PLOTCURVE_T_EXPORT ZxObjLine : public ZxObjBase
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
ZX_DECLARE_DYNAMIC
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
ZxObjLine();
|
|
|
|
|
ZxObjLine(const QString& sName,
|
|
|
|
|
ZxSubAxisX* pAxisX,
|
|
|
|
|
ZxSubAxisY* pAxisY);
|
|
|
|
|
~ZxObjLine();
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
// resetBounds内部调用
|
|
|
|
|
virtual void resetOthers();
|
|
|
|
|
|
|
|
|
|
// 辅助信息
|
|
|
|
|
virtual void initSubObjs();
|
|
|
|
|
|
|
|
|
|
// 封装
|
|
|
|
|
virtual void initTools();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// 斜率
|
|
|
|
|
virtual float getSlope() const;
|
|
|
|
|
|
|
|
|
|
// 截距
|
|
|
|
|
virtual float getIntercept() const;
|
|
|
|
|
|
|
|
|
|
// 字符串 Y=Kx+b
|
|
|
|
|
virtual QString getLineExp();
|
|
|
|
|
|
|
|
|
|
// 线段上任意一点,暂取中点
|
|
|
|
|
virtual QPointF getRandomPtValue(); //实际值
|
|
|
|
|
virtual QPointF getRandomPtPos(); //屏幕值
|
|
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
|
|
// 实际值
|
|
|
|
|
QPointF getStartValue();
|
|
|
|
|
void setStartValue(const QPointF& pt);
|
|
|
|
|
QPointF getEndValue();
|
|
|
|
|
void setEndValue(const QPointF& pt);
|
|
|
|
|
|
|
|
|
|
// XY
|
|
|
|
|
float getStartValueX();
|
|
|
|
|
void setStartValueX(const float &x);
|
|
|
|
|
float getStartValueY();
|
|
|
|
|
void setStartValueY(const float &Y);
|
|
|
|
|
float getEndValueX();
|
|
|
|
|
void setEndValueX(const float &x);
|
|
|
|
|
float getEndValueY();
|
|
|
|
|
void setEndValueY(const float &y);
|
|
|
|
|
|
|
|
|
|
bool getShowDotPoint();
|
|
|
|
|
void showDotPoint(bool show);
|
|
|
|
|
|
|
|
|
|
void resetBounds();
|
|
|
|
|
QRectF getBounds4Update();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
bool m_showDotPoint;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|