This commit is contained in:
backuppc
2026-02-13 10:41:10 +09:00
parent d6aed58516
commit 213467fe3f
9 changed files with 645 additions and 104 deletions

View File

@@ -2588,7 +2588,21 @@ namespace AGVSimulator.Forms
this._simulatorCanvas.HighlightNodeId = (result.Gateway?.Id ?? string.Empty);
return result;
}
/// <summary>
/// 길목(Gateway) 기반 경로 계산
/// 버퍼-버퍼 상태에서는 별도의 추가 로직을 적용합니다
/// </summary>
public AGVPathResult CalcPath_New(MapNode startNode, MapNode targetNode, List<MapNode> nodes,
MapNode prevNode, AgvDirection prevDir)
{
// Core Logic으로 이관됨
var pathFinder = new AGVPathfinder(nodes);
var result = pathFinder.CalculateScriptedPath(startNode, targetNode, prevNode, prevDir);
//게이트웨이노드를 하이라이트강조 한단
this._simulatorCanvas.HighlightNodeId = (result.Gateway?.Id ?? string.Empty);
return result;
}
private void ApplyResultToSimulator(AGVPathResult result, VirtualAGV agv)
{
_simulatorCanvas.CurrentPath = result;
@@ -2622,5 +2636,33 @@ namespace AGVSimulator.Forms
}
}
}
private void button1_Click(object sender, EventArgs e)
{
// 1. 기본 정보 획득
if (_startNodeCombo.SelectedItem == null || _startNodeCombo.Text == "선택하세요") SetStartNodeFromAGVPosition();
if (_startNodeCombo.SelectedItem == null || _targetNodeCombo.SelectedItem == null)
{
MessageBox.Show("시작/목표 노드를 확인하세요");
return;
}
//var selectedAGV = _agvListCombo.SelectedItem as VirtualAGV;
//if (selectedAGV == null) return AGVPathResult.CreateFailure("Virtual AGV 없음");
var selectedAGV = _agvListCombo.SelectedItem as VirtualAGV;
// 경로계산2 (Gateway Logic)
var startNode = (_startNodeCombo.SelectedItem as ComboBoxItem<MapNode>)?.Value;
var targetNode = (_targetNodeCombo.SelectedItem as ComboBoxItem<MapNode>)?.Value;
var rlt = CalcPath_New(startNode, targetNode, this._simulatorCanvas.Nodes, selectedAGV.PrevNode, selectedAGV.PrevDirection);
if (rlt.Success == false) MessageBox.Show(rlt.Message, "알림", MessageBoxButtons.OK, MessageBoxIcon.Information);
else
{
// 8. 적용
ApplyResultToSimulator(rlt, selectedAGV);
UpdateAdvancedPathDebugInfo(rlt);
}
}
}
}