Commit f8494ff8 LN

新增点位坐标错误问题修改。

1 个父辈 563ad074
...@@ -410,15 +410,15 @@ namespace TSA_V.DeviceLibrary ...@@ -410,15 +410,15 @@ namespace TSA_V.DeviceLibrary
this.PolarityAngle= p.PolarityAngle; this.PolarityAngle= p.PolarityAngle;
} }
public ProjectorPInfo GetShowPInfo(float imageXiShu=1) public ProjectorPInfo GetShowPInfo(float imageXiShu=1,float imageYShu=1)
{ {
ProjectorPInfo p = new ProjectorPInfo(PositionX*imageXiShu, PositionY * imageXiShu, PointType, PolaritiesType,PolarityAngle, (int)(PointSizeX * imageXiShu), (int)(PointSizeY * imageXiShu), (int)(PenWidth * imageXiShu), ShowText); ProjectorPInfo p = new ProjectorPInfo(PositionX*imageXiShu, PositionY * imageYShu, PointType, PolaritiesType,PolarityAngle, (int)(PointSizeX * imageXiShu), (int)(PointSizeY * imageYShu), (int)(PenWidth * imageXiShu), ShowText);
return p; return p;
} }
public ProjectorPInfo GetScreenShowPInfo(float imageXiShu = 1) public ProjectorPInfo GetScreenShowPInfo(float imageXiShu = 1, float imageYShu=1)
{ {
ProjectorPInfo p = new ProjectorPInfo(NodePositionX * imageXiShu, NodePositionY * imageXiShu, PointType, PolaritiesType, PolarityAngle, (int)(PointSizeX * imageXiShu), (int)(PointSizeY * imageXiShu), (int)(PenWidth * imageXiShu), ShowText); ProjectorPInfo p = new ProjectorPInfo(NodePositionX * imageXiShu, NodePositionY * imageYShu, PointType, PolaritiesType, PolarityAngle, (int)(PointSizeX * imageXiShu), (int)(PointSizeY * imageYShu), (int)(PenWidth * imageXiShu), ShowText);
return p; return p;
} }
......
...@@ -24,19 +24,22 @@ namespace TSA_V.LoadCSVLibrary ...@@ -24,19 +24,22 @@ namespace TSA_V.LoadCSVLibrary
{ {
if (allComMap.ContainsKey(bomName)) if (allComMap.ContainsKey(bomName))
{ {
return new List<ComponetInfo>(allComMap[bomName] ); return new List<ComponetInfo>(allComMap[bomName]);
} }
else else
{ {
string fileName = getFilePath(bomName); string fileName = getFilePath(bomName);
if (File.Exists(fileName)) if (File.Exists(fileName))
{ {
List<ComponetInfo> list = ReadFile(fileName); List<ComponetInfo> list = ReadFile(fileName);
allComMap.Add(bomName, list); allComMap.Add(bomName, list);
return list; return list;
} }
} }
return null;
LogUtil.error("bomName=" + bomName + " 未找到元器件列表");
return new List<ComponetInfo>();
} }
public static bool BomNameIsExists(string bomName) public static bool BomNameIsExists(string bomName)
......
...@@ -484,7 +484,7 @@ namespace TSA_V ...@@ -484,7 +484,7 @@ namespace TSA_V
} }
private void MoveTest(int rowIndex) private void MoveTest(int rowIndex,bool showMsg=true)
{ {
//移动测试 //移动测试
//double x = Double.Parse(dgvList.Rows[rowIndex].Cells[this.Column_NodeX.Name].Value.ToString()); //double x = Double.Parse(dgvList.Rows[rowIndex].Cells[this.Column_NodeX.Name].Value.ToString());
...@@ -501,8 +501,12 @@ namespace TSA_V ...@@ -501,8 +501,12 @@ namespace TSA_V
//判断位置是否超出范围 //判断位置是否超出范围
if (!TSAVBean.IsValidPosition(point.NodePositionX, point.NodePositionY)) if (!TSAVBean.IsValidPosition(point.NodePositionX, point.NodePositionY))
{ {
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.PositionError, "位置:{0},{1}无效,请检查配置是否正确?", point.NodePositionX, point.NodePositionY), if (showMsg)
ResourceCulture.GetString(ResourceCulture.MsgTitle, "提示?"), MessageBoxButtons.OK); {
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.PositionError, "位置:{0},{1}无效,请检查配置是否正确?", point.NodePositionX, point.NodePositionY),
ResourceCulture.GetString(ResourceCulture.MsgTitle, "提示?"), MessageBoxButtons.OK);
}
} }
else else
{ {
...@@ -805,6 +809,7 @@ namespace TSA_V ...@@ -805,6 +809,7 @@ namespace TSA_V
loadPictureBoxSize(pointList); loadPictureBoxSize(pointList);
} }
private float imageXiShu = 1; private float imageXiShu = 1;
private float imageYShu = 1;
private int selectIndex = 0; private int selectIndex = 0;
private void loadPictureBoxSize(List<SMTPointInfo> pointList = null) private void loadPictureBoxSize(List<SMTPointInfo> pointList = null)
{ {
...@@ -879,7 +884,7 @@ namespace TSA_V ...@@ -879,7 +884,7 @@ namespace TSA_V
DataGridViewRow row = dgvList.Rows[rowIndex]; DataGridViewRow row = dgvList.Rows[rowIndex];
SMTPointInfo smtInfo = getRowPointInfo(row); SMTPointInfo smtInfo = getRowPointInfo(row);
panBoard.AutoScrollPosition = new Point((int)(smtInfo.PositionX * display.imageXiShu - panBoard.Width / 2), (int)(smtInfo.PositionY * display.imageXiShu - panBoard.Height / 2)); panBoard.AutoScrollPosition = new Point((int)(smtInfo.PositionX * display.imageXiShu - panBoard.Width / 2), (int)(smtInfo.PositionY * display.imageYShu - panBoard.Height / 2));
// panBoard.AutoScrollPosition = new Point((int)picBoard.Width, (int)picBoard.Height); // panBoard.AutoScrollPosition = new Point((int)picBoard.Width, (int)picBoard.Height);
if (isFinishLoad && this.txtBoardW.Text.Trim() != "" && this.txtBoardL.Text.Trim() != "") if (isFinishLoad && this.txtBoardW.Text.Trim() != "" && this.txtBoardL.Text.Trim() != "")
{ {
...@@ -1211,7 +1216,7 @@ namespace TSA_V ...@@ -1211,7 +1216,7 @@ namespace TSA_V
return; return;
} }
double x = m_MouseDownPointX / imageXiShu; double x = m_MouseDownPointX / imageXiShu;
double y = m_MouseDownPointY / imageXiShu; double y = m_MouseDownPointY / imageYShu;
x = Math.Round(x, 0, MidpointRounding.AwayFromZero); x = Math.Round(x, 0, MidpointRounding.AwayFromZero);
y = Math.Round(y, 0, MidpointRounding.AwayFromZero); y = Math.Round(y, 0, MidpointRounding.AwayFromZero);
...@@ -1247,6 +1252,7 @@ namespace TSA_V ...@@ -1247,6 +1252,7 @@ namespace TSA_V
记录为组装坐标ToolStripMenuItem.Text = ResourceCulture.GetString(ResourceCulture.ItemTextUpdateP, "更新为【{0}-{1}】的位置", partNum, name); 记录为组装坐标ToolStripMenuItem.Text = ResourceCulture.GetString(ResourceCulture.ItemTextUpdateP, "更新为【{0}-{1}】的位置", partNum, name);
UpdateSelPoint(rowIndex); UpdateSelPoint(rowIndex);
MoveTest(rowIndex ,false);
} }
} }
} }
...@@ -1260,7 +1266,7 @@ namespace TSA_V ...@@ -1260,7 +1266,7 @@ namespace TSA_V
return; return;
} }
double x = m_MouseDownPointX / imageXiShu; double x = m_MouseDownPointX / imageXiShu;
double y = m_MouseDownPointY / imageXiShu; double y = m_MouseDownPointY / imageYShu;
x = Math.Round(x, 0, MidpointRounding.AwayFromZero); x = Math.Round(x, 0, MidpointRounding.AwayFromZero);
y = Math.Round(y, 0, MidpointRounding.AwayFromZero); y = Math.Round(y, 0, MidpointRounding.AwayFromZero);
...@@ -1457,7 +1463,7 @@ namespace TSA_V ...@@ -1457,7 +1463,7 @@ namespace TSA_V
return; return;
} }
double x = m_MouseDownPointX / imageXiShu; double x = m_MouseDownPointX / imageXiShu;
double y = m_MouseDownPointY / imageXiShu; double y = m_MouseDownPointY / imageYShu;
x = Math.Round(x, 0, MidpointRounding.AwayFromZero); x = Math.Round(x, 0, MidpointRounding.AwayFromZero);
y = Math.Round(y, 0, MidpointRounding.AwayFromZero); y = Math.Round(y, 0, MidpointRounding.AwayFromZero);
//double NodeX = TSAVBean.Axis_X.LastVoltage; //double NodeX = TSAVBean.Axis_X.LastVoltage;
...@@ -1466,6 +1472,12 @@ namespace TSA_V ...@@ -1466,6 +1472,12 @@ namespace TSA_V
double NodeY = FrmProjectorScreen.instance.LastY; double NodeY = FrmProjectorScreen.instance.LastY;
LogUtil.info("新增组装信息:X【" + m_MouseDownPointX + "】Y【" + m_MouseDownPointY + "】,坐标X【" + x + "】坐标Y【" + y + "】"); LogUtil.info("新增组装信息:X【" + m_MouseDownPointX + "】Y【" + m_MouseDownPointY + "】,坐标X【" + x + "】坐标Y【" + y + "】");
AddNewPoint(x, y, NodeX, NodeY); AddNewPoint(x, y, NodeX, NodeY);
if (dgvList.SelectedRows.Count > 0)
{
dgvList.SelectedRows[0].Selected = false;
}
dgvList.Rows[dgvList.Rows.Count - 1].Selected = true;
} }
private void 全部启用ToolStripMenuItem_Click(object sender, EventArgs e) private void 全部启用ToolStripMenuItem_Click(object sender, EventArgs e)
...@@ -1798,7 +1810,7 @@ namespace TSA_V ...@@ -1798,7 +1810,7 @@ namespace TSA_V
chbNormal.Checked = false; chbNormal.Checked = false;
} }
panBoard.AutoScrollPosition = new Point((int)(smtInfo.PositionX * display.imageXiShu - panBoard.Width / 2), (int)(smtInfo.PositionY * display.imageXiShu - panBoard.Height / 2)); panBoard.AutoScrollPosition = new Point((int)(smtInfo.PositionX * display.imageXiShu - panBoard.Width / 2), (int)(smtInfo.PositionY * display.imageYShu - panBoard.Height / 2));
// panBoard.AutoScrollPosition = new Point((int)picBoard.Width, (int)picBoard.Height); // panBoard.AutoScrollPosition = new Point((int)picBoard.Width, (int)picBoard.Height);
if (isFinishLoad && this.txtBoardW.Text.Trim() != "" && this.txtBoardL.Text.Trim() != "") if (isFinishLoad && this.txtBoardW.Text.Trim() != "" && this.txtBoardL.Text.Trim() != "")
{ {
...@@ -1817,6 +1829,7 @@ namespace TSA_V ...@@ -1817,6 +1829,7 @@ namespace TSA_V
display.ImageNormal = chbNormal.Checked; display.ImageNormal = chbNormal.Checked;
display.DrawEditPoint(width, height, smtInfo, color); display.DrawEditPoint(width, height, smtInfo, color);
imageXiShu = display.imageXiShu; imageXiShu = display.imageXiShu;
imageYShu = display.imageYShu;
} }
} }
catch (Exception ex) catch (Exception ex)
......
...@@ -44,8 +44,18 @@ namespace TSA_V ...@@ -44,8 +44,18 @@ namespace TSA_V
} }
public FrmPointInfo(BoardInfo board, string name, double x, double y, double nodex, double nodey) public FrmPointInfo(BoardInfo board, string name, double x, double y, double nodex, double nodey)
{ {
InitializeComponent(); InitializeComponent();
this.boardInfo = board; this.boardInfo = board;
smtPointInfo = new SMTPointInfo();
//先保存点位
smtPointInfo.PositionX = x;
smtPointInfo.PositionY = y;
smtPointInfo.NodePositionX = nodex;
smtPointInfo.NodePositionY = nodey;
//先计算投影位置
smtPointInfo = XYConvertManager.CalPointNodePosition(smtPointInfo, board.getCalPoint());
isNewPoint = true; isNewPoint = true;
this.Text = "新增组装信息"; this.Text = "新增组装信息";
this.txtTagNo.Text = name; this.txtTagNo.Text = name;
...@@ -57,17 +67,17 @@ namespace TSA_V ...@@ -57,17 +67,17 @@ namespace TSA_V
{ {
projectorControl.ShowPointEvent += projectorControl_ShowPointEvent; projectorControl.ShowPointEvent += projectorControl_ShowPointEvent;
projectorControl.XValue = x; projectorControl.XValue = nodex;
projectorControl.YValue = y; projectorControl.YValue = nodey;
projectorControl.ShowColor = boardInfo.PointColor; projectorControl.ShowColor = boardInfo.PointColor;
projectorControl.loadTypeList(ResourceCulture.GetPTypes(), ResourceCulture.GetDirTypes(), ResourceCulture.GetXYControlMap()); projectorControl.loadTypeList(ResourceCulture.GetPTypes(), ResourceCulture.GetDirTypes(), ResourceCulture.GetXYControlMap());
projectorControl.MaxX = (int)TSAVBean.X_Max; projectorControl.MaxX = (int)TSAVBean.X_Max;
projectorControl.MaxY = (int)TSAVBean.Y_Max; projectorControl.MaxY = (int)TSAVBean.Y_Max;
actControl.ConType = 1; actControl.ConType = 1;
actControl.loadTypeList(ResourceCulture.GetPTypes(), ResourceCulture.GetDirTypes(), ResourceCulture.GetXYControlMap()); actControl.loadTypeList(ResourceCulture.GetPTypes(), ResourceCulture.GetDirTypes(), ResourceCulture.GetXYControlMap());
actControl.XValue = nodex; actControl.XValue = x;
actControl.YValue = nodey; actControl.YValue = y;
actControl.ShowColor = boardInfo.PointColor; actControl.ShowColor = boardInfo.PointColor;
actControl.ShowPointEvent += ActControl_ShowPointEvent; actControl.ShowPointEvent += ActControl_ShowPointEvent;
if (boardInfo != null) if (boardInfo != null)
...@@ -92,6 +102,7 @@ namespace TSA_V ...@@ -92,6 +102,7 @@ namespace TSA_V
List<string> pnList = new List<string>(); List<string> pnList = new List<string>();
List<ComponetInfo> list = CSVBomManager.GetComList(this.boardInfo.bomName); List<ComponetInfo> list = CSVBomManager.GetComList(this.boardInfo.bomName);
foreach (ComponetInfo obj in list) foreach (ComponetInfo obj in list)
{ {
if (!pnList.Contains(obj.PN)) if (!pnList.Contains(obj.PN))
...@@ -264,7 +275,10 @@ namespace TSA_V ...@@ -264,7 +275,10 @@ namespace TSA_V
if (isNewPoint) if (isNewPoint)
{ {
smtPointInfo = new SMTPointInfo(); if (smtPointInfo == null)
{
smtPointInfo = new SMTPointInfo();
}
smtPointInfo.pointNum = boardInfo.GetNextPNum(); smtPointInfo.pointNum = boardInfo.GetNextPNum();
} }
...@@ -368,6 +382,9 @@ namespace TSA_V ...@@ -368,6 +382,9 @@ namespace TSA_V
{ {
smtPointInfo.PositionNum = com.PositionNum; smtPointInfo.PositionNum = com.PositionNum;
} }
boardInfo.smtList.Add(smtPointInfo); boardInfo.smtList.Add(smtPointInfo);
this.DialogResult = DialogResult.OK; this.DialogResult = DialogResult.OK;
closeForm(); closeForm();
......
...@@ -19,6 +19,7 @@ namespace TSA_V ...@@ -19,6 +19,7 @@ namespace TSA_V
public bool ImageNormal = true; public bool ImageNormal = true;
public bool ShowName = true; public bool ShowName = true;
public float imageXiShu = 1; public float imageXiShu = 1;
public float imageYShu = 1;
public double CurrBeiLu = 1; public double CurrBeiLu = 1;
private Image PicImage = null; private Image PicImage = null;
...@@ -91,6 +92,7 @@ namespace TSA_V ...@@ -91,6 +92,7 @@ namespace TSA_V
//panBoard.Refresh(); //panBoard.Refresh();
imageXiShu = (float)picBoard.Width / (float)width; imageXiShu = (float)picBoard.Width / (float)width;
imageYShu=(float)picBoard.Height / (float)height;
Graphics grfx = picBoard.CreateGraphics(); Graphics grfx = picBoard.CreateGraphics();
//float preX = 0; //float preX = 0;
...@@ -101,7 +103,7 @@ namespace TSA_V ...@@ -101,7 +103,7 @@ namespace TSA_V
//float x = (float)Math.Abs(weld.PositionX) * imageXiShu; //float x = (float)Math.Abs(weld.PositionX) * imageXiShu;
//float y = (float)Math.Abs(weld.PositionY) * imageXiShu; //float y = (float)Math.Abs(weld.PositionY) * imageXiShu;
float x = (float) weld.PositionX * imageXiShu; float x = (float) weld.PositionX * imageXiShu;
float y = (float) weld.PositionY * imageXiShu; float y = (float) weld.PositionY * imageYShu;
int lineLength = 8; int lineLength = 8;
Color color = Color.HotPink; Color color = Color.HotPink;
...@@ -253,7 +255,7 @@ namespace TSA_V ...@@ -253,7 +255,7 @@ namespace TSA_V
int index = 0; int index = 0;
Brush brushes = Brushes.HotPink; Brush brushes = Brushes.HotPink;
ProjectorPInfo p = point.GetShowPInfo(imageXiShu); ProjectorPInfo p = point.GetShowPInfo(imageXiShu,imageYShu);
DrawPointManager.DrawPoint(grfx, p, color); DrawPointManager.DrawPoint(grfx, p, color);
//写字 //写字
if (index.Equals(selectIndex) || ShowName) if (index.Equals(selectIndex) || ShowName)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!