..
This commit is contained in:
95
Cs_HMI/Project/ViewForm/fAgv.Designer.cs
generated
95
Cs_HMI/Project/ViewForm/fAgv.Designer.cs
generated
@@ -48,13 +48,14 @@
|
||||
this.button4 = new System.Windows.Forms.Button();
|
||||
this.button9 = new System.Windows.Forms.Button();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.button16 = new System.Windows.Forms.Button();
|
||||
this.button10 = new System.Windows.Forms.Button();
|
||||
this.button15 = new System.Windows.Forms.Button();
|
||||
this.button14 = new System.Windows.Forms.Button();
|
||||
this.button11 = new System.Windows.Forms.Button();
|
||||
this.button12 = new System.Windows.Forms.Button();
|
||||
this.button13 = new System.Windows.Forms.Button();
|
||||
this.button14 = new System.Windows.Forms.Button();
|
||||
this.button15 = new System.Windows.Forms.Button();
|
||||
this.button10 = new System.Windows.Forms.Button();
|
||||
this.button16 = new System.Windows.Forms.Button();
|
||||
this.lbPortName = new System.Windows.Forms.Label();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
@@ -269,6 +270,7 @@
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Controls.Add(this.lbPortName);
|
||||
this.panel2.Controls.Add(this.button15);
|
||||
this.panel2.Controls.Add(this.button14);
|
||||
this.panel2.Controls.Add(this.button11);
|
||||
@@ -283,27 +285,27 @@
|
||||
this.panel2.Size = new System.Drawing.Size(1050, 58);
|
||||
this.panel2.TabIndex = 8;
|
||||
//
|
||||
// button16
|
||||
// button15
|
||||
//
|
||||
this.button16.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.button16.Location = new System.Drawing.Point(0, 0);
|
||||
this.button16.Name = "button16";
|
||||
this.button16.Size = new System.Drawing.Size(162, 58);
|
||||
this.button16.TabIndex = 0;
|
||||
this.button16.Text = "백턴유지시간";
|
||||
this.button16.UseVisualStyleBackColor = true;
|
||||
this.button16.Click += new System.EventHandler(this.button16_Click);
|
||||
this.button15.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.button15.Location = new System.Drawing.Point(523, 0);
|
||||
this.button15.Name = "button15";
|
||||
this.button15.Size = new System.Drawing.Size(84, 58);
|
||||
this.button15.TabIndex = 14;
|
||||
this.button15.Text = "Mag Off";
|
||||
this.button15.UseVisualStyleBackColor = true;
|
||||
this.button15.Click += new System.EventHandler(this.button15_Click);
|
||||
//
|
||||
// button10
|
||||
// button14
|
||||
//
|
||||
this.button10.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.button10.Location = new System.Drawing.Point(162, 0);
|
||||
this.button10.Name = "button10";
|
||||
this.button10.Size = new System.Drawing.Size(162, 58);
|
||||
this.button10.TabIndex = 1;
|
||||
this.button10.Text = "GateOut Off Time";
|
||||
this.button10.UseVisualStyleBackColor = true;
|
||||
this.button10.Click += new System.EventHandler(this.button10_Click);
|
||||
this.button14.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.button14.Location = new System.Drawing.Point(439, 0);
|
||||
this.button14.Name = "button14";
|
||||
this.button14.Size = new System.Drawing.Size(84, 58);
|
||||
this.button14.TabIndex = 13;
|
||||
this.button14.Text = "Mag On";
|
||||
this.button14.UseVisualStyleBackColor = true;
|
||||
this.button14.Click += new System.EventHandler(this.button14_Click);
|
||||
//
|
||||
// button11
|
||||
//
|
||||
@@ -338,27 +340,39 @@
|
||||
this.button13.UseVisualStyleBackColor = true;
|
||||
this.button13.Click += new System.EventHandler(this.button13_Click);
|
||||
//
|
||||
// button14
|
||||
// button10
|
||||
//
|
||||
this.button14.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.button14.Location = new System.Drawing.Point(439, 0);
|
||||
this.button14.Name = "button14";
|
||||
this.button14.Size = new System.Drawing.Size(84, 58);
|
||||
this.button14.TabIndex = 13;
|
||||
this.button14.Text = "Mag On";
|
||||
this.button14.UseVisualStyleBackColor = true;
|
||||
this.button14.Click += new System.EventHandler(this.button14_Click);
|
||||
this.button10.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.button10.Location = new System.Drawing.Point(162, 0);
|
||||
this.button10.Name = "button10";
|
||||
this.button10.Size = new System.Drawing.Size(162, 58);
|
||||
this.button10.TabIndex = 1;
|
||||
this.button10.Text = "GateOut Off Time";
|
||||
this.button10.UseVisualStyleBackColor = true;
|
||||
this.button10.Click += new System.EventHandler(this.button10_Click);
|
||||
//
|
||||
// button15
|
||||
// button16
|
||||
//
|
||||
this.button15.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.button15.Location = new System.Drawing.Point(523, 0);
|
||||
this.button15.Name = "button15";
|
||||
this.button15.Size = new System.Drawing.Size(84, 58);
|
||||
this.button15.TabIndex = 14;
|
||||
this.button15.Text = "Mag Off";
|
||||
this.button15.UseVisualStyleBackColor = true;
|
||||
this.button15.Click += new System.EventHandler(this.button15_Click);
|
||||
this.button16.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.button16.Location = new System.Drawing.Point(0, 0);
|
||||
this.button16.Name = "button16";
|
||||
this.button16.Size = new System.Drawing.Size(162, 58);
|
||||
this.button16.TabIndex = 0;
|
||||
this.button16.Text = "백턴유지시간";
|
||||
this.button16.UseVisualStyleBackColor = true;
|
||||
this.button16.Click += new System.EventHandler(this.button16_Click);
|
||||
//
|
||||
// lbPortName
|
||||
//
|
||||
this.lbPortName.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lbPortName.Font = new System.Drawing.Font("Tahoma", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
|
||||
this.lbPortName.ForeColor = System.Drawing.Color.White;
|
||||
this.lbPortName.Location = new System.Drawing.Point(607, 0);
|
||||
this.lbPortName.Name = "lbPortName";
|
||||
this.lbPortName.Size = new System.Drawing.Size(203, 58);
|
||||
this.lbPortName.TabIndex = 15;
|
||||
this.lbPortName.Text = "--";
|
||||
this.lbPortName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// fAgv
|
||||
//
|
||||
@@ -409,5 +423,6 @@
|
||||
private System.Windows.Forms.Button button11;
|
||||
private System.Windows.Forms.Button button12;
|
||||
private System.Windows.Forms.Button button13;
|
||||
private System.Windows.Forms.Label lbPortName;
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ namespace Project.ViewForm
|
||||
richTextBox2.Rtf = PUB.AGV.system1.ToRtfString();
|
||||
richTextBox3.Rtf = CombineRtfStrings(PUB.AGV.signal.ToRtfString(), PUB.AGV.data.ToRtfString());
|
||||
richTextBox4.Rtf = PUB.AGV.error.ToRtfString();
|
||||
|
||||
lbPortName.Text = $"AGV:{PUB.setting.Port_AGV}\nBMS:{PUB.setting.Port_BAT}";
|
||||
timer1.Start();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,28 +30,11 @@ namespace Project.ViewForm
|
||||
|
||||
InitializeMapCanvas();
|
||||
|
||||
//PUB.mapctl = new AGVControl.MapControl();
|
||||
//PUB.mapctl.Dock = DockStyle.Fill;
|
||||
//PUB.mapctl.Visible = true;
|
||||
//PUB.mapctl.Font = this.panel1.Font;
|
||||
//PUB.mapctl.BackColor = Color.FromArgb(32, 32, 32);
|
||||
//this.panel1.Controls.Add(PUB.mapctl);
|
||||
}
|
||||
|
||||
private void InitializeMapCanvas()
|
||||
{
|
||||
// RfidMappings 제거 - MapNode에 통합됨
|
||||
|
||||
// 이벤트 연결
|
||||
//PUB._mapCanvas.NodeAdded += OnNodeAdded;
|
||||
// 이벤트 연결
|
||||
//PUB._mapCanvas.NodeAdded += OnNodeAdded;
|
||||
PUB._mapCanvas.NodeSelect += OnNodeSelected;
|
||||
//PUB._mapCanvas.NodeMoved += OnNodeMoved;
|
||||
//PUB._mapCanvas.NodeDeleted += OnNodeDeleted;
|
||||
//PUB._mapCanvas.ConnectionDeleted += OnConnectionDeleted;
|
||||
//PUB._mapCanvas.ImageNodeDoubleClicked += OnImageNodeDoubleClicked;
|
||||
//PUB._mapCanvas.MapChanged += OnMapChanged;
|
||||
PUB._mapCanvas.NodeSelect += OnNodeSelected;;
|
||||
|
||||
// 스플리터 패널에 맵 캔버스 추가
|
||||
panel1.Controls.Add(PUB._mapCanvas);
|
||||
@@ -153,84 +136,7 @@ namespace Project.ViewForm
|
||||
PUB.AGV.DataReceive += AGV_DataReceive;
|
||||
|
||||
|
||||
//auto load
|
||||
var mapPath = new System.IO.DirectoryInfo("route");
|
||||
if (mapPath.Exists == false) mapPath.Create();
|
||||
|
||||
|
||||
//맵파일로딩
|
||||
if (PUB.setting.LastMapFile.isEmpty()) PUB.setting.LastMapFile = System.IO.Path.Combine(mapPath.FullName, "default.json");
|
||||
System.IO.FileInfo filePath = new System.IO.FileInfo(PUB.setting.LastMapFile);
|
||||
if (filePath.Exists == false) filePath = new System.IO.FileInfo(System.IO.Path.Combine(mapPath.FullName, "default.json"));
|
||||
if (filePath.Exists == false) //그래도없다면 맵폴더에서 파일을 찾아본다.
|
||||
{
|
||||
var files = mapPath.GetFiles("*.json");
|
||||
if (files.Any()) filePath = files[0];
|
||||
}
|
||||
|
||||
if (filePath.Exists)
|
||||
{
|
||||
var result = MapLoader.LoadMapFromFile(filePath.FullName);
|
||||
|
||||
if (result.Success)
|
||||
{
|
||||
if (PUB._mapCanvas.Nodes == null) PUB._mapCanvas.Nodes = new List<MapNode>();
|
||||
else PUB._mapCanvas.Nodes.Clear();
|
||||
PUB._mapCanvas.Nodes.AddRange(result.Nodes);
|
||||
|
||||
// 맵 캔버스에 데이터 설정
|
||||
PUB._mapCanvas.Nodes = PUB._mapCanvas.Nodes;
|
||||
PUB._mapCanvas.MapFileName = filePath.FullName;
|
||||
|
||||
// 🔥 맵 설정 적용 (배경색, 그리드 표시)
|
||||
if (result.Settings != null)
|
||||
{
|
||||
PUB._mapCanvas.BackColor = System.Drawing.Color.FromArgb(result.Settings.BackgroundColorArgb);
|
||||
PUB._mapCanvas.ShowGrid = result.Settings.ShowGrid;
|
||||
}
|
||||
|
||||
// 🔥 가상 AGV 초기화 (첫 노드 위치에 생성)
|
||||
if (PUB._virtualAGV == null && PUB._mapCanvas.Nodes.Count > 0)
|
||||
{
|
||||
var startNode = PUB._mapCanvas.Nodes.FirstOrDefault(n => n.IsNavigationNode());
|
||||
if (startNode != null)
|
||||
{
|
||||
PUB._virtualAGV = new VirtualAGV(PUB.setting.MCID, startNode.Position, AgvDirection.Forward);
|
||||
PUB._virtualAGV.LowBatteryThreshold = PUB.setting.BatteryLimit_Low;
|
||||
PUB._virtualAGV.SetPosition(startNode, AgvDirection.Forward);
|
||||
|
||||
// 캔버스에 AGV 리스트 설정
|
||||
var agvList = new System.Collections.Generic.List<AGVNavigationCore.Controls.IAGV> { PUB._virtualAGV };
|
||||
PUB._mapCanvas.AGVList = agvList;
|
||||
|
||||
PUB.log.Add($"가상 AGV 생성: {startNode.Id} 위치");
|
||||
}
|
||||
}
|
||||
else if (PUB._virtualAGV != null)
|
||||
{
|
||||
PUB._virtualAGV.LowBatteryThreshold = PUB.setting.BatteryLimit_Low;
|
||||
// 기존 AGV가 있으면 캔버스에 다시 연결
|
||||
var agvList = new System.Collections.Generic.List<AGVNavigationCore.Controls.IAGV> { PUB._virtualAGV };
|
||||
PUB._mapCanvas.AGVList = agvList;
|
||||
}
|
||||
|
||||
// 맵 로드 후 자동으로 맵에 맞춤
|
||||
PUB._mapCanvas.FitToNodes();
|
||||
|
||||
PUB.log.Add($"맵 파일 로드 완료: {filePath.Name}, 노드 수: {result.Nodes.Count}");
|
||||
}
|
||||
else
|
||||
{
|
||||
PUB.log.Add($"맵 파일 로딩 실패: {result.ErrorMessage}");
|
||||
MessageBox.Show($"맵 파일 로딩 실패: {result.ErrorMessage}", "오류",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PUB.log.Add($"맵 파일을 찾을 수 없습니다: {filePath.FullName}");
|
||||
}
|
||||
|
||||
|
||||
//var fn = string.Empty;
|
||||
//if (files.Any() == false)
|
||||
//{
|
||||
|
||||
Reference in New Issue
Block a user