#ifndef WAFER_H
#define WAFER_H
#pragma once
#include <QWidget>
#include <vector>
#include <QMenu>
#include "WaferGraphicsView.h"
#include "DieItem.h"
#include <CWaferMatrix.h>

enum OperateMode {
    ModeImage,  // 显示图片
    ModeView    // 显示 view
};

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(ns_mat::PICK_DIE_STATUS status);

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

private:
    int Flag;
    QVector<ns_mat::WAFER_MATRIX_POINT_INFO_STRUCT> waferData;
    int rows, cols;
    int centerX, centerY;
    qreal radius;
    QMenu *contextMenu = nullptr;
    QPixmap globalPixmap;
public:
    QGraphicsScene* scene = nullptr;
    WaferGraphicsView* view = nullptr;
};

#endif // WAFER_H