#ifndef WAFER_H
#define WAFER_H

#include <QWidget>
#include <vector>
#include <QMenu>
#include "WaferGraphicsView.h"
#include "DieItem.h"

typedef struct
{
    double x;
    double y;
}XY_DOUBLE_STRUCT;

typedef struct
{
    int nDieMatrixId;							//晶圆矩阵Id
    int nDieRow;								//固晶点在矩阵中所在行
    int nDieCol;								//固晶点在矩阵中所在列
    int iDieIndex;								//所在Point点ID
    bool bDisable;								//不可用点,等同于无效点
    PICK_DIE_STATUS eStatus;					//晶片状态
    XY_DOUBLE_STRUCT stPosition;				//程序设置的位置
} WAFER_MATRIX_POINT_INFO_STRUCT;

class Wafer : public QWidget
{
    Q_OBJECT

public:
    explicit Wafer(int flag, QWidget *parent = nullptr);

    void initFrom(QWidget *parent);
    void paintInitFrom(QWidget *parent);
    QPixmap getGlobalPixmap() const;

    QColor getColorByStatus(PICK_DIE_STATUS status);
    QGraphicsScene* scene;
    WaferGraphicsView *view;

protected:

private slots:
    void handleAction1();
    void handleAction2();

signals:
    void sendCoordinates(int x, int y);

private:
    int Flag;
    void showContextMenu(const QPoint &pos);
    QVector<WAFER_MATRIX_POINT_INFO_STRUCT> waferData;
    int rows, cols;
    int centerX, centerY;
    qreal radius;
    QMenu *contextMenu = nullptr;
    QPixmap globalPixmap;
};

#endif // WAFER_H
