최종우치에. 이전노드정보와 다음 시작 노드 정보를 모두 추가함.

최초 실행시 선택하는 위치 다이얼로그 제거 후 바로 자동 로딩하도록 함
This commit is contained in:
backuppc
2026-02-03 17:15:15 +09:00
parent b25be68986
commit e35dee853f
6 changed files with 164 additions and 70 deletions

View File

@@ -310,24 +310,70 @@ namespace Project
}
PUB.log.Add($"맵 파일 로드 완료: {filePath.Name}, 노드 수: {result.Nodes.Count}");
// 🔥 초기 위치 설정 및 확인 화면 표시
this.BeginInvoke(new Action(() =>
//마지막위치복원
// 마지막 위치 로드
var lastPos = PUB.LoadLastPosition();
if (lastPos != null)
{
using (var f = new Dialog.fSetCurrentPosition())
var sb = new System.Text.StringBuilder();
var curNode = PUB.FindByNodeID(lastPos.NodeId);
var prevNode = PUB.FindByNodeID(lastPos.PrevNode);
var targNode = PUB.FindByNodeID(lastPos.TargetNode);
var staNode = PUB.FindByNodeID(lastPos.StartNode);
if(prevNode != null)
{
if (f.ShowDialog() == DialogResult.OK)
{
if (f.SelectedNode != null)
{
PUB._virtualAGV.Turn = f.SelectedTurn;
PUB._virtualAGV.SetPosition(f.SelectedNode, f.SelectedDirection);
PUB._mapCanvas.SetAGVPosition(PUB.setting.MCID, f.SelectedNode, f.SelectedDirection);
PUB.SaveLastPosition();
PUB.log.Add($"[초기위치] 설정 완료: {f.SelectedNode.Id}, {f.SelectedDirection}, Turn:{f.SelectedTurn}");
}
}
PUB._virtualAGV.SetPosition(prevNode, lastPos.PrevDirection);
PUB._mapCanvas.SetAGVPosition(PUB.setting.MCID, prevNode, lastPos.PrevDirection);
sb.AppendLine($"이전: {prevNode.ID2}, {lastPos.PrevDirection}");
}
}));
if (curNode != null)
{
PUB._virtualAGV.SetPosition(curNode, lastPos.Direction);
PUB._mapCanvas.SetAGVPosition(PUB.setting.MCID, curNode, lastPos.Direction);
sb.AppendLine($"현재: {curNode.ID2}, {lastPos.Direction}");
}
if (staNode != null)
{
PUB._virtualAGV.StartNode = staNode;
sb.AppendLine($"시직:{staNode.ID2}");
}
if (targNode != null)
{
PUB._virtualAGV.TargetNode = targNode;
sb.AppendLine($"대상:{targNode.ID2}");
}
PUB._virtualAGV.Turn = lastPos.Turn;
sb.AppendLine($"S/W회전:{lastPos.Turn}");
if(lastPos.AGV_Turn != null)
{
PUB.AGV.TurnInformation = lastPos.AGV_Turn;
sb.AppendLine($"H/W회전:{lastPos.AGV_Turn}");
}
PUB.log.Add($"위치복원\n{sb}");
}
//// 🔥 초기 위치 설정 및 확인 화면 표시
//this.BeginInvoke(new Action(() =>
//{
// using (var f = new Dialog.fSetCurrentPosition())
// {
// if (f.ShowDialog() == DialogResult.OK)
// {
// if (f.SelectedNode != null)
// {
// PUB._virtualAGV.Turn = f.SelectedTurn;
// PUB._virtualAGV.SetPosition(f.SelectedNode, f.SelectedDirection);
// PUB._mapCanvas.SetAGVPosition(PUB.setting.MCID, f.SelectedNode, f.SelectedDirection);
// PUB.SaveLastPosition();
// PUB.log.Add($"[초기위치] 설정 완료: {f.SelectedNode.Id}, {f.SelectedDirection}, Turn:{f.SelectedTurn}");
// }
// }
// }
//}));
}
else
{