#ifndef VIEWWIDGET_H #define VIEWWIDGET_H #include #include "mycolormap.h" #include "GSurface.h" #include #include using namespace std; //网格曲面显示窗口 class ViewWidget : public MyColorMap { Q_OBJECT public: enum GridType { colorfulmap = 0, //彩图 graymap, //黑白图 colorfulmap_contours, //彩图+轮廓线 }; explicit ViewWidget(QWidget *parent = nullptr); void setType(GridType type){ m_type = type;} //更新绘图区 virtual void updateDraw(void); //设置轮廓线 void setContours(vector< vector >& contours); //清空轮廓线 void clearContours(void); //是否colormap设置为透明 bool m_bTransparentColormap; //重置坐标框范围 void resetAxisRect(void); //保存当前坐标框范围到m_axisRect void saveCurrentAxisRect(void); //刷新坐标轴 void refreshAxis(void); // // void setImage(const QImage& img, bool bUpdate); // void setSurface(GSurface* m_pSurf, bool bUpdate); //protected: // void showEvent(QShowEvent *event) override; // void paintEvent(QPaintEvent *event) override; // void resizeEvent(QResizeEvent *event) override; // void mouseDoubleClickEvent(QMouseEvent *event) override; //signals: //private: // // QImage m_img; // GSurface* m_pSurface; protected slots: void slotScaleRangeChanged(const QCPRange& newRange); protected: //缩放响应 void resizeEvent(QResizeEvent *event); // void changeEvent(QEvent *event); void drawContours(void); GridType m_type; vector< vector > m_contours; //轮廓线 QRectF m_dispCoordsRect; //显示的坐标范围 }; #endif // VIEWWIDGET_H