Procházet zdrojové kódy

问题修复:修改编译错误,同步代码

JonYang před 3 týdny
rodič
revize
e8aa3a1a8e

+ 4 - 0
View/die-bonder-ui/CameraMaterialGroupWnd/CameraImage/CameraImageHandler.cpp

@@ -67,6 +67,10 @@ MaterialBox* CameraImageHandler::getMaterialBox() const
     return materialBox;
 }
 
+Bond* CameraImageHandler::getBond() const {
+    return bond;
+}
+
 void CameraImageHandler::initGroup(int CameraId) {
    /* int CameraId, QString path, enum MaterialWindowType materialWindowType*/
     QStringList dispmodel1;

+ 5 - 0
View/die-bonder-ui/CameraMaterialGroupWnd/CameraImage/CameraImageHandler.h

@@ -12,6 +12,7 @@
 #include "CameraMaterialGroupWnd/Group.h"
 #include "CameraMaterialGroupWnd/MaterialWindow/Wafer.h"
 #include "CameraMaterialGroupWnd/MaterialWindow/Waffle.h"
+#include "../MaterialWindow/Bond.h"
 
 
 class CameraImageHandler : public QWidget {
@@ -24,6 +25,8 @@ public:
     Waffle* getWaffle() const;
     MaterialBox* getMaterialBox() const;
 
+    Bond* getBond() const;
+
 private:
     void captureAndConvertImage(int CameraId);
 
@@ -44,6 +47,8 @@ private:
 
     MaterialBox* materialBox = nullptr;
 
+    Bond* bond = nullptr;
+
     int MaterialWindowType; // 物料窗口类型标识,1代表圆晶 后面接口获取标识
 };
 

+ 24 - 24
View/die-bonder-ui/CameraMaterialGroupWnd/MaterialWindow/Bond.cpp

@@ -27,15 +27,15 @@ void Bond::generateTestData() {
 
                     for (int dieRow = 0; dieRow < 2; ++dieRow) {
                         for (int dieCol = 0; dieCol < 3; ++dieCol) {
-                            POINT_INFO_STRUCT_1 point;
+                            ns_mat::POINT_INFO_STRUCT point;
                             point.stIndex.iPcbMatId = iPcbMatId;
                             point.stIndex.iPtMatId = iPtMatId;
-                            point.stIndex.iRow = pcbRow;
-                            point.stIndex.iCol = pcbCol;
+                            point.stIndex.iPcbRow = pcbRow;
+                            point.stIndex.iPcbCol = pcbCol;
                             point.stIndex.iPtRow = dieRow;
                             point.stIndex.iPtCol = dieCol;
                             point.stIndex.iIndex = ++dieIndex;
-                            point.stBondStatus.bDieStatus = static_cast<DIE_STATUS_1>(std::rand() % 7);
+                            point.stBondStatus.bDieStatus = static_cast<ns_mat::DIE_STATUS>(std::rand() % 7);
                             bondData.append(point);
                         }
                     }
@@ -55,8 +55,8 @@ void Bond::initFrom(QWidget* parent) {
     // Step 1: 收集PCB全局布局信息
     QMap<QPair<int, int>, int> pcbPosMap;
     QSet<int> uniquePcbIds;
-    foreach(const POINT_INFO_STRUCT_1 & point, bondData) {
-        QPair<int, int> pos(point.stIndex.iRow, point.stIndex.iCol);
+    foreach(const ns_mat::POINT_INFO_STRUCT & point, bondData) {
+        QPair<int, int> pos(point.stIndex.iPcbRow, point.stIndex.iPcbCol);
         if (!pcbPosMap.contains(pos)) {
             pcbPosMap[pos] = point.stIndex.iPcbMatId;
         }
@@ -85,8 +85,8 @@ void Bond::initFrom(QWidget* parent) {
     qreal pcbHeight = (totalHeight - (pcbRows - 1) * pcbSpacing) / pcbRows;
 
     // Step 3: 预处理数据分组
-    QMap<int, QMap<int, QList<POINT_INFO_STRUCT_1>>> groupedData;
-    foreach(const POINT_INFO_STRUCT_1 & point, bondData) {
+    QMap<int, QMap<int, QList<ns_mat::POINT_INFO_STRUCT>>> groupedData;
+    foreach(const ns_mat::POINT_INFO_STRUCT & point, bondData) {
         groupedData[point.stIndex.iPcbMatId][point.stIndex.iPtMatId].append(point);
     }
 
@@ -185,7 +185,7 @@ void Bond::initFrom(QWidget* parent) {
             scene->addItem(ptText);
 
             // Step 5: 绘制固晶点
-            QList<POINT_INFO_STRUCT_1> points = groupedData[pcbId][ptId];
+            QList<ns_mat::POINT_INFO_STRUCT> points = groupedData[pcbId][ptId];
             if (points.isEmpty()) continue;
 
             // 获取固晶点矩阵尺寸
@@ -203,7 +203,7 @@ void Bond::initFrom(QWidget* parent) {
             QFont font_2;
             font_2.setPointSize(fontSize_2);
 
-            foreach(const POINT_INFO_STRUCT_1 & point, points) {
+            foreach(const ns_mat::POINT_INFO_STRUCT & point, points) {
                 // 计算固晶点位置
                 QRectF dieRect(
                     ptRect.x() + point.stIndex.iPtCol * (dieWidth + dieMargin) + dieMargin,
@@ -245,8 +245,8 @@ void Bond::paintInitFrom(QWidget* parent) {
     // Step 1: 收集PCB全局布局信息
     QMap<QPair<int, int>, int> pcbPosMap;
     QSet<int> uniquePcbIds;
-    foreach(const POINT_INFO_STRUCT_1 & point, bondData) {
-        QPair<int, int> pos(point.stIndex.iRow, point.stIndex.iCol);
+    foreach(const ns_mat::POINT_INFO_STRUCT & point, bondData) {
+        QPair<int, int> pos(point.stIndex.iPcbRow, point.stIndex.iPcbCol);
         if (!pcbPosMap.contains(pos)) {
             pcbPosMap[pos] = point.stIndex.iPcbMatId;
         }
@@ -272,8 +272,8 @@ void Bond::paintInitFrom(QWidget* parent) {
     qreal pcbHeight = (totalHeight - (pcbRows - 1) * pcbSpacing) / pcbRows;
 
     // Step 3: 预处理数据分组
-    QMap<int, QMap<int, QList<POINT_INFO_STRUCT_1>>> groupedData;
-    foreach(const POINT_INFO_STRUCT_1 & point, bondData) {
+    QMap<int, QMap<int, QList<ns_mat::POINT_INFO_STRUCT>>> groupedData;
+    foreach(const ns_mat::POINT_INFO_STRUCT & point, bondData) {
         groupedData[point.stIndex.iPcbMatId][point.stIndex.iPtMatId].append(point);
     }
 
@@ -340,7 +340,7 @@ void Bond::paintInitFrom(QWidget* parent) {
             painter.drawRect(ptRect);
 
             // Step 5: 绘制固晶点
-            QList<POINT_INFO_STRUCT_1> points = groupedData[pcbId][ptId];
+            QList<ns_mat::POINT_INFO_STRUCT> points = groupedData[pcbId][ptId];
             if (points.isEmpty()) continue;
 
             // 获取固晶点矩阵尺寸
@@ -354,7 +354,7 @@ void Bond::paintInitFrom(QWidget* parent) {
             qreal dieWidth = (ptRect.width() - (dieCols + 1) * dieMargin) / dieCols;
             qreal dieHeight = (ptRect.height() - (dieRows + 1) * dieMargin) / dieRows;
 
-            foreach(const POINT_INFO_STRUCT_1 & point, points) {
+            foreach(const ns_mat::POINT_INFO_STRUCT & point, points) {
                 // 计算固晶点位置
                 QRectF dieRect(
                     ptRect.x() + point.stIndex.iPtCol * (dieWidth + dieMargin) + dieMargin,
@@ -373,15 +373,15 @@ void Bond::paintInitFrom(QWidget* parent) {
     painter.end();
 }
 
-QColor Bond::getColorByStatus(DIE_STATUS_1 status) {
+QColor Bond::getColorByStatus(ns_mat::DIE_STATUS status) {
     switch (status) {
-    case NO_PICK: return QColor(200, 200, 200);
-    case WAF_PICK_DONE: return QColor(100, 200, 230);
-    case TRANSFER_BOND_DONE: return QColor(255, 255, 0);
-    case TRANSFER_PICK_DONE: return QColor(255, 165, 0);
-    case LOOKUP_CALIB_DONE: return QColor(0, 150, 255);
-    case BOND_DONE: return QColor(144, 238, 144);
-    case BOND_DEL: return QColor(255, 50, 50);
+    //case ns_mat::DIE_STATUS::NO_PICK: return QColor(200, 200, 200);
+    //case ns_mat::DIE_STATUS::WAF_PICK_DONE: return QColor(100, 200, 230);
+    //case ns_mat::DIE_STATUS::TRANSFER_BOND_DONE: return QColor(255, 255, 0);
+    case ns_mat::DIE_STATUS::TRANSFER_PICK_DONE: return QColor(255, 165, 0);
+    case ns_mat::DIE_STATUS::LOOKUP_CALIB_DONE: return QColor(0, 150, 255);
+    case ns_mat::DIE_STATUS::BOND_DONE: return QColor(144, 238, 144);
+    case ns_mat::DIE_STATUS::BOND_DEL: return QColor(255, 50, 50);
     default: return Qt::gray;
     }
 }

+ 3 - 2
View/die-bonder-ui/CameraMaterialGroupWnd/MaterialWindow/Bond.h

@@ -5,6 +5,7 @@
 #include <QGraphicsScene>
 #include <QMap>
 #include "BondGraphicsView.h"
+#include <CBondMatrix.h>
 
 class Bond : public QWidget {
     Q_OBJECT
@@ -18,13 +19,13 @@ public:
     QGraphicsScene* scene;
 
 private:
-    QList<POINT_INFO_STRUCT_1> bondData;
+    QList<ns_mat::POINT_INFO_STRUCT> bondData;
     QMap<int, QPair<int, int>> pcbDimensions;
     QMap<int, QMap<int, QPair<int, int>>> ptDimensions;
     QPixmap globalPixmap;
 
     void generateTestData();
-    QColor getColorByStatus(DIE_STATUS_1 status);
+    QColor getColorByStatus(ns_mat::DIE_STATUS status);
 };
 
 #endif // BOND_H

+ 37 - 0
View/die-bonder-ui/CameraMaterialGroupWnd/MaterialWindow/BondGraphicsView.cpp

@@ -2,6 +2,43 @@
 #include <QDebug>
 #include <QScrollBar>
 
+BondItem::BondItem(ns_mat::POINT_INFO_STRUCT point, QGraphicsItem* parent)
+    : QGraphicsRectItem(parent), point(point) {
+    setBrush(getColorByStatus(point.stBondStatus.bDieStatus));
+    setPen(QPen(QColor(0, 0, 0), 1));
+}
+
+void BondItem::setSelected(bool selected) {
+    if (selected) {
+        setPen(QPen(Qt::red, 1));
+    }
+    else {
+        setPen(QPen(Qt::black, 1));  // 未选中时恢复为黑色边框
+    }
+}
+
+void BondItem::setLeftSelected(bool selected) {
+    if (selected) {
+        setPen(QPen(Qt::green, 1));
+    }
+    else {
+        setPen(QPen(Qt::black, 1));  // 未选中时恢复为黑色边框
+    }
+}
+
+QColor BondItem::getColorByStatus(ns_mat::DIE_STATUS status) {
+    switch (status) {
+    //case ns_mat::DIE_STATUS::NO_PICK: return QColor(200, 200, 200);
+    //case ns_mat::DIE_STATUS::WAF_PICK_DONE: return QColor(100, 200, 230);
+    //case ns_mat::DIE_STATUS::TRANSFER_BOND_DONE: return QColor(255, 255, 0);
+    case ns_mat::DIE_STATUS::TRANSFER_PICK_DONE: return QColor(255, 165, 0);
+    case ns_mat::DIE_STATUS::LOOKUP_CALIB_DONE: return QColor(0, 150, 255);
+    case ns_mat::DIE_STATUS::BOND_DONE: return QColor(144, 238, 144);
+    case ns_mat::DIE_STATUS::BOND_DEL: return QColor(255, 50, 50);
+    default: return Qt::gray;
+    }
+}
+
 BondGraphicsView::BondGraphicsView(QGraphicsScene* scene, QWidget* parent)
     : QGraphicsView(scene, parent), selecting(false), selectionRect(nullptr),
     scaleFactor(1.0), isDragging(false), thumbnailLabel(nullptr),

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

@@ -7,6 +7,22 @@
 #include "DieItem.h"
 #include <QLabel>
 #include <QPointer>
+#include <CBondMatrix.h>
+
+class BondItem : public QObject, public QGraphicsRectItem {
+public:
+    BondItem(ns_mat::POINT_INFO_STRUCT point, QGraphicsItem* parent = nullptr);
+
+    void setSelected(bool selected);
+    void setLeftSelected(bool selected);
+    ns_mat::POINT_INFO_STRUCT point;
+
+private:
+    bool isSelected = false;
+
+    // 获取单元格状态颜色
+    QColor getColorByStatus(ns_mat::DIE_STATUS status);
+};
 
 class BondGraphicsView : public QGraphicsView {
     Q_OBJECT