Bläddra i källkod

添加华夫盒重新绘制代码和交互功能

yun 4 veckor sedan
förälder
incheckning
6299805a93

+ 27 - 4
View/die-bonder-ui/CameraMaterialGroupWnd/Group.cpp

@@ -280,13 +280,22 @@ void Group::setBondWidget(QPixmap pixmap) {
     layout2->addWidget(pixmapLabel);
 }
 
-void Group::WaffleWidget()
-{
-    QVBoxLayout *layout2 = new QVBoxLayout(ui->Imagewidget_right);
+void Group::setWaffleWidget(QPixmap pixmap) {
+    QVBoxLayout* layout2 = new QVBoxLayout(ui->Imagewidget_right);
     m_pWaffle->paintInitFrom(ui->Imagewidget_right);
+    int width, height;
+    width = ui->Imagewidget_right->width();
+    height = ui->Imagewidget_right->height();
+    QSize targetSize(width, height);
 
+    // 不保持比例,直接拉伸到指定尺寸
+    QPixmap scaledPixmap = pixmap.scaled(
+        targetSize,
+        Qt::IgnoreAspectRatio,
+        Qt::SmoothTransformation
+    );
     QLabel* pixmapLabel = new QLabel();
-    pixmapLabel->setPixmap(m_pWaffle->getGlobalPixmap());
+    pixmapLabel->setPixmap(scaledPixmap);
 
     ui->Imagewidget_right->setLayout(layout2);
     ui->Imagewidget_right->setFixedSize(110, 110);
@@ -294,6 +303,20 @@ void Group::WaffleWidget()
     layout2->addWidget(pixmapLabel);
 }
 
+void Group::WaffleWidget()
+{
+    //QVBoxLayout *layout2 = new QVBoxLayout(ui->Imagewidget_right);
+    //m_pWaffle->paintInitFrom(ui->Imagewidget_right);
+
+    //QLabel* pixmapLabel = new QLabel();
+    //pixmapLabel->setPixmap(m_pWaffle->getGlobalPixmap());
+
+    //ui->Imagewidget_right->setLayout(layout2);
+    //ui->Imagewidget_right->setFixedSize(110, 110);
+    //layout2->setContentsMargins(0, 0, 0, 0);
+    //layout2->addWidget(pixmapLabel);
+}
+
 void Group::MaterialBoxWidget()
 {
     QVBoxLayout* layout2 = new QVBoxLayout(ui->Imagewidget_right);

+ 1 - 0
View/die-bonder-ui/CameraMaterialGroupWnd/Group.h

@@ -38,6 +38,7 @@ public:
     void setWaferWidget(QPixmap pixmap);
     void setBondWidget(QPixmap pixmap);
     void setWafer(Wafer* wafer);
+    void setWaffleWidget(QPixmap pixmap);
 
 signals:
     void send_button_Signal();

+ 71 - 18
View/die-bonder-ui/CameraMaterialGroupWnd/MaterialWindow/BondGraphicsView.cpp

@@ -28,6 +28,18 @@ void BondItem::setLeftSelected(bool selected) {
         setPen(QPen(Qt::black, 1));  // 未选中时恢复为黑色边框
     }
 }
+void BondItem::setRightSelected(bool selected) {
+    if (selected) {
+        setPen(QPen(QColor("#00F5FF"), 1));
+        setZValue(1);
+    }
+    else {
+        setPen(QPen(Qt::black, 1));  // 未选中时恢复为黑色边框
+        setZValue(0);
+    }
+    // qDebug() << "DieItem clicked: Row:" << row << "Col:" << col;
+
+}
 int BondItem::getDieIndex() {
     return dieIndex;
 }
@@ -144,10 +156,17 @@ void BondGraphicsView::mousePressEvent(QMouseEvent* event) {
         }
         selectedItem.clear();
         QGraphicsItem* item = itemAt(event->pos());
-        // if (BondItem* bondItem = dynamic_cast<BondItem*>(item)) {
-        //     selectedItem = bondItem;
-        //     selectedItem->setLeftSelected(true);
-        // }
+        
+        if (topLeftItem && topLeftItem->scene()) {
+            topLeftItem->setRightSelected(false);
+        }
+        topLeftItem.clear();
+
+        if (bottomRightItem && bottomRightItem->scene()) {
+            bottomRightItem->setRightSelected(false);
+        }
+        bottomRightItem.clear();
+
         BondItem* bondItem = nullptr;
         while (item && !bondItem) {
             bondItem = dynamic_cast<BondItem*>(item);
@@ -207,7 +226,15 @@ void BondGraphicsView::mouseReleaseEvent(QMouseEvent* event) {
                 selectedItem->setLeftSelected(false);
             }
             selectedItem.clear();
+            if (topLeftItem && topLeftItem->scene()) {
+                topLeftItem->setRightSelected(false);
+            }
+            topLeftItem.clear();
 
+            if (bottomRightItem && bottomRightItem->scene()) {
+                bottomRightItem->setRightSelected(false);
+            }
+            bottomRightItem.clear();
             QRectF selectedArea = selectionRect->rect();
             scene()->removeItem(selectionRect);
             delete selectionRect;
@@ -260,6 +287,15 @@ void BondGraphicsView::mouseReleaseEvent(QMouseEvent* event) {
                         }
                     }
                     selectedItemsMap.clear();
+                    if (topLeftItem && topLeftItem->scene()) {
+                        topLeftItem->setRightSelected(false);
+                    }
+                    topLeftItem.clear();
+
+                    if (bottomRightItem && bottomRightItem->scene()) {
+                        bottomRightItem->setRightSelected(false);
+                    }
+                    bottomRightItem.clear();
 
                     if (selectedItem && selectedItem->scene()) {
                         selectedItem->setLeftSelected(false);
@@ -273,24 +309,22 @@ void BondGraphicsView::mouseReleaseEvent(QMouseEvent* event) {
                     });
                 // 设置区域边界点菜单
                 menu.addAction(tr("set Top left point", "设为左上点"), [this, die] {
-                    //if (topLeftItem && topLeftItem->scene()) {
-                    //    topLeftItem->setRightSelected(false);
-                    //}
-                    //topLeftItem.clear();
-                    //topLeftItem = die;
-                    //topLeftItem->setRightSelected(true);
-                    //topLeftIndex = qMakePair(die->getRow(), die->getCol());
+                    if (topLeftItem && topLeftItem->scene()) {
+                        topLeftItem->setRightSelected(false);
+                    }
+                    topLeftItem.clear();
+                    topLeftItem = die;
+                    topLeftItem->setRightSelected(true);
                     //if (bottomRightIndex.first >= 0) checkAndCreateRegion();
                     });
 
                 menu.addAction(tr("set bottom right point", "设为右下点"), [this, die] {
-                    //if (bottomRightItem && bottomRightItem->scene()) {
-                    //    bottomRightItem->setRightSelected(false);
-                    //}
-                    //bottomRightItem.clear();
-                    //bottomRightItem = die;
-                    //bottomRightItem->setRightSelected(true);
-                    //bottomRightIndex = qMakePair(die->getRow(), die->getCol());
+                    if (bottomRightItem && bottomRightItem->scene()) {
+                        bottomRightItem->setRightSelected(false);
+                    }
+                    bottomRightItem.clear();
+                    bottomRightItem = die;
+                    bottomRightItem->setRightSelected(true);
                     //if (topLeftIndex.first >= 0) checkAndCreateRegion();
                     });
             }
@@ -351,6 +385,16 @@ void BondGraphicsView::clearRegion()
     }
     selectedItemsMap.clear();
 
+    if (topLeftItem && topLeftItem->scene()) {
+        topLeftItem->setRightSelected(false);
+    }
+    topLeftItem.clear();
+
+    if (bottomRightItem && bottomRightItem->scene()) {
+        bottomRightItem->setRightSelected(false);
+    }
+    bottomRightItem.clear();
+
     if (selectedItem && selectedItem->scene()) {
         selectedItem->setLeftSelected(false);
     }
@@ -374,6 +418,15 @@ void BondGraphicsView::setRegion()
         }
     }
     selectedItemsMap.clear();
+    if (topLeftItem && topLeftItem->scene()) {
+        topLeftItem->setRightSelected(false);
+    }
+    topLeftItem.clear();
+
+    if (bottomRightItem && bottomRightItem->scene()) {
+        bottomRightItem->setRightSelected(false);
+    }
+    bottomRightItem.clear();
 
     if (selectedItem && selectedItem->scene()) {
         selectedItem->setLeftSelected(false);

+ 4 - 0
View/die-bonder-ui/CameraMaterialGroupWnd/MaterialWindow/BondGraphicsView.h

@@ -14,6 +14,7 @@ public:
 
     void setSelected(bool selected);
     void setLeftSelected(bool selected);
+    void setRightSelected(bool selected);
     ns_mat::POINT_INFO_STRUCT point;
     int getDieIndex();
 
@@ -63,6 +64,9 @@ private:
     QPointer<BondItem> selectedItem;
     ns_module::CViewInterface* m_pCViewInterface;
 
+    QPointer<BondItem> topLeftItem;
+    QPointer<BondItem> bottomRightItem;
+
     void showThumbnail();
     void hideThumbnail();
 

+ 241 - 103
View/die-bonder-ui/CameraMaterialGroupWnd/MaterialWindow/Waffle.cpp

@@ -9,48 +9,81 @@ Waffle::Waffle(int flag, QWidget *parent) : QWidget(parent)
 
 void Waffle::UpdataGenerateTestData()
 {
-    // //根据不同窗口设置不同大小 0:小 1:中 2:大
-   // if (flag == 0) {
-   //     // 华夫台的参数
-   //     gridSize = 5;  // 每个格子的大小
-   //     gap = 3;        // 格子之间的间隙
-   //     boxGap = 6;    // 华夫台之间的间隙
-   // } else if (flag == 1) {
-   //     // 华夫台的参数
-   //     gridSize = 20;  // 每个格子的大小
-   //     gap = 6;        // 格子之间的间隙
-   //     boxGap = 12;    // 华夫台之间的间隙
-   // } else if (flag == 2) {
-   //     // 华夫台的参数
-   //     gridSize = 50;  // 每个格子的大小
-   //     gap = 6;        // 格子之间的间隙
-   //     boxGap = 12;    // 华夫台之间的间隙
-   // }
-    rows = 6;
-    cols = 18;
-    centerX = 25;
-    centerY = 25;
+
     // 随机数初始化
-    std::srand(std::time(nullptr)); // 使用当前时间作为种子
-    for (int row = 0; row < rows; ++row) {
-        for (int col = 0; col < cols; ++col) {
-            ns_mat::WAFFLE_MATRIX_POINT_STRUCT point;
-            point.nPackMatrixId = 1;
-            point.nPackRow = 6;
-            point.nPackCol = 18;
-            point.nDieRow = row;
-            point.nDieCol = col;
-            point.nDieMatrixId = 1;
-            point.iDieIndex = 1;
-            point.bDisable = false; // 默认为可用
-            point.stPosition.x = col * 10.0;
-            point.stPosition.y = row * 10.0;
-            int randomStatus = std::rand() % 5; // 随机选取DIE_EXIST, PICK_ING, NO_EXIST, SKIP_DIE
-            point.eStatus = static_cast<ns_mat::PICK_DIE_STATUS>(randomStatus);
-            // 将点添加到waferData容器中
-            m_vWaffleData.append(point);
+    WAFFLE_MATRIX_POINT_STRUCT test;
+    test.nPackMatrixId = 1;
+    test.nPackRow = 1;
+    test.nPackCol = 1;
+    test.nDieRow = 1;
+    test.nDieCol = 1;
+    test.nDieMatrixId = 1;
+    test.iDieIndex = 1;
+    test.bDisable = false; // 默认为可用
+    // 设置坐标,每个点间隔为2
+    test.stPosition.x = 0;
+    test.stPosition.y = 0;
+    int randomStatus = std::rand() % 5; // 随机选取DIE_EXIST, PICK_ING, NO_EXIST, SKIP_DIE
+    test.eStatus = static_cast<ns_mat::PICK_DIE_STATUS>(randomStatus);
+    maxPoint = QPointF(0, 0);
+    minPoint = QPointF(0,0);
+    WAFFLE_MATRIX_POINT_STRUCT minMatrixPoint = test;
+    WAFFLE_MATRIX_POINT_STRUCT maxMatrixPoint = test;
+    for (int i = 0; i < 2; i++) {
+        for (int j = 0; j < 2; j++) {
+            for (int m = 0; m < 2; m++) {
+                for (int n = 0; n < 2; n++) {
+                    ns_mat::WAFFLE_MATRIX_POINT_STRUCT a;
+                    a.nPackMatrixId = 1;
+                    a.nPackRow = i + 1;
+                    a.nPackCol = j + 1;
+                    a.nDieRow = m + 1;
+                    a.nDieCol = n + 1;
+                    a.nDieMatrixId = i * 2 + j + 1;
+                    a.iDieIndex = m + n + 1;
+                    a.bDisable = false; // 默认为可用
+                    // 设置坐标,每个点间隔为2
+                    a.stPosition.x = (j * 2 + n) * 2;
+                    a.stPosition.y = (i * 2 + m) * 2;
+                    int randomStatus = std::rand() % 5; // 随机选取DIE_EXIST, PICK_ING, NO_EXIST, SKIP_DIE
+                    a.eStatus = static_cast<ns_mat::PICK_DIE_STATUS>(randomStatus);
+
+                    if (a.stPosition.x > maxPoint.x())
+                        maxPoint.setX(a.stPosition.x);
+                    if (a.stPosition.x < minPoint.x())
+                        minPoint.setX(a.stPosition.x);
+                    if (a.stPosition.y > maxPoint.y())
+                        maxPoint.setY(a.stPosition.y);
+                    if (a.stPosition.y < minPoint.y())
+                        minPoint.setY(a.stPosition.y);
+
+                    if (maxMatrixPoint.nDieMatrixId != a.nDieMatrixId) {
+                        m_vmaxMatrixPoints.append(maxMatrixPoint);
+                        m_vminMatrixPoints.append(minMatrixPoint);
+                        maxMatrixPoint = a;
+                        minMatrixPoint = a;
+                    }
+                    else {
+                        //遍历找到矩阵最小和最大边界点
+                        if (a.stPosition.x > maxMatrixPoint.stPosition.x)
+                            maxMatrixPoint = a;
+                        if (a.stPosition.y > maxMatrixPoint.stPosition.y)
+                            maxMatrixPoint = a;
+                        if (a.stPosition.x < minMatrixPoint.stPosition.x)
+                            minMatrixPoint = a;
+                        if (a.stPosition.y < minMatrixPoint.stPosition.y)
+                            minMatrixPoint = a;
+                        // 将点添加到waferData容器中
+                        
+                    }
+                    m_vWaffleData.append(a);
+                }
+            }
+
         }
     }
+    m_vmaxMatrixPoints.append(maxMatrixPoint);
+    m_vminMatrixPoints.append(minMatrixPoint);
 }
 
 void Waffle::UpdataVal(const std::vector<ns_mat::WAFFLE_MATRIX_POINT_STRUCT>& veWaffle)
@@ -59,6 +92,8 @@ void Waffle::UpdataVal(const std::vector<ns_mat::WAFFLE_MATRIX_POINT_STRUCT>& ve
 
     maxPoint = QPointF(veWaffle[0].stPosition.x, veWaffle[0].stPosition.y);
     minPoint = QPointF(veWaffle[0].stPosition.x, veWaffle[0].stPosition.y);
+    WAFFLE_MATRIX_POINT_STRUCT minMatrixPoint = veWaffle[0];
+    WAFFLE_MATRIX_POINT_STRUCT maxMatrixPoint = veWaffle[0];
     for (const auto a: veWaffle)
     {
         m_vWaffleData.append(a);
@@ -72,64 +107,38 @@ void Waffle::UpdataVal(const std::vector<ns_mat::WAFFLE_MATRIX_POINT_STRUCT>& ve
         if (a.stPosition.y < minPoint.y())
             minPoint.setY(a.stPosition.y);
 
+        if (maxMatrixPoint.nDieMatrixId != a.nDieMatrixId) {
+            m_vmaxMatrixPoints.append(maxMatrixPoint);
+            m_vminMatrixPoints.append(minMatrixPoint);
+            maxMatrixPoint = a;
+            minMatrixPoint = a;
+        }
+        else {
+            //遍历找到矩阵最小和最大边界点
+            if (a.stPosition.x > maxMatrixPoint.stPosition.x)
+                maxMatrixPoint = a;
+            if (a.stPosition.y > maxMatrixPoint.stPosition.y)
+                maxMatrixPoint = a;
+            if (a.stPosition.x < minMatrixPoint.stPosition.x)
+                minMatrixPoint = a;
+            if (a.stPosition.y < minMatrixPoint.stPosition.y)
+                minMatrixPoint = a;
+        }
+        
+        //qDebug() << maxMatrixPoint.stPosition.x<<","<< maxMatrixPoint.stPosition.y << "  " << minMatrixPoint.stPosition.x << "," << minMatrixPoint.stPosition.y;
+        //qDebug() << a.stPosition.x << "  " << a.stPosition.y;
 
     }
+   
+    m_vmaxMatrixPoints.append(maxMatrixPoint);
+    m_vminMatrixPoints.append(minMatrixPoint);
+    
 
 }
 
-void Waffle::paintEvent(QPaintEvent *event) {
-    QPainter painter(this);
-
-    // 设置抗锯齿,使绘图更平滑
-    painter.setRenderHint(QPainter::Antialiasing);
-
-    // 绘制背景
-    painter.fillRect(this->rect(), Qt::white);
 
 
-    // 计算每个华夫台的总宽度和高度
-    int totalWidth = cols * gridSize + (cols - 1) * gap;
-    int totalHeight = rows * gridSize + (rows - 1) * gap;
-
-    // 计算华夫盒的总宽度和高度
-    int boxTotalWidth = boxCols * totalWidth + (boxCols - 1) * boxGap;
-    int boxTotalHeight = boxRows * totalHeight + (boxRows - 1) * boxGap;
-
-    // 确定华夫盒的起始位置,使其居中
-    int boxStartX = (width() - boxTotalWidth) / 2;
-    int boxStartY = (height() - boxTotalHeight) / 2;
-
-    // 绘制多个华夫台
-    for (int i = 0; i < boxRows; ++i) {
-        for (int j = 0; j < boxCols; ++j) {
-            // 计算每个华夫台的起始位置
-            int startX = boxStartX + j * (totalWidth + boxGap);
-            int startY = boxStartY + i * (totalHeight + boxGap);
-
-            // 绘制单个华夫台
-            drawWaffle(painter, startX, startY, rows, cols, gridSize, gap);
-        }
-    }
-}
 
-void Waffle::drawWaffle(QPainter &painter, int startX, int startY, int rows, int cols, int gridSize, int gap) {
-    // 绘制网格
-    for (int i = 0; i < rows; ++i) {
-        for (int j = 0; j < cols; ++j) {
-            // 计算每个格子的坐标
-            int x = startX + j * (gridSize + gap);
-            int y = startY + i * (gridSize + gap);
-            QRect cellRect(x, y, gridSize, gridSize);
-
-            // 填充颜色
-            painter.fillRect(cellRect, Qt::yellow);
-
-            // 绘制边框
-            painter.setPen(Qt::black);
-            painter.drawRect(cellRect);
-        }
-    }
-}
 
 void Waffle::paintInitFrom(QWidget *parent) {
     /*
@@ -193,8 +202,8 @@ void Waffle::initFrom(QWidget *parent) {
     }
 
     //目前没提供固晶点大小,以下用测试大小,后续可替换(实际大小,接口替换处)
-    double dieWidth = 20000;
-    double dieHeight = 20000;
+    double dieWidth = 0.5;
+    double dieHeight = 0.5;
     for (int i = 0; i < m_vWaffleData.size(); ++i) {
 
         // 绘制固晶点
@@ -202,6 +211,13 @@ void Waffle::initFrom(QWidget *parent) {
         //转换大小
         double dieWidthr = dieWidth / ratio;
         double dieHeightr = dieHeight / ratio;
+        double penSize;
+        if (dieWidthr < 1 || dieHeightr < 1) {
+            penSize = 0.1;
+        }
+        else {
+            penSize = 1;
+        }
         double diex, diey;
         diex = (m_vWaffleData[i].stPosition.x - minPoint.x() + dieWidth) / ratio;
         diey = (m_vWaffleData[i].stPosition.y - minPoint.y() + dieHeight) / ratio;
@@ -214,22 +230,144 @@ void Waffle::initFrom(QWidget *parent) {
             dieWidthr,
             dieHeightr
         );
-        WaffleItem* dieItem = new WaffleItem(m_vWaffleData[i]);
+        qDebug() << diex << "" << diey << dieWidthr << "   " << dieHeightr;
+        if (i % 2 == 0) {
+            m_vWaffleData[i].eStatus = ns_mat::PICK_DIE_STATUS::DIE_EXIST;
+        }
+        else {
+            m_vWaffleData[i].eStatus = ns_mat::PICK_DIE_STATUS::EDGE_DIE;
+        }
+        WaffleItem* dieItem = new WaffleItem(m_vWaffleData[i], penSize);
         dieItem->setRect(dieRect);
         dieItem->setZValue(1.0);
         scene->addItem(dieItem);
-        /*
-        // 添加固晶点编号
-        QGraphicsTextItem* dieText = new QGraphicsTextItem(dieItem);
-        dieText->setPlainText("PT" + QString::number(m_vWaffleData[i].stIndex.iIndex));
-        double dieFontSize = qMin(dieWidthr, dieHeightr) * 0.2;
-        QFont font;
-        font.setPointSizeF(dieFontSize);  // 使用浮点大小
-        dieText->setFont(font);
-        dieText->setPos(dieRect.center() - QPointF(dieText->boundingRect().width() / 2,
-            dieText->boundingRect().height() / 2));
-            */
     }
+
+    QPen ptpen(Qt::blue, 0.5);
+    QFont matrixFont;
+    double matrixFontSize = qMin(dieWidth / ratio, dieHeight / ratio) * 0.1;
+    matrixFont.setPointSizeF(matrixFontSize);  // 使用浮点大小
+
+    WAFFLE_MATRIX_POINT_STRUCT minPackMatrixPoint = m_vmaxMatrixPoints[0];
+    WAFFLE_MATRIX_POINT_STRUCT maxPackMatrixPoint = m_vmaxMatrixPoints[0];
+    for (int i = 0;i < m_vmaxMatrixPoints.size();i++) {
+        int ptmatx, ptmaty, ptmatWidth, ptmatHeight;
+
+
+        if (maxPackMatrixPoint.nPackMatrixId != m_vmaxMatrixPoints[i].nPackMatrixId) {
+            m_vmaxPackMatrixPoints.append(maxPackMatrixPoint);
+            m_vminPackMatrixPoints.append(minPackMatrixPoint);
+            maxPackMatrixPoint = m_vmaxMatrixPoints[i];
+            minPackMatrixPoint = m_vminMatrixPoints[i];
+        }
+        else {
+            //遍历找到矩阵最小和最大边界点
+            if (m_vmaxMatrixPoints[i].stPosition.x > maxPackMatrixPoint.stPosition.x)
+                maxPackMatrixPoint = m_vmaxMatrixPoints[i];
+            if (m_vminMatrixPoints[i].stPosition.y > maxPackMatrixPoint.stPosition.y)
+                maxPackMatrixPoint = m_vmaxMatrixPoints[i];
+            if (m_vmaxMatrixPoints[i].stPosition.x < minPackMatrixPoint.stPosition.x)
+                minPackMatrixPoint = m_vminMatrixPoints[i];
+            if (m_vminMatrixPoints[i].stPosition.y < minPackMatrixPoint.stPosition.y)
+                minPackMatrixPoint = m_vminMatrixPoints[i];
+        }
+
+        
+
+        ptmatx = (m_vminMatrixPoints[i].stPosition.x - minPoint.x() + 0.7 * dieWidth) / ratio;
+        ptmaty = (m_vminMatrixPoints[i].stPosition.y - minPoint.y() + 0.7 * dieHeight) / ratio;
+        ptmatWidth = (m_vmaxMatrixPoints[i].stPosition.x - m_vminMatrixPoints[i].stPosition.x + dieWidth * 1.6) / ratio;
+        ptmatHeight = (m_vmaxMatrixPoints[i].stPosition.y - m_vminMatrixPoints[i].stPosition.y + dieHeight * 1.6) / ratio;
+
+        QRectF ptRect(
+            ptmatx,
+            ptmaty,
+            ptmatWidth,
+            ptmatHeight
+        );
+
+        // 绘制die矩阵背景
+        QGraphicsRectItem* ptItem = new QGraphicsRectItem(ptRect);
+        ptItem->setPen(ptpen);
+        //ptItem->setBrush(QColor("#d5e4f8"));
+        scene->addItem(ptItem);
+        // 添加die矩阵标签
+        QRectF ptTextRect(
+            ptmatx,
+            ptmaty,
+            dieWidth / ratio * 0.6,
+            dieHeight / ratio * 0.2
+        );
+        QGraphicsRectItem* ptTextItem = new QGraphicsRectItem(ptTextRect);
+        ptTextItem->setPen(Qt::NoPen);
+        scene->addItem(ptTextItem);
+
+        QGraphicsTextItem* ptText = new QGraphicsTextItem(ptTextItem);
+        ptText->setPlainText(QString(tr("DieMat%1")).arg(m_vminMatrixPoints[i].nDieMatrixId));
+        ptText->setFont(matrixFont);
+        // 将文本居中于 ptTextRect
+        ptText->setPos(ptTextRect.center() - QPointF(ptText->boundingRect().width() / 2,
+            ptText->boundingRect().height() / 2));
+    }
+    m_vmaxPackMatrixPoints.append(maxPackMatrixPoint);
+    m_vminPackMatrixPoints.append(minPackMatrixPoint);
+
+    for (int i = 0;i < m_vmaxPackMatrixPoints.size();i++) {
+        int packmatx, packmaty, packmatWidth, packmatHeight;
+        packmatx = (m_vminPackMatrixPoints[i].stPosition.x - minPoint.x() + 0.4 * dieWidth) / ratio;
+        packmaty = (m_vminPackMatrixPoints[i].stPosition.y - minPoint.y() + 0.4 * dieHeight) / ratio;
+        packmatWidth = (m_vmaxPackMatrixPoints[i].stPosition.x - m_vminPackMatrixPoints[i].stPosition.x + dieWidth * 2.2) / ratio;
+        packmatHeight = (m_vmaxPackMatrixPoints[i].stPosition.y - m_vminPackMatrixPoints[i].stPosition.y + dieHeight * 2.2) / ratio;
+
+        QRectF packRect(
+            packmatx,
+            packmaty,
+            packmatWidth,
+            packmatHeight
+        );
+
+        // 绘制die矩阵背景
+        QGraphicsRectItem* packItem = new QGraphicsRectItem(packRect);
+        packItem->setPen(ptpen);
+        //ptItem->setBrush(QColor("#d5e4f8"));
+        scene->addItem(packItem);
+        // 添加die矩阵标签
+        QRectF packTextRect(
+            packmatx,
+            packmaty,
+            dieWidth / ratio * 0.6,
+            dieHeight / ratio * 0.2
+        );
+        QGraphicsRectItem* packTextItem = new QGraphicsRectItem(packTextRect);
+        packTextItem->setPen(Qt::NoPen);
+        scene->addItem(packTextItem);
+
+        QGraphicsTextItem* packText = new QGraphicsTextItem(packTextItem);
+        packText->setPlainText(QString(tr("PackMat%1")).arg(m_vmaxPackMatrixPoints[i].nPackMatrixId));
+        packText->setFont(matrixFont);
+        // 将文本居中于 ptTextRect
+        packText->setPos(packTextRect.center() - QPointF(packText->boundingRect().width() / 2,
+            packText->boundingRect().height() / 2));
+
+    }
+    view->setScene(scene);
+    view->resize(width, height);
+
+    // 创建一个 QPixmap 对象用于保存绘制的图像
+    globalPixmap = QPixmap(width, height);
+    globalPixmap.fill(Qt::white);  // 填充背景色为白色
+    QPixmap originalPixmap = QPixmap::grabWidget(view);
+    // 设置目标尺寸(例如:宽度 200,高度 150)
+    QSize targetSize(width, height);
+
+    // 不保持比例,直接拉伸到指定尺寸
+    QPixmap scaledPixmap = originalPixmap.scaled(
+        targetSize,
+        Qt::IgnoreAspectRatio,
+        Qt::SmoothTransformation
+    );
+    globalPixmap = scaledPixmap;
+
   
 }
 QPixmap Waffle::getGlobalPixmap() const {

+ 4 - 3
View/die-bonder-ui/CameraMaterialGroupWnd/MaterialWindow/Waffle.h

@@ -20,14 +20,11 @@ public:
      */
     void UpdataVal(const std::vector<ns_mat::WAFFLE_MATRIX_POINT_STRUCT>& veWaffle);
 
-
-    void paintEvent(QPaintEvent *event) override;
     void initFrom(QWidget *parent);
     void paintInitFrom(QWidget *parent);
     QPixmap getGlobalPixmap() const;
 
 private:
-    void drawWaffle(QPainter &painter, int startX, int startY, int rows, int cols, int gridSize, int gap);
 
     // 华夫台的参数
     int gridSize;  // 每个格子的大小
@@ -47,6 +44,10 @@ private:
     QPointF maxPoint;
     QPointF minPoint;
     ns_module::CViewInterface* m_pCViewInterface;
+    QVector<WAFFLE_MATRIX_POINT_STRUCT> m_vminMatrixPoints;
+    QVector<WAFFLE_MATRIX_POINT_STRUCT> m_vmaxMatrixPoints;
+    QVector<WAFFLE_MATRIX_POINT_STRUCT> m_vminPackMatrixPoints;
+    QVector<WAFFLE_MATRIX_POINT_STRUCT> m_vmaxPackMatrixPoints;
 
 public:
     QGraphicsScene*     scene = nullptr;

+ 105 - 80
View/die-bonder-ui/CameraMaterialGroupWnd/MaterialWindow/WaffleGraphicsView.cpp

@@ -1,7 +1,7 @@
 #include "WaffleGraphicsView.h"
 #include <QDebug>
 #include <QScrollBar>
-
+#
 WaffleGraphicsView::WaffleGraphicsView(QGraphicsScene* scene, QWidget* parent)
     : QGraphicsView(scene, parent), selecting(false), selectionRect(nullptr),
     scaleFactor(1.0), isDragging(false), thumbnailLabel(nullptr),
@@ -52,14 +52,14 @@ bool WaffleGraphicsView::eventFilter(QObject *obj, QEvent *event) {
 
 void WaffleGraphicsView::mousePressEvent(QMouseEvent* event) {
     if (event->button() == Qt::LeftButton) {
-        // 清空选中的 DieItem
-        for (auto& item : selectedItemsMap) {
-            DieItem* die = dynamic_cast<DieItem*>(item);
+        // 清空选中的 WaffleItem
+        for (auto& item : selectedItems) {
+            WaffleItem* die = dynamic_cast<WaffleItem*>(item);
             if (die) {
                 die->setSelected(false); // 取消选中状态
             }
         }
-        selectedItemsMap.clear();
+        selectedItems.clear();
 
         if (topLeftItem && topLeftItem->scene()) {
             topLeftItem->setRightSelected(false);
@@ -70,17 +70,18 @@ void WaffleGraphicsView::mousePressEvent(QMouseEvent* event) {
             bottomRightItem->setRightSelected(false);
         }
         bottomRightItem.clear();
-        topLeftIndex = qMakePair(-1, -1);
-        bottomRightIndex = qMakePair(-1, -1);
-        // 获取点击位置的 DieItem
+
+        // 获取点击位置的 WaffleItem
         if (selectedItem && selectedItem->scene()) {
             selectedItem->setLeftSelected(false);
         }
         selectedItem.clear();
         QGraphicsItem* item = itemAt(event->pos());
         if (item) {
-            selectedItem = dynamic_cast<DieItem*>(item);
-            selectedItem->setLeftSelected(true);
+            if (typeid(*item) == typeid(WaffleItem)) {
+                selectedItem = static_cast<WaffleItem*>(item);
+                selectedItem->setLeftSelected(true);
+            }
 
         }
 
@@ -140,8 +141,7 @@ void WaffleGraphicsView::mouseReleaseEvent(QMouseEvent* event) {
                 bottomRightItem->setRightSelected(false);
             }
             bottomRightItem.clear();
-            topLeftIndex = qMakePair(-1, -1);
-            bottomRightIndex = qMakePair(-1, -1);
+
             QRectF selectedArea = selectionRect->rect();
             scene()->removeItem(selectionRect);
             delete selectionRect;
@@ -149,10 +149,10 @@ void WaffleGraphicsView::mouseReleaseEvent(QMouseEvent* event) {
 
             QList<QGraphicsItem*> items = scene()->items(selectedArea, Qt::IntersectsItemShape);
             for (QGraphicsItem* item : items) {
-                DieItem* die = dynamic_cast<DieItem*>(item);
+                WaffleItem* die = dynamic_cast<WaffleItem*>(item);
                 if (die) {
-                    // 将 DieItem 添加到 map 中
-                    selectedItemsMap.insert(qMakePair(die->getRow(), die->getCol()), die);
+                    // 将 WaffleItem 添加到 map 中
+                    selectedItems.append(die);
                     die->setSelected(true); // 设置选中状态
                 }
             }
@@ -165,7 +165,7 @@ void WaffleGraphicsView::mouseReleaseEvent(QMouseEvent* event) {
         // 如果没有进行拖动,则弹出右键菜单
         if (!isDragging) {
             QGraphicsItem* item = itemAt(event->pos());
-            DieItem* die = dynamic_cast<DieItem*>(item);
+            WaffleItem* die = dynamic_cast<WaffleItem*>(item);
             QMenu menu;
             QAction* showThumb = menu.addAction(thumbnailVisible ? tr("Hide thumbnails", "隐藏缩略图") : tr("Show thumbnails", "显示缩略图"));
 
@@ -173,23 +173,21 @@ void WaffleGraphicsView::mouseReleaseEvent(QMouseEvent* event) {
             connect(showThumb, &QAction::triggered, [this]{
                 thumbnailVisible ? hideThumbnail() : showThumbnail();
             });
-            menu.addAction(tr("Send Location", "发送位置"), [this] {
-                if (selectedItem) {
-                    qDebug() << "Row:" << selectedItem->getRow() << "Col:" << selectedItem->getCol();
-                    selectedItem->setLeftSelected(false);
-                    selectedItem = nullptr;
-                }
-            });
+            //menu.addAction(tr("Send Location", "发送位置"), [this] {
+            //    if (selectedItem) {
+            //        selectedItem->setLeftSelected(false);
+            //        selectedItem = nullptr;
+            //    }
+            //});
             if (die) {
                 menu.addAction(tr("move to current location","移动到该位置"), [this, die] {
-                    for (auto& item : selectedItemsMap) {
-                        DieItem* die = dynamic_cast<DieItem*>(item);
+                    for (auto& item : selectedItems) {
+                        WaffleItem* die = dynamic_cast<WaffleItem*>(item);
                         if (die) {
                             die->setSelected(false);
                         }
                     }
-                    selectedItemsMap.clear();
-
+                    selectedItems.clear();
                     if (topLeftItem && topLeftItem->scene()) {
                         topLeftItem->setRightSelected(false);
                     }
@@ -199,8 +197,7 @@ void WaffleGraphicsView::mouseReleaseEvent(QMouseEvent* event) {
                         bottomRightItem->setRightSelected(false);
                     }
                     bottomRightItem.clear();
-                    topLeftIndex = qMakePair(-1, -1);
-                    bottomRightIndex = qMakePair(-1, -1);
+
 
                     if (selectedItem && selectedItem->scene()) {
                         selectedItem->setLeftSelected(false);
@@ -209,29 +206,37 @@ void WaffleGraphicsView::mouseReleaseEvent(QMouseEvent* event) {
 
                     selectedItem = die;
                     selectedItem->setLeftSelected(true);
+                    m_pCViewInterface->GetViewMatrix()->MoveWafflePackToPoint(die->getPoint().iDieIndex);
+                    qDebug() << "move to point" << die->getPoint().iDieIndex;
                 });
 
                 // 设置区域边界点菜单
                 menu.addAction(tr("set Top left point","设为左上点"), [this, die] {
+
                     if (topLeftItem && topLeftItem->scene()) {
                         topLeftItem->setRightSelected(false);
                     }
                     topLeftItem.clear();
                     topLeftItem = die;
                     topLeftItem->setRightSelected(true);
-                    topLeftIndex = qMakePair(die->getRow(), die->getCol());
-                    if (bottomRightIndex.first >= 0) checkAndCreateRegion();
+                    if (bottomRightItem && bottomRightItem->scene()){
+                        if (bottomRightItem->getPoint().nPackMatrixId == topLeftItem->getPoint().nPackMatrixId && bottomRightItem->getPoint().nDieMatrixId == topLeftItem->getPoint().nDieMatrixId)
+                            checkAndCreateRegion();
+                    }
                 });
 
                 menu.addAction(tr("set bottom right point","设为右下点"), [this, die] {
+
                     if (bottomRightItem && bottomRightItem->scene()) {
                         bottomRightItem->setRightSelected(false);
                     }
                     bottomRightItem.clear();
                     bottomRightItem = die;
                     bottomRightItem->setRightSelected(true);
-                    bottomRightIndex = qMakePair(die->getRow(), die->getCol());
-                    if (topLeftIndex.first >= 0) checkAndCreateRegion();
+                    if (topLeftItem && topLeftItem->scene()) {
+                        if (bottomRightItem->getPoint().nPackMatrixId == topLeftItem->getPoint().nPackMatrixId && bottomRightItem->getPoint().nDieMatrixId == topLeftItem->getPoint().nDieMatrixId)
+                            checkAndCreateRegion();
+                    }
                 });
             }
 
@@ -254,11 +259,11 @@ void WaffleGraphicsView::wheelEvent(QWheelEvent* event) {
 
 // 缩略图功能实现
 void WaffleGraphicsView::showThumbnail() {
-    // 本地图片路径(根据实际路径修改)
-    QString imagePath = ":/images/test_image/image_1.png";  // 替换为本地图片路径
 
-    // 加载本地图片
-    QPixmap thumb(imagePath);
+    ImageInfo image;
+    m_pCViewInterface->GetViewMatrix()->GetWafflePackRefImage(image);
+
+    QPixmap thumb = convertToPixmap(image);
 
     if (!thumb.isNull()) {
         // 如果图片加载成功,设置为缩略图
@@ -281,54 +286,46 @@ void WaffleGraphicsView::hideThumbnail() {
 }
 void WaffleGraphicsView::checkAndCreateRegion()
 {
-    // 仅当两个点都有效时处理
-    if (topLeftIndex.first < 0 || bottomRightIndex.first < 0) return;
-
+    
     // 确定行列范围
-    int startRow = qMin(topLeftIndex.first, bottomRightIndex.first);
-    int endRow = qMax(topLeftIndex.first, bottomRightIndex.first);
-    int startCol = qMin(topLeftIndex.second, bottomRightIndex.second);
-    int endCol = qMax(topLeftIndex.second, bottomRightIndex.second);
+    int startRow = topLeftItem->getPoint().nDieRow;
+    int endRow = bottomRightItem->getPoint().nDieRow;
+    int startCol = topLeftItem->getPoint().nDieCol;
+    int endCol = bottomRightItem->getPoint().nDieCol;
 
     // 遍历场景中的所有项
     foreach (QGraphicsItem* item, scene()->items()) {
-        if (DieItem* die = dynamic_cast<DieItem*>(item)) {
-            int row = die->getRow();
-            int col = die->getCol();
+        if (WaffleItem* die = dynamic_cast<WaffleItem*>(item)) {
 
             // 判断是否在区域内
-            if (row >= startRow && row <= endRow &&
-                col >= startCol && col <= endCol) {
-
-                // 更新选中状态
-                die->setSelected(true);
-                selectedItemsMap.insert(qMakePair(row, col), die);
+            if (die->getPoint().nDieMatrixId == topLeftItem->getPoint().nDieMatrixId && die->getPoint().nPackMatrixId == topLeftItem->getPoint().nPackMatrixId) {
+                if (die->getPoint().nDieRow >= startRow && die->getPoint().nDieRow <= endRow && die->getPoint().nDieCol >= startCol && die->getPoint().nDieCol <= endCol) {
+                    // 更新选中状态
+                    die->setSelected(true);
+                    selectedItems.append(die);
+                }
             }
         }
     }
 
-    // 重置索引点
-    topLeftIndex = qMakePair(-1, -1);
-    bottomRightIndex = qMakePair(-1, -1);
+    
 
 }
 
 void WaffleGraphicsView::clearRegion()
 {
-    // 清空选中的 DieItem
-    for (auto& item : selectedItemsMap) {
-        DieItem* die = dynamic_cast<DieItem*>(item);
+    // 清空选中的 WaffleItem
+    for (auto& item : selectedItems) {
+        WaffleItem* die = dynamic_cast<WaffleItem*>(item);
         if (die) {
             die->setSelected(false); // 取消选中状态
         }
     }
-    selectedItemsMap.clear();
+    selectedItems.clear();
 
     if (selectedItem && selectedItem->scene()) {
         selectedItem->setLeftSelected(false);
     }
-    selectedItem.clear();
-
     if (topLeftItem && topLeftItem->scene()) {
         topLeftItem->setRightSelected(false);
     }
@@ -338,6 +335,8 @@ void WaffleGraphicsView::clearRegion()
         bottomRightItem->setRightSelected(false);
     }
     bottomRightItem.clear();
+    selectedItem.clear();
+    bottomRightItem.clear();
     topLeftIndex = qMakePair(-1, -1);
     bottomRightIndex = qMakePair(-1, -1);
 
@@ -347,24 +346,39 @@ void WaffleGraphicsView::clearRegion()
 }
 void WaffleGraphicsView::setRegion()
 {
-    for (auto it = selectedItemsMap.begin(); it != selectedItemsMap.end(); ++it) {
-        QPair<int, int> key = it.key();  // 获取当前元素的 key
-        qDebug() << "Row:" << key.first << ", Col:" << key.second;
+    int maxRow = 1;
+    int maxCol = 1;
+    int minRow = 1;
+    int minCol = 1;
+    WaffleItem* dieItem;
+    for (auto it = selectedItems.begin(); it != selectedItems.end(); ++it) {
+        dieItem = dynamic_cast<WaffleItem*>(*it);
+        if (dieItem) {
+            if (dieItem->getPoint().nDieRow > maxRow)
+                maxRow = dieItem->getPoint().nDieRow;
+            if (dieItem->getPoint().nDieCol > maxCol)
+                maxCol = dieItem->getPoint().nDieCol;
+            if (dieItem->getPoint().nDieRow < minRow)
+                minRow = dieItem->getPoint().nDieRow;
+            if (dieItem->getPoint().nDieRow < minCol)
+                minCol = dieItem->getPoint().nDieCol;
+        }
     }
+    m_pCViewInterface->GetViewMatrix()->SetWafflePackRectBorder(dieItem->getPoint().nPackMatrixId, dieItem->getPoint().nDieMatrixId, minRow, minCol, maxRow, maxCol);
+    qDebug() << dieItem->getPoint().nPackMatrixId << "  " << dieItem->getPoint().nDieMatrixId << " " << minRow << " " << minCol << " " << maxRow << " " << maxCol;
 
-    // 清空选中的 DieItem
-    for (auto& item : selectedItemsMap) {
-        DieItem* die = dynamic_cast<DieItem*>(item);
+    // 清空选中的 WaffleItem
+    for (auto& item : selectedItems) {
+        WaffleItem* die = dynamic_cast<WaffleItem*>(item);
         if (die) {
             die->setSelected(false); // 取消选中状态
         }
     }
-    selectedItemsMap.clear();
+    selectedItems.clear();
 
     if (selectedItem && selectedItem->scene()) {
         selectedItem->setLeftSelected(false);
     }
-    selectedItem.clear();
 
     if (topLeftItem && topLeftItem->scene()) {
         topLeftItem->setRightSelected(false);
@@ -375,8 +389,7 @@ void WaffleGraphicsView::setRegion()
         bottomRightItem->setRightSelected(false);
     }
     bottomRightItem.clear();
-    topLeftIndex = qMakePair(-1, -1);
-    bottomRightIndex = qMakePair(-1, -1);
+
 }
 
 void WaffleGraphicsView::setCViewInterface(ns_module::CViewInterface* CViewInterface) {
@@ -456,30 +469,32 @@ QPixmap WaffleGraphicsView::convertToPixmap(const ImageInfo& imgData)
     return QPixmap::fromImage(qImg);
 }
 
-WaffleItem::WaffleItem(ns_mat::WAFFLE_MATRIX_POINT_STRUCT point, QGraphicsItem* parent)
-    : QGraphicsRectItem(parent), point(point) {
+WaffleItem::WaffleItem(ns_mat::WAFFLE_MATRIX_POINT_STRUCT point, double penSize, QGraphicsItem* parent)
+    : QGraphicsRectItem(parent), point(point), penSize(penSize){
     setBrush(getColorByStatus());
-    setPen(QPen(QColor(0, 0, 0), 1));
+    setPen(QPen(QColor(0, 0, 0), penSize));
 }
 
 void WaffleItem::setSelected(bool selected) {
     if (selected) {
-        setPen(QPen(Qt::red, 1));
+        setPen(QPen(Qt::red, penSize*2));
     }
     else {
-        setPen(QPen(Qt::black, 1));  // 未选中时恢复为黑色边框
+        setPen(QPen(Qt::black, penSize));  // 未选中时恢复为黑色边框
     }
 }
 
 void WaffleItem::setLeftSelected(bool selected) {
     if (selected) {
-        setPen(QPen(Qt::green, 1));
+        setPen(QPen(Qt::green, penSize*2));
     }
     else {
-        setPen(QPen(Qt::black, 1));  // 未选中时恢复为黑色边框
+        setPen(QPen(Qt::black, penSize));  // 未选中时恢复为黑色边框
     }
 }
-
+ns_mat::WAFFLE_MATRIX_POINT_STRUCT WaffleItem::getPoint() {
+    return point;
+}
 
 void WaffleItem::hoverEnterEvent(QGraphicsSceneHoverEvent*) {
     setZValue(1); // 悬停时提升Z值
@@ -502,3 +517,13 @@ QColor WaffleItem::getColorByStatus() {
     default: return QColor(0, 0, 0); // 默认黑色
     }
 }
+void WaffleItem::setRightSelected(bool selected) {
+    if (selected) {
+        setPen(QPen(QColor("#00F5FF"), penSize*2));
+    }
+    else {
+        setPen(QPen(Qt::black, penSize));  // 未选中时恢复为黑色边框
+    }
+    // qDebug() << "DieItem clicked: Row:" << row << "Col:" << col;
+
+}

+ 33 - 22
View/die-bonder-ui/CameraMaterialGroupWnd/MaterialWindow/WaffleGraphicsView.h

@@ -4,10 +4,38 @@
 #include <QGraphicsScene>
 #include <QGraphicsRectItem>
 #include <QMouseEvent>
-#include "DieItem.h"
 #include <QLabel>
 #include <QPointer>
 #include <CViewInterface.h>
+#include <QColor>
+#include <QDebug>
+#include <QPen>
+#include <QMenu>
+#include <QGraphicsSceneContextMenuEvent>
+#include <CWaferMatrix.h>
+
+class WaffleItem : public QObject, public QGraphicsRectItem {
+public:
+    WaffleItem(ns_mat::WAFFLE_MATRIX_POINT_STRUCT point, double penSize, QGraphicsItem* parent = nullptr);
+
+    void setSelected(bool selected);
+    void setLeftSelected(bool selected);
+    void setPenSize(double size);
+    void WaffleItem::setRightSelected(bool selected);
+    ns_mat::WAFFLE_MATRIX_POINT_STRUCT getPoint();
+
+
+private:
+
+    // 获取单元格状态颜色
+    QColor getColorByStatus();
+    WAFFLE_MATRIX_POINT_STRUCT point;
+    double penSize;
+protected:
+    void hoverEnterEvent(QGraphicsSceneHoverEvent*) override;
+    void hoverLeaveEvent(QGraphicsSceneHoverEvent*) override;
+};
+
 class WaffleGraphicsView : public QGraphicsView {
     Q_OBJECT
 
@@ -31,15 +59,15 @@ private:
     QGraphicsRectItem* selectionRect; // 框选矩形
     double scaleFactor; // 当前缩放比例
     bool isDragging = false;
-    QMap<QPair<int, int>, QGraphicsItem*> selectedItemsMap;
+    QVector <QGraphicsItem*> selectedItems;
     QLabel *thumbnailLabel; // 缩略图标签
     bool thumbnailVisible; // 缩略图可见状态
 
     QPair<int, int> topLeftIndex;
     QPair<int, int> bottomRightIndex;
-    QPointer<DieItem> selectedItem;
-    QPointer<DieItem> topLeftItem;
-    QPointer<DieItem> bottomRightItem;
+    QPointer<WaffleItem> selectedItem;
+    QPointer<WaffleItem> topLeftItem;
+    QPointer<WaffleItem> bottomRightItem;
 
     void showThumbnail();
     void hideThumbnail();
@@ -51,23 +79,6 @@ private:
     ns_module::CViewInterface* m_pCViewInterface;
 };
 
-class WaffleItem : public QObject, public QGraphicsRectItem {
-public:
-    WaffleItem(ns_mat::WAFFLE_MATRIX_POINT_STRUCT point, QGraphicsItem* parent = nullptr);
 
-    void setSelected(bool selected);
-    void setLeftSelected(bool selected);
-
-
-
-private:
-
-    // 获取单元格状态颜色
-    QColor getColorByStatus();
-    WAFFLE_MATRIX_POINT_STRUCT point;
-protected:
-    void hoverEnterEvent(QGraphicsSceneHoverEvent*) override;
-    void hoverLeaveEvent(QGraphicsSceneHoverEvent*) override;
-};
 
 #endif // WAFFLEGRAPHICSVIEW_H

+ 3 - 1
View/die-bonder-ui/OriginalWnd/MainAndSecondaryCamerasWnd.cpp

@@ -100,7 +100,7 @@ void MainAndSecondaryCamerasWnd::InitPage()
                 CameraInfo test;
                 test.iCameraId = i;
                 test.name = ("camera" + QString::number(i)).toStdString();
-                test.eType = MATERIAL_WAFER;
+                test.eType = MATERIAL_WAFFLE;
                 manager = new CameraImageHandler(num, test);
             }
             else
@@ -129,6 +129,8 @@ void MainAndSecondaryCamerasWnd::InitPage()
             }
             if (manager->getWaffle()) {
                 m_mapWaffleMap.insert(num, manager->getWaffle());
+                ui->viewwidgetgroup_L->setWaffle(m_mapWaffleMap.value(i + 1));
+                m_allGroup[i]->setWaffleWidget(ui->viewwidgetgroup_L->getWaffle()->getGlobalPixmap());
             }
             if (manager->getMaterialBox()) {
                 m_mapMaterialBoxMap.insert(num, manager->getMaterialBox());

+ 4 - 0
View/die-bonder-ui/Src/RewriteControl/ControlOperationPage.cpp

@@ -229,6 +229,10 @@ Bond* ControlOperationPage::getBond() {
     return m_bond;
 }
 
+Waffle* ControlOperationPage::getWaffle() {
+    return m_waffle;
+}
+
 void ControlOperationPage::setWafer(Wafer* wafer) {
     m_wafer = wafer;
     updateMaterialWidget(wafer_kind);

+ 1 - 0
View/die-bonder-ui/Src/RewriteControl/ControlOperationPage.h

@@ -53,6 +53,7 @@ public:
     void setEnableControls(bool enable);
     Wafer* getWafer();
     Bond* getBond();
+    Waffle* getWaffle();
 
     /**更新硬件指针
      */