|
|
|
|
#include "MappingUI.h"
|
|
|
|
|
|
|
|
|
|
MappingUI::MappingUI(QWidget *parent)
|
|
|
|
|
: QWidget(parent)
|
|
|
|
|
{
|
|
|
|
|
ui.setupUi(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MappingUI::~MappingUI()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MappingUI::SetRecipe(double waferDia,
|
|
|
|
|
double dieWidth,
|
|
|
|
|
double dieHeight,
|
|
|
|
|
double baseDiePosX,
|
|
|
|
|
double baseDiePosY,
|
|
|
|
|
double markPoint1X,
|
|
|
|
|
double markPoint1Y,
|
|
|
|
|
double markPoint2X,
|
|
|
|
|
double markPoint2Y,
|
|
|
|
|
int areaXDirectionNum,
|
|
|
|
|
int areaYDirectionNum)
|
|
|
|
|
{
|
|
|
|
|
m_maferRecipe.m_waferDia = waferDia;
|
|
|
|
|
m_maferRecipe.m_dieWidth = dieWidth;
|
|
|
|
|
m_maferRecipe.m_dieHeight = dieHeight;
|
|
|
|
|
m_maferRecipe.m_baseDiePosX = baseDiePosX;
|
|
|
|
|
m_maferRecipe.m_baseDiePosY = baseDiePosY;
|
|
|
|
|
m_maferRecipe.m_markPoint1X = markPoint1X;
|
|
|
|
|
m_maferRecipe.m_markPoint1Y = markPoint1Y;
|
|
|
|
|
m_maferRecipe.m_markPoint2X = markPoint2X;
|
|
|
|
|
m_maferRecipe.m_markPoint2Y = markPoint2Y;
|
|
|
|
|
m_maferRecipe.areaXDirectionNum = areaXDirectionNum;
|
|
|
|
|
m_maferRecipe.areaYDirectionNum = areaYDirectionNum;
|
|
|
|
|
DrawMapping();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MappingUI::DrawMapping()
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>X<EFBFBD><58>Y<EFBFBD><59><EFBFBD><EFBFBD>die<69><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CountDieNumInArea();
|
|
|
|
|
|
|
|
|
|
double rectFirstPointX = m_maferRecipe.m_baseDiePosX/* - m_maferRecipe.m_dieWidth / 2.0*/;
|
|
|
|
|
double rectFirstPointY = m_maferRecipe.m_baseDiePosY/* + m_maferRecipe.m_dieHeight / 2.0*/;
|
|
|
|
|
std::shared_ptr<MyQGraphicsRectItem> rectObj = std::make_shared<MyQGraphicsRectItem>(rectFirstPointX,
|
|
|
|
|
rectFirstPointY,
|
|
|
|
|
m_maferRecipe.m_dieWidth,
|
|
|
|
|
m_maferRecipe.m_dieHeight);
|
|
|
|
|
SetDieAttr(rectObj, true, false, rectFirstPointX, rectFirstPointY);
|
|
|
|
|
rectObj->setBrush(BASE_POINT_COLOR);
|
|
|
|
|
|
|
|
|
|
m_allDieItem.push_back(rectObj);
|
|
|
|
|
m_scene.addItem(rectObj.get());
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<QGraphicsEllipseItem> EllipseObj = std::make_shared<QGraphicsEllipseItem>(0,
|
|
|
|
|
0,
|
|
|
|
|
m_maferRecipe.m_waferDia,
|
|
|
|
|
m_maferRecipe.m_waferDia);
|
|
|
|
|
m_ellipseItem.push_back(EllipseObj);
|
|
|
|
|
EllipseObj->setPen(QPen(RECT_COLOR));
|
|
|
|
|
EllipseObj->setPos(-rectObj->pos().x() - m_maferRecipe.m_waferDia / 2,
|
|
|
|
|
-rectObj->pos().y() - m_maferRecipe.m_waferDia / 2);
|
|
|
|
|
m_scene.addItem(EllipseObj.get());
|
|
|
|
|
|
|
|
|
|
//<2F><>die<69><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
for (int i = 0; i < MAX_EXTEND_NUM; i++)
|
|
|
|
|
{
|
|
|
|
|
double xCoord = rectFirstPointX;
|
|
|
|
|
double yCoord = rectFirstPointY + i * m_maferRecipe.m_dieHeight;
|
|
|
|
|
if (yCoord < -1 * m_maferRecipe.m_waferDia / 2)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
LeftExtend(xCoord, yCoord);
|
|
|
|
|
bool isIncludeBaseDie = false;
|
|
|
|
|
i == 0 ? isIncludeBaseDie = true : isIncludeBaseDie = false;
|
|
|
|
|
RightExtend(xCoord, yCoord, isIncludeBaseDie);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>die<69><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
for (int i = 1; i < MAX_EXTEND_NUM; i++)
|
|
|
|
|
{
|
|
|
|
|
double xCoord = rectFirstPointX;
|
|
|
|
|
double yCoord = rectFirstPointY - i * m_maferRecipe.m_dieHeight;
|
|
|
|
|
if (yCoord > m_maferRecipe.m_waferDia / 2)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
LeftExtend(xCoord, yCoord);
|
|
|
|
|
RightExtend(xCoord, yCoord, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m_allDieItem.size() > 0)
|
|
|
|
|
{
|
|
|
|
|
m_areaStartX = m_allDieItem[0]->xCoord();
|
|
|
|
|
m_areaStartY = m_allDieItem[0]->yCoord();
|
|
|
|
|
}
|
|
|
|
|
for (auto& iter : m_allDieItem)
|
|
|
|
|
{
|
|
|
|
|
if (iter->xCoord() < m_areaStartX)
|
|
|
|
|
{
|
|
|
|
|
m_areaStartX = iter->xCoord();
|
|
|
|
|
}
|
|
|
|
|
if (iter->yCoord() > m_areaStartY)
|
|
|
|
|
{
|
|
|
|
|
m_areaStartY = iter->yCoord();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
double resAreaStartX = m_areaStartX;
|
|
|
|
|
double resAreaStartY = m_areaStartY * (-1);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
|
{
|
|
|
|
|
std::shared_ptr<QGraphicsLineItem> LineObj = std::make_shared<QGraphicsLineItem>(resAreaStartX,
|
|
|
|
|
resAreaStartY + m_maferRecipe.m_dieHeight * m_readAreaYNum * i,
|
|
|
|
|
resAreaStartX + m_maferRecipe.m_waferDia,
|
|
|
|
|
resAreaStartY + m_maferRecipe.m_dieHeight * m_readAreaYNum * i);
|
|
|
|
|
LineObj->setPen(QPen(AREA_LINE_COLOR));
|
|
|
|
|
m_allLineItem.push_back(LineObj);
|
|
|
|
|
m_scene.addItem(LineObj.get());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
|
{
|
|
|
|
|
std::shared_ptr<QGraphicsLineItem> LineObj = std::make_shared<QGraphicsLineItem>(
|
|
|
|
|
resAreaStartX + m_maferRecipe.m_dieWidth * m_realAreaXNum * i,
|
|
|
|
|
resAreaStartY,
|
|
|
|
|
resAreaStartX + m_maferRecipe.m_dieWidth * m_realAreaXNum * i,
|
|
|
|
|
resAreaStartY + m_maferRecipe.m_waferDia);
|
|
|
|
|
LineObj->setPen(QPen(AREA_LINE_COLOR));
|
|
|
|
|
m_allLineItem.push_back(LineObj);
|
|
|
|
|
m_scene.addItem(LineObj.get());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ui.graphicsView->setScene(&m_scene);
|
|
|
|
|
ui.graphicsView->scale(m_scaleFactor, m_scaleFactor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MappingUI::SetWaferRecipe(MaferRecipe& maferRecipe)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MappingUI::LeftExtend(double firstX, double firstY)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 1; i < MAX_EXTEND_NUM; i++)
|
|
|
|
|
{
|
|
|
|
|
double rectFirstX = firstX - m_maferRecipe.m_dieWidth * i;
|
|
|
|
|
double rectFirstY = firstY;
|
|
|
|
|
|
|
|
|
|
if (JudgeIsInWafer(rectFirstX, rectFirstY))
|
|
|
|
|
{
|
|
|
|
|
AddDieRect(rectFirstX, rectFirstY);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (rectFirstX < -1 * m_maferRecipe.m_waferDia / 2)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MappingUI::RightExtend(double firstX, double firstY, bool isIncludeCur)
|
|
|
|
|
{
|
|
|
|
|
int startPos = 0;
|
|
|
|
|
isIncludeCur ? startPos = 1 : startPos = 0;
|
|
|
|
|
for (int i = startPos; i < MAX_EXTEND_NUM; i++)
|
|
|
|
|
{
|
|
|
|
|
double rectFirstX = firstX + m_maferRecipe.m_dieWidth * i;
|
|
|
|
|
double rectFirstY = firstY;
|
|
|
|
|
|
|
|
|
|
if (JudgeIsInWafer(rectFirstX, rectFirstY))
|
|
|
|
|
{
|
|
|
|
|
AddDieRect(rectFirstX, rectFirstY);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (rectFirstX > m_maferRecipe.m_waferDia / 2)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MappingUI::AddDieRect(double xCoord, double yCoord)
|
|
|
|
|
{
|
|
|
|
|
std::shared_ptr<MyQGraphicsRectItem> rectObj = std::make_shared<MyQGraphicsRectItem>(
|
|
|
|
|
xCoord,
|
|
|
|
|
yCoord,
|
|
|
|
|
m_maferRecipe.m_dieWidth,
|
|
|
|
|
m_maferRecipe.m_dieHeight);
|
|
|
|
|
|
|
|
|
|
rectObj->setPen(QPen(RECT_COLOR));
|
|
|
|
|
if (JudgeIsMark(xCoord, yCoord))
|
|
|
|
|
{
|
|
|
|
|
SetDieAttr(rectObj, false, true, xCoord, yCoord);
|
|
|
|
|
rectObj->setBrush(MARK_POINT_COLOR);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SetDieAttr(rectObj, false, false, xCoord, yCoord);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_allDieItem.push_back(rectObj);
|
|
|
|
|
m_scene.addItem(rectObj.get());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MappingUI::SetDieAttr(std::shared_ptr<MyQGraphicsRectItem>& dieObj, bool isBase, bool isMark, double xCoord, double yCoord)
|
|
|
|
|
{
|
|
|
|
|
connect(dieObj.get(), SIGNAL(signal_select(double,double)), this, SLOT(slot_UpdateAllDieStatus(double, double)));
|
|
|
|
|
dieObj->Base(isBase);
|
|
|
|
|
dieObj->Mark(isMark);
|
|
|
|
|
dieObj->xCoord(xCoord);
|
|
|
|
|
dieObj->yCoord(yCoord * -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MappingUI::JudgeIsInWafer(double xCoord, double yCoord)
|
|
|
|
|
{
|
|
|
|
|
if (abs(xCoord) > (m_maferRecipe.m_waferDia / 2.0) || abs(yCoord) > m_maferRecipe.m_waferDia / 2.0)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
int judgeIsOk = 0;
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD>
|
|
|
|
|
if (sqrt(std::pow(m_maferRecipe.m_waferDia / 2, 2) - std::pow(yCoord, 2)) > abs(xCoord) &&
|
|
|
|
|
sqrt(std::pow(m_maferRecipe.m_waferDia / 2, 2) - std::pow(xCoord, 2)) > abs(yCoord))
|
|
|
|
|
{
|
|
|
|
|
judgeIsOk++;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>²<EFBFBD><C2B2><EFBFBD>
|
|
|
|
|
if (sqrt(std::pow(m_maferRecipe.m_waferDia / 2, 2) - std::pow(yCoord + m_maferRecipe.m_dieHeight, 2)) > abs(xCoord) &&
|
|
|
|
|
sqrt(std::pow(m_maferRecipe.m_waferDia / 2, 2) - std::pow(xCoord, 2)) > abs(yCoord + m_maferRecipe.m_dieHeight))
|
|
|
|
|
{
|
|
|
|
|
judgeIsOk++;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD>
|
|
|
|
|
if (sqrt(std::pow(m_maferRecipe.m_waferDia / 2, 2) - std::pow(yCoord, 2)) > abs(xCoord + m_maferRecipe.m_dieWidth) &&
|
|
|
|
|
sqrt(std::pow(m_maferRecipe.m_waferDia / 2, 2) - std::pow(xCoord + m_maferRecipe.m_dieWidth, 2)) > abs(yCoord))
|
|
|
|
|
{
|
|
|
|
|
judgeIsOk++;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>²<EFBFBD><C2B2><EFBFBD>
|
|
|
|
|
if (sqrt(std::pow(m_maferRecipe.m_waferDia / 2, 2) - std::pow(yCoord + +m_maferRecipe.m_dieHeight, 2)) > abs(xCoord + m_maferRecipe.m_dieWidth) &&
|
|
|
|
|
sqrt(std::pow(m_maferRecipe.m_waferDia / 2, 2) - std::pow(xCoord + m_maferRecipe.m_dieWidth, 2)) > abs(yCoord + m_maferRecipe.m_dieHeight))
|
|
|
|
|
{
|
|
|
|
|
judgeIsOk++;
|
|
|
|
|
}
|
|
|
|
|
if (4 == judgeIsOk)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MappingUI::JudgeIsMark(double xCoord, double yCoord)
|
|
|
|
|
{
|
|
|
|
|
//<2F>ж<EFBFBD>mark1<6B><31>
|
|
|
|
|
if (xCoord - JUDGE_DECIMAL <= m_maferRecipe.m_markPoint1X &&
|
|
|
|
|
xCoord + JUDGE_DECIMAL >= m_maferRecipe.m_markPoint1X &&
|
|
|
|
|
yCoord - JUDGE_DECIMAL <= m_maferRecipe.m_markPoint1Y &&
|
|
|
|
|
yCoord + JUDGE_DECIMAL >= m_maferRecipe.m_markPoint1Y)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//<2F>ж<EFBFBD>mark2<6B><32>
|
|
|
|
|
|
|
|
|
|
if (xCoord - JUDGE_DECIMAL <= m_maferRecipe.m_markPoint2X &&
|
|
|
|
|
xCoord + JUDGE_DECIMAL >= m_maferRecipe.m_markPoint2X &&
|
|
|
|
|
yCoord - JUDGE_DECIMAL <= m_maferRecipe.m_markPoint2Y &&
|
|
|
|
|
yCoord + JUDGE_DECIMAL >= m_maferRecipe.m_markPoint2Y)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MappingUI::CountDieNumInArea()
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ж<EFBFBD><D0B6>ٸ<EFBFBD>die
|
|
|
|
|
if (m_maferRecipe.m_dieHeight < JUDGE_DECIMAL || m_maferRecipe.m_dieWidth < JUDGE_DECIMAL ||
|
|
|
|
|
m_maferRecipe.areaXDirectionNum <= 0 || m_maferRecipe.areaYDirectionNum <= 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
double XDirectionNum = m_maferRecipe.m_waferDia / m_maferRecipe.m_dieWidth;
|
|
|
|
|
double YDirectionNum = m_maferRecipe.m_waferDia / m_maferRecipe.m_dieHeight;
|
|
|
|
|
|
|
|
|
|
double areaDieNumX = XDirectionNum / m_maferRecipe.areaXDirectionNum;
|
|
|
|
|
double areaDieNumY = YDirectionNum / m_maferRecipe.areaYDirectionNum;
|
|
|
|
|
|
|
|
|
|
m_realAreaXNum = floor(areaDieNumX + 1.0);
|
|
|
|
|
m_readAreaYNum = floor(areaDieNumY + 1.0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MappingUI::wheelEvent(QWheelEvent *event)
|
|
|
|
|
{
|
|
|
|
|
ui.graphicsView->resetMatrix();
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϷŴ<CFB7><C5B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
qDebug() << event->angleDelta().y();
|
|
|
|
|
if (event->angleDelta().y() > 0) {
|
|
|
|
|
if (m_scaleFactor < 10)
|
|
|
|
|
{
|
|
|
|
|
m_scaleFactor *= 1.05; // <20>Ŵ<EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (m_scaleFactor > 2)
|
|
|
|
|
{
|
|
|
|
|
m_scaleFactor /= 1.05; // <20><>С
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
qDebug() << event->angleDelta().y()<< " "<< m_scaleFactor;
|
|
|
|
|
ui.graphicsView->scale(m_scaleFactor, m_scaleFactor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MappingUI::mousePressEvent(QMouseEvent *event)
|
|
|
|
|
{
|
|
|
|
|
/*if (event->button() == Qt::LeftButton)
|
|
|
|
|
{
|
|
|
|
|
for (auto& iter : m_allItem)
|
|
|
|
|
{
|
|
|
|
|
if (iter->Base() != true && iter->Mark() != true)
|
|
|
|
|
{
|
|
|
|
|
iter->setBrush(Qt::NoBrush);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MappingUI::slot_UpdateAllDieStatus(double xCoord, double yCoord)
|
|
|
|
|
{
|
|
|
|
|
for (auto& iter : m_allDieItem)
|
|
|
|
|
{
|
|
|
|
|
if (iter->Base() != true && iter->Mark() != true)
|
|
|
|
|
{
|
|
|
|
|
if (!(xCoord - JUDGE_DECIMAL <= iter->xCoord() &&
|
|
|
|
|
xCoord + JUDGE_DECIMAL >= iter->xCoord() &&
|
|
|
|
|
yCoord - JUDGE_DECIMAL <= iter->yCoord() &&
|
|
|
|
|
yCoord + JUDGE_DECIMAL >= iter->yCoord()))
|
|
|
|
|
{
|
|
|
|
|
iter->Select(false);
|
|
|
|
|
iter->setBrush(Qt::NoBrush);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
QString str = QString::number(xCoord) + "," + QString::number(yCoord);
|
|
|
|
|
ui.label->setText(str);
|
|
|
|
|
}
|