chore: commit all remaining changes

This commit is contained in:
backuppc
2026-02-04 15:26:22 +09:00
parent b388b1917d
commit ec2af6ac1f
17 changed files with 414 additions and 242 deletions

View File

@@ -261,6 +261,57 @@ namespace Project
PUB.AddEEDB("프로그램 시작");
}
void AutoLoadLastPosition()
{
PUB.log.Add("autoload last position");
//마지막위치복원
// 마지막 위치 로드
var lastPos = PUB.LoadLastPosition();
if (lastPos != null)
{
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)
{
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}");
}
else PUB.log.AddE($"마지막위치가 없습니다");
}
void AutoLoadMapData()
{
//auto load
@@ -279,11 +330,16 @@ namespace Project
if (files.Any()) filePath = files[0];
}
if(PUB._mapCanvas == null)
{
UTIL.MsgE("Canvas null");
}
if (filePath.Exists)
{
var result = MapLoader.LoadMapFromFile(filePath.FullName);
if (result.Success)
if (result != null && result.Success)
{
PUB._mapCanvas.SetMapLoadResult(result);
PUB._mapCanvas.MapFileName = filePath.FullName;
@@ -301,7 +357,7 @@ namespace Project
PUB.log.Add($"가상 AGV 생성: PointZero 위치");
}
else if (PUB._virtualAGV != null)
else
{
PUB._virtualAGV.LowBatteryThreshold = PUB.setting.BatteryLimit_Low;
// 기존 AGV가 있으면 캔버스에 다시 연결
@@ -310,50 +366,6 @@ namespace Project
}
PUB.log.Add($"맵 파일 로드 완료: {filePath.Name}, 노드 수: {result.Nodes.Count}");
//마지막위치복원
// 마지막 위치 로드
var lastPos = PUB.LoadLastPosition();
if (lastPos != null)
{
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)
{
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}");
}
//// 🔥 초기 위치 설정 및 확인 화면 표시
@@ -374,6 +386,8 @@ namespace Project
// }
// }
//}));
PUB._mapCanvas.SetView(287.6f, -147.6f, 1.13f);
}
else
{