#pragma once #include #include "ZxObjCurve.h" class ZxObjCurveFlowTool; class I_PLOTCURVE_T_EXPORT ZxObjCurveFlow : public ZxObjCurve { Q_OBJECT ZX_DECLARE_DYNAMIC public: ZxObjCurveFlow(); ZxObjCurveFlow(const QString& sName, ZxSubAxisX* pAxisX, ZxSubAxisY* pAxisY); ~ZxObjCurveFlow(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); // 新增接口,20210918 为了流量和压力对齐,只支持右移动 // dOffsetX > 0,且是Value而不是Pos // 20210919 更改支持:左右移动,压力 virtual bool runMoveByV(const double dOffsetX); // 考虑同步压力计问题 virtual bool dealwithPosP(const QPointF& pt1, const QPointF& pt2, float& fX); // 是否击中流动段矩形 virtual bool hitTestOthers(const QPointF& pt, bool& bZeroSeg); // 封装 virtual void initTools(); virtual void resetBounds(); virtual QRectF getBounds4Update(); // 根据鼠标位置xPos获取在线上的位置点 virtual bool getPointByX(float& xPos, QPointF& ptPos); // 选择(from to) virtual bool selectRowRanges(int nFrom, int nTo); /// @brief 流量数据体的转换 // duraToAccu:true 从持续到累积 false 从累积到持续 static bool convertFlowData(VecFloat& vecX, VecFloat& vecY, bool duraToAccu); static bool convertFlowData(VecPointF& vecPts, bool duraToAccu); /// @brief 在某点对流量段进行批分 /// @param ptValue是数值点Value,非坐标点Pos /// @nIndex 是针对的第几段,如果不传入,则通过 getSegIndexOf 自动计算 /// x值<最左,为0,然后 1,2,3..,n,x值>最右侧,n+1 /// @param bUpdateView一旦批分成功是否刷新视图 bool splitSegAt(QPointF ptValue, int nIndex = -1, bool bUpdateView = false); int getSegIndexOf(QPointF ptValue); protected: // 设置图元对象的属性标志 virtual void initFlags(); public: virtual bool canMovePoint(); virtual bool canMoveBound(); virtual bool canMoveWhole(); private: bool _isNearLineEx(QPointF pt, QPointF pt2, QPointF pt3); public: virtual void paintBack(QPainter* painter, const ZxPaintParam& param); virtual void drawLines(QPainter* painter); virtual void drawPoint(QPainter* painter, QPointF arrPoints[], int nCount, ZxDot& dot); void drawFlowSegmentSel(QPainter* painter, QRectF rt); void drawFlowSegments(QPainter* painter); virtual void paintWithBrotherMode(QPainter* painter, QPointF ptOld, QPointF ptNew); void _drawLinesOf(QPainter* painter, QVector& vecPts); 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); // 取得鼠标移动时的tip信息, virtual QString getTipOf(const QPointF& point); //virtual void onLeftDoubleClick(const QPointF& pt); // 重载做转换 virtual QVector getAllPos(bool bFuzzyMode = false, float fZoom = 1.f, int nMax = 20000, QVector* pVecSelecteds = NULL, QVector* pVecIndexes = NULL) const; virtual QVector fuzzyAllPos(QVector vec, float fZoom = 1.f, int nMax = 20000, QVector* pVecSelecteds = NULL, QVector* pVecIndexes = NULL) const; virtual int fuzzyPosTimes(float fZoom, int nPtCount) const; virtual void setAllPos(QVector vecPoss, QVector* pVecIndexes = NULL); public: void setFlowLineVisible(bool b); bool isFlowLineVisible() const; void setFlowSegmentVisible(bool b); bool isFlowSegmentVisible() const; void setFlowLineClr(QColor clr); QColor getFlowLineClr() const; void setFlowSegmentClr(QColor clr); QColor getFlowSegmentClr() const; void setCurSegPtIndex(int n); int getCurSegPtIndex() const; signals: // 当前选泽的流动段改变 void sigSegCurIndexChanged(); // 竖线、x方向的左右改变 void sigSegVerChanged(int nIndex, float fOld, float fNew); public: // 临时变量,是否选中的竖线 bool m_bVertical; // 是否画流动线 bool m_bFlowLineVisible; bool m_bFlowSegmentVisible; QColor m_clrFlowLine; QColor m_clrFlowSegment; // 当前选中的seg的起始点所在index int m_nCurSegPtIndex; // 临时变量,绑定的 //ZxObjCurve* m_pBrotherP; // float m_fFirstSpan; };