|
@@ -5,7 +5,7 @@
|
|
#include <QDebug>
|
|
#include <QDebug>
|
|
#include <QPushButton>
|
|
#include <QPushButton>
|
|
#include <QGridLayout>
|
|
#include <QGridLayout>
|
|
-
|
|
|
|
|
|
+#include "ImageWidget.h"
|
|
Wafer::Wafer(int flag, QWidget *parent) : QWidget(parent) {
|
|
Wafer::Wafer(int flag, QWidget *parent) : QWidget(parent) {
|
|
|
|
|
|
}
|
|
}
|
|
@@ -92,7 +92,7 @@ void Wafer::UpdataVal(const std::vector<ns_mat::WAFER_MATRIX_POINT_INFO_STRUCT>&
|
|
if (a.stPosition.x >= maxx) maxx = a.stPosition.x;
|
|
if (a.stPosition.x >= maxx) maxx = a.stPosition.x;
|
|
if (a.stPosition.y >= maxy) maxy = a.stPosition.y;
|
|
if (a.stPosition.y >= maxy) maxy = a.stPosition.y;
|
|
if (a.stPosition.x <= minx) minx = a.stPosition.x;
|
|
if (a.stPosition.x <= minx) minx = a.stPosition.x;
|
|
- if (a.stPosition.x <= miny) miny = a.stPosition.y;
|
|
|
|
|
|
+ if (a.stPosition.y <= miny) miny = a.stPosition.y;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
maxRow_Colmap.insert(currentDieMatrixId, { rowMax ,colsMax,minx,miny,maxx,maxy });
|
|
maxRow_Colmap.insert(currentDieMatrixId, { rowMax ,colsMax,minx,miny,maxx,maxy });
|
|
@@ -114,90 +114,105 @@ QColor Wafer::getColorByStatus(ns_mat::PICK_DIE_STATUS status) {
|
|
void Wafer::paintInitFrom(QWidget *parent) {
|
|
void Wafer::paintInitFrom(QWidget *parent) {
|
|
/*
|
|
/*
|
|
// 获取当前窗口的宽高
|
|
// 获取当前窗口的宽高
|
|
- int width = parent->width();
|
|
|
|
- int height = parent->height();
|
|
|
|
- // 根据行列数计算每个晶圆点的大小,选择小的边来决定
|
|
|
|
- int cellSize = qMin(width, height) / qMax(rows, cols); // 固定大小为正方形,按最小边计算
|
|
|
|
- // 计算左上角偏移量,居中显示
|
|
|
|
- int offsetX = (width - cellSize * cols) / 2;
|
|
|
|
- int offsetY = (height - cellSize * rows) / 2;
|
|
|
|
|
|
+ double width, height;
|
|
|
|
+ width = 493;
|
|
|
|
+ height = 493;
|
|
|
|
|
|
- // 创建一个 QPixmap 对象用于保存绘制的图像
|
|
|
|
- globalPixmap = QPixmap(width, height);
|
|
|
|
- globalPixmap.fill(Qt::white); // 填充背景色为白色
|
|
|
|
|
|
|
|
- // 创建 QPainter 以绘制到 QPixmap 上
|
|
|
|
- QPainter painter(&globalPixmap);
|
|
|
|
- painter.setRenderHint(QPainter::Antialiasing); // 启用抗锯齿
|
|
|
|
|
|
+ ImageWidget* Operatewidget;
|
|
|
|
+ Operatewidget = new ImageWidget();
|
|
|
|
+
|
|
|
|
+ Operatewidget->setGeometry(QRect(0, 0, 493, 493));
|
|
|
|
|
|
- // 设置画笔为无边框
|
|
|
|
- painter.setPen(Qt::NoPen);
|
|
|
|
|
|
|
|
- // 绘制每个晶圆点
|
|
|
|
- for (int i = 0; i < waferData.size(); ++i) {
|
|
|
|
- int x = offsetX + waferData[i].nDieCol * cellSize;
|
|
|
|
- int y = offsetY + waferData[i].nDieRow * cellSize;
|
|
|
|
|
|
+ // 创建视图
|
|
|
|
+ scene = new QGraphicsScene(Operatewidget);
|
|
|
|
+ view = new WaferGraphicsView(scene);
|
|
|
|
+ //cene->setSceneRect(0, 0, 493, 493);
|
|
|
|
+ view->resize(width, height);
|
|
|
|
+ view->setCViewInterface(m_pCViewInterface);
|
|
|
|
+ //获取当前角度
|
|
|
|
+ double angle;
|
|
|
|
+ m_pCViewInterface->GetViewMatrix()->GetWaferTableAngle(angle);
|
|
|
|
+ QPointF center(width / 2.0, height / 2.0);
|
|
|
|
+ QPointF pointf(m_centerX, m_centerY);
|
|
|
|
+ double radius = width / 2 - 10;
|
|
|
|
+ //比例
|
|
|
|
+ double radio = m_radius / radius;
|
|
|
|
+ int dieLong = m_dieLong / radio;
|
|
|
|
+ int dieWide = m_dieWide / radio;
|
|
|
|
|
|
- // 根据点的状态设置颜色
|
|
|
|
- painter.setBrush(getColorByStatus(waferData[i].eStatus));
|
|
|
|
|
|
+ //test 实际使用时需要删除或注释
|
|
|
|
+ angle = 0.00;
|
|
|
|
+ // 初始化晶圆参数
|
|
|
|
+ view->initWafer(center, // 中心坐标
|
|
|
|
+ radius, // 半径
|
|
|
|
+ dieLong, dieWide, angle); // 固晶点显示尺寸
|
|
|
|
|
|
- // 绘制晶圆点(每个点是一个矩形)
|
|
|
|
- painter.drawRect(x, y, cellSize, cellSize);
|
|
|
|
- }
|
|
|
|
|
|
+// 添加固晶点
|
|
|
|
+ int currentDieMatrixId = -1;
|
|
|
|
+ double referPointX = 0.0;
|
|
|
|
+ double referPointY = 0.0;
|
|
|
|
+ MaxRow_Col maxRow_Col;
|
|
|
|
+ double minx, miny, maxx, maxy, widthMatrix, heightMatrix;
|
|
|
|
+ for (int i = 0; i < waferData.size(); ++i) {
|
|
|
|
+ //判断是否属于同一个矩阵
|
|
|
|
+ if (waferData[i].nDieMatrixId != currentDieMatrixId) {
|
|
|
|
+ //重新画矩阵框然后配置新的参考点
|
|
|
|
+ currentDieMatrixId = waferData[i].nDieMatrixId;
|
|
|
|
+ referPointX = center.x() + (waferData[i].stPosition.x - m_centerX) / radio;
|
|
|
|
+ referPointY = center.y() - (waferData[i].stPosition.y - m_centerY) / radio;
|
|
|
|
+ maxRow_Col = maxRow_Colmap.value(currentDieMatrixId);
|
|
|
|
+ minx = center.x() + (maxRow_Col.minX - m_centerX) / radio - 20;
|
|
|
|
+ miny = center.y() - (maxRow_Col.minY - m_centerY) / radio + 20;
|
|
|
|
+ maxx = center.x() + (maxRow_Col.maxX - m_centerX) / radio + 20;
|
|
|
|
+ maxy = center.y() - (maxRow_Col.maxY - m_centerY) / radio - 20;
|
|
|
|
+ widthMatrix = maxx - minx;
|
|
|
|
+ heightMatrix = miny - maxy;
|
|
|
|
+ view->drawDieMatrix(QPointF(minx, maxy), widthMatrix, heightMatrix, currentDieMatrixId);
|
|
|
|
|
|
- // 根据角度绘制黑点
|
|
|
|
- int centerX, centerY;
|
|
|
|
- int angle = 0;
|
|
|
|
- switch (angle) {
|
|
|
|
- case 0: {
|
|
|
|
- centerX = offsetX + (cols / 2) * cellSize;
|
|
|
|
- centerY = offsetY + (rows - 1) * cellSize;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- case 90: {
|
|
|
|
- centerX = offsetX;
|
|
|
|
- centerY = offsetY + (rows / 2) * cellSize;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- case 180: {
|
|
|
|
- centerX = offsetX + (cols / 2) * cellSize;
|
|
|
|
- centerY = offsetY;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- case 270: {
|
|
|
|
- centerX = offsetX + (cols - 1) * cellSize;
|
|
|
|
- centerY = offsetY + (rows / 2) * cellSize;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- default:
|
|
|
|
- return;
|
|
|
|
|
|
+ }
|
|
|
|
+ referPointX = center.x() + (waferData[i].stPosition.x - m_centerX) / radio;
|
|
|
|
+ referPointY = center.y() - (waferData[i].stPosition.y - m_centerY) / radio;
|
|
|
|
+
|
|
|
|
+ view->addDiePoint(QPointF(referPointX, referPointY), waferData[i]);
|
|
}
|
|
}
|
|
|
|
+ scene->setSceneRect(0, 0, view->width(), view->height());
|
|
|
|
|
|
- painter.setBrush(Qt::black);
|
|
|
|
- painter.drawEllipse(centerX - 3, centerY - 3, 6, 6);
|
|
|
|
- painter.end(); // 结束绘制
|
|
|
|
|
|
+ int cur_width, cur_height;
|
|
|
|
+ cur_width = parent->width();
|
|
|
|
+ cur_height = parent->height();
|
|
|
|
+ // 创建一个 QPixmap 对象用于保存绘制的图像
|
|
|
|
+ globalPixmap = QPixmap(cur_width, cur_height);
|
|
|
|
+ globalPixmap.fill(Qt::white); // 填充背景色为白色
|
|
|
|
+ QPixmap originalPixmap = QPixmap::grabWidget(view);
|
|
|
|
+ // 设置目标尺寸
|
|
|
|
+ QSize targetSize(cur_width, cur_height);
|
|
|
|
+
|
|
|
|
+ // 不保持比例,直接拉伸到指定尺寸
|
|
|
|
+ QPixmap scaledPixmap = originalPixmap.scaled(
|
|
|
|
+ targetSize,
|
|
|
|
+ Qt::IgnoreAspectRatio,
|
|
|
|
+ Qt::SmoothTransformation
|
|
|
|
+ );
|
|
|
|
+ globalPixmap = scaledPixmap;
|
|
*/
|
|
*/
|
|
}
|
|
}
|
|
|
|
|
|
void Wafer::initFrom(QWidget* parent) {
|
|
void Wafer::initFrom(QWidget* parent) {
|
|
- //scene = new QGraphicsScene(parent);
|
|
|
|
- //view = new WaferGraphicsView(scene);
|
|
|
|
-
|
|
|
|
- //// 获取当前窗口的宽高
|
|
|
|
- double width = parent->width();
|
|
|
|
- double height = parent->height();
|
|
|
|
|
|
|
|
- //// 根据行列数计算每个晶圆点的大小,选择小的边来决定
|
|
|
|
- //int cellSize = qMin(width, height) / qMax(rows, cols); // 固定大小为正方形,按最小边计算
|
|
|
|
-
|
|
|
|
- //for (int i = 0; i < waferData.size(); ++i) {
|
|
|
|
- // DieItem* die = new DieItem(waferData[i].nDieRow, waferData[i].nDieCol, waferData[i].eStatus, cellSize);
|
|
|
|
- // die->setPos(waferData[i].nDieCol * cellSize, waferData[i].nDieRow * cellSize);
|
|
|
|
- // scene->addItem(die);
|
|
|
|
- //}
|
|
|
|
|
|
+ // 获取当前窗口的宽高
|
|
|
|
+ double width, height;
|
|
|
|
+ if (parent == nullptr) {
|
|
|
|
+ width = 493;
|
|
|
|
+ height = 493;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ width = parent->width();
|
|
|
|
+ height = parent->height();
|
|
|
|
+ }
|
|
|
|
|
|
- //view->setSceneRect(scene->itemsBoundingRect());
|
|
|
|
- //view->resize(width, height);
|
|
|
|
|
|
+
|
|
|
|
|
|
// 创建视图
|
|
// 创建视图
|
|
scene = new QGraphicsScene(parent);
|
|
scene = new QGraphicsScene(parent);
|
|
@@ -248,12 +263,26 @@ void Wafer::initFrom(QWidget* parent) {
|
|
referPointX = center.x() + (waferData[i].stPosition.x - m_centerX) / radio;
|
|
referPointX = center.x() + (waferData[i].stPosition.x - m_centerX) / radio;
|
|
referPointY = center.y() - (waferData[i].stPosition.y - m_centerY) / radio;
|
|
referPointY = center.y() - (waferData[i].stPosition.y - m_centerY) / radio;
|
|
|
|
|
|
- //test
|
|
|
|
- //referPointX = i * 5;
|
|
|
|
- //referPointY = i * 5;
|
|
|
|
|
|
+
|
|
view->addDiePoint(QPointF(referPointX, referPointY),waferData[i]);
|
|
view->addDiePoint(QPointF(referPointX, referPointY),waferData[i]);
|
|
}
|
|
}
|
|
scene->setSceneRect(0, 0, view->width(), view->height());
|
|
scene->setSceneRect(0, 0, view->width(), view->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;
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -267,7 +296,6 @@ void Wafer::setWaferInfo(ns_module::CViewInterface* CViewInterface) {
|
|
long result = m_pCViewInterface->GetViewMatrix()->GetDieSize(m_dieLong,m_dieWide);
|
|
long result = m_pCViewInterface->GetViewMatrix()->GetDieSize(m_dieLong,m_dieWide);
|
|
|
|
|
|
m_pCViewInterface->GetViewMatrix()->GetWaferSize(m_centerX, m_centerY,m_radius);
|
|
m_pCViewInterface->GetViewMatrix()->GetWaferSize(m_centerX, m_centerY,m_radius);
|
|
-
|
|
|
|
//这里到时候更新接口时替换真实圆心点的数据
|
|
//这里到时候更新接口时替换真实圆心点的数据
|
|
/*m_dieLong = 10;
|
|
/*m_dieLong = 10;
|
|
m_dieWide = 10;*/
|
|
m_dieWide = 10;*/
|