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

@@ -86,6 +86,7 @@ namespace AGVSimulator.Forms
this._statusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this._coordLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.prb1 = new System.Windows.Forms.ToolStripProgressBar();
this.sbFile = new System.Windows.Forms.ToolStripStatusLabel();
this._controlPanel = new System.Windows.Forms.Panel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.propertyNode = new System.Windows.Forms.PropertyGrid();
@@ -121,7 +122,7 @@ namespace AGVSimulator.Forms
this._liftDirectionLabel = new System.Windows.Forms.Label();
this._motorDirectionLabel = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.sbFile = new System.Windows.Forms.ToolStripStatusLabel();
this.button1 = new System.Windows.Forms.Button();
this._menuStrip.SuspendLayout();
this._toolStrip.SuspendLayout();
this._statusStrip.SuspendLayout();
@@ -466,6 +467,12 @@ namespace AGVSimulator.Forms
this.prb1.Name = "prb1";
this.prb1.Size = new System.Drawing.Size(200, 16);
//
// sbFile
//
this.sbFile.Name = "sbFile";
this.sbFile.Size = new System.Drawing.Size(17, 17);
this.sbFile.Text = "--";
//
// _controlPanel
//
this._controlPanel.BackColor = System.Drawing.SystemColors.Control;
@@ -540,6 +547,7 @@ namespace AGVSimulator.Forms
//
// _pathGroup
//
this._pathGroup.Controls.Add(this.button1);
this._pathGroup.Controls.Add(this.btPath2);
this._pathGroup.Controls.Add(this._clearPathButton);
this._pathGroup.Controls.Add(this._targetCalcButton);
@@ -825,11 +833,15 @@ namespace AGVSimulator.Forms
this.timer1.Interval = 500;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// sbFile
// button1
//
this.sbFile.Name = "sbFile";
this.sbFile.Size = new System.Drawing.Size(17, 17);
this.sbFile.Text = "--";
this.button1.Location = new System.Drawing.Point(21, 201);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(106, 25);
this.button1.TabIndex = 11;
this.button1.Text = "경로 계산2";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// SimulatorForm
//
@@ -946,5 +958,6 @@ namespace AGVSimulator.Forms
private System.Windows.Forms.Button btPath2;
private System.Windows.Forms.ToolStripMenuItem btSelectMapEditor;
private System.Windows.Forms.ToolStripStatusLabel sbFile;
private System.Windows.Forms.Button button1;
}
}

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);
}
}
}
}