|
|
#pragma once
|
|
|
|
|
|
#include "ZxObjBase.h"
|
|
|
|
|
|
class ZxObjRect;
|
|
|
class I_PLOTCURVE_T_EXPORT ZxObjCurveBase : public ZxObjBase
|
|
|
{
|
|
|
Q_OBJECT
|
|
|
ZX_DECLARE_DYNAMIC
|
|
|
|
|
|
public:
|
|
|
|
|
|
ZxObjCurveBase();
|
|
|
ZxObjCurveBase(const QString& sName,
|
|
|
ZxSubAxisX* pAxisX,
|
|
|
ZxSubAxisY* pAxisY);
|
|
|
~ZxObjCurveBase(void);
|
|
|
|
|
|
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);
|
|
|
|
|
|
// 通过设置ZxObjRect,配置点的状态
|
|
|
bool changeOrAppendRect(ZxObjRect* p);
|
|
|
void removeRect(ZxObjRect* p);
|
|
|
QVector<ZxObjBase*> getAllRectBounds();
|
|
|
void dealwithRects(ZxObjRect* p, bool bDelOrAppendRect); //ZxObjRect被删除的恢复撤销处理
|
|
|
|
|
|
// 删除
|
|
|
bool removePtsInRects(QVector<ZxObjBase*> vec);
|
|
|
|
|
|
// 删除点
|
|
|
bool delPtsWithinRect(QRectF rtPos);
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
// 刷新点的状态
|
|
|
void slotFreshPtStates();
|
|
|
|
|
|
public:
|
|
|
|
|
|
// 设置数据
|
|
|
virtual void setAllPos(QVector<QPointF> vecPoss, QVector<int>* pVecIndexes = NULL);
|
|
|
virtual void setAllValues(QVector<QPointF> vecValues);
|
|
|
virtual void resetBounds();
|
|
|
|
|
|
// 取得鼠标移动时的tip信息
|
|
|
virtual QString getTipOf(const QPointF& point);
|
|
|
|
|
|
virtual QVector<QPointF> fuzzyAllPos(QVector<QPointF> vec,
|
|
|
float fZoom = 1.f,
|
|
|
int nMax = 20000,
|
|
|
QVector<QPointF>* pVecSelecteds = NULL,
|
|
|
QVector<int>* pVecIndexes = NULL) const;
|
|
|
protected:
|
|
|
|
|
|
// 设置图元对象的属性标志
|
|
|
virtual void initFlags();
|
|
|
|
|
|
public:
|
|
|
virtual bool canMovePoint();
|
|
|
virtual bool canMoveBound();
|
|
|
virtual bool canMoveWhole();
|
|
|
|
|
|
public:
|
|
|
|
|
|
virtual void paintBack(QPainter* painter, const ZxPaintParam& param);
|
|
|
virtual void drawCurveLine(QPainter* painter, QVector<QPointF>& vec);
|
|
|
virtual void drawPoint(QPainter* painter, QPointF arrPoints[], int nCount, ZxDot& dot);
|
|
|
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:
|
|
|
|
|
|
// 画笔
|
|
|
virtual void setColor(QColor clr);
|
|
|
|
|
|
// 曲线
|
|
|
bool getLineVisible(void) const;
|
|
|
void setLineVisible(bool bVisible = true);
|
|
|
|
|
|
bool getPointVisible(void) const;
|
|
|
void setPointVisible(bool bVisible = true);
|
|
|
|
|
|
// 统一设置,为了速度
|
|
|
//void setCurvePty(QPen o1, ZxDot o2);
|
|
|
void setCurvePty(QPen o1, ZxDot o2, bool bLineVisible, bool bPointVisible);
|
|
|
|
|
|
// 点数
|
|
|
int getPtCount();
|
|
|
|
|
|
public:
|
|
|
|
|
|
// 点状态
|
|
|
void changPointState(int nIndex,
|
|
|
PointState psNew);
|
|
|
void startNewRectSelection();
|
|
|
PointState getPointState(int nIndex);
|
|
|
bool hasPointOfState(PointState ps);
|
|
|
bool reversePointOfState(PointState psOld, PointState psNew);
|
|
|
void setPtStates(const PointState pPtStates[],
|
|
|
int cnt);
|
|
|
PointState* getPtStates();
|
|
|
// 获取本曲线ps状态下的所有的点
|
|
|
QVector<QPointF> getPointValuesOfState(PointState ps);
|
|
|
|
|
|
/// @brief 这是拟合后,对曲线的状态进行复原
|
|
|
/// @param bSelectConsidered:选择状态的点是否参与复原
|
|
|
/// @param bExcludeConsidered:剔除状态的点是否参与复原
|
|
|
/// @param bEraseConsidered:删除状态的点是否参与复原
|
|
|
void restorePtStates(bool bSelectConsidered, \
|
|
|
bool bExcludeConsidered = false, \
|
|
|
bool bEraseConsidered = false);
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
void sigNameChanged(QString sName);
|
|
|
void sigColorChanged(QColor clr);
|
|
|
|
|
|
// 点模式状态发生改变
|
|
|
void sigPointStateChanged(int nIndex, PointState psOld, PointState psNew);
|
|
|
void sigPointStatesRestored();
|
|
|
|
|
|
// 在开始一个新的框选之前触发
|
|
|
void sigNewRectSelection();
|
|
|
|
|
|
// 可以画一些辅助的信息
|
|
|
void sigGetBrotherObj(ZxObjBase*&);
|
|
|
|
|
|
protected:
|
|
|
|
|
|
bool m_bLineVisible;
|
|
|
bool m_bPointVisible;//added 20210823
|
|
|
|
|
|
// 点状态
|
|
|
QVector<PointState> m_vecPointStates;
|
|
|
|
|
|
// 临时变量,只为点的状态
|
|
|
QVector<ZxObjRect*> m_vecBands;
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|