Commit f8494ff8 LN

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

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