#pragma once #include "ZxObjCurve.h" class I_PLOTCURVE_T_EXPORT ZxObjCurveBar : public ZxObjCurve { Q_OBJECT ZX_DECLARE_DYNAMIC public: ZxObjCurveBar(); ZxObjCurveBar(const QString& sName, ZxSubAxisX* pAxisX, ZxSubAxisY* pAxisY); ~ZxObjCurveBar(void); virtual void init(const QString& sName, ZxSubAxisX* pAxisX, ZxSubAxisY* pAxisY); // 封装 virtual void initTools(); public: void setBarWidth(float f); float getBarWidth(); void setBarFill(bool b); bool getBarFill(); void setBarFillClr(QColor clr); QColor getBarFillClr(); void setPinValue(bool b); bool getPinValue(); void setPinFont(QFont o); QFont getPinFont(); void setPinClr(QColor clr); QColor getPinClr(); void setShow3D(bool b); bool getShow3D(); protected: // 击中 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); virtual QRectF getBounds4Update(); virtual void updateRect(QRectF); public: 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 paintBack(QPainter* painter, const ZxPaintParam& param); protected: virtual void drawSubBars(QPainter* painter, QVector& vec); virtual void drawSubBarOne(QPainter* painter, QPointF pt, int index); private: QRectF _getBarRectOf(QPointF pt); //Pos而非Value void _drawSubBarOne2D(QPainter* painter, QRectF rt, int index, bool calledBy3D = false); void _drawSubBarOne3D(QPainter* painter, QRectF rt, int index); void _drawPinnedValue(QPainter* painter, QRectF rtTag, int index); protected: float m_fBarWidth; bool m_bBarFill; QColor m_oBarFillClr; bool m_bPinValue; QFont m_oPinFont; QColor m_oPinClr; bool m_bShow3D; //3D显示 };