You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
1.7 KiB
C++

#ifndef VIEWWIDGET_H
#define VIEWWIDGET_H
#include <QImage>
#include "mycolormap.h"
#include "GSurface.h"
#include <opencv2\opencv.hpp>
#include <vector>
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<cv::Point2f> >& 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<cv::Point2f> > m_contours; //轮廓线
QRectF m_dispCoordsRect; //显示的坐标范围
};
#endif // VIEWWIDGET_H