Major improvements to AGV navigation system: • Consolidated RFID management into MapNode, removing duplicate RfidMapping class • Enhanced MapNode with RFID metadata fields (RfidStatus, RfidDescription) • Added automatic bidirectional connection generation in pathfinding algorithms • Updated all components to use unified MapNode-based RFID system • Added command line argument support for AGVMapEditor auto-loading files • Fixed pathfinding failures by ensuring proper node connectivity Technical changes: - Removed RfidMapping class and dependencies across all projects - Updated AStarPathfinder with EnsureBidirectionalConnections() method - Modified MapLoader to use AssignAutoRfidIds() for RFID automation - Enhanced UnifiedAGVCanvas, SimulatorForm, and MainForm for MapNode integration - Improved data consistency and reduced memory footprint 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
114 lines
3.2 KiB
C#
114 lines
3.2 KiB
C#
using System;
|
|
using System.IO;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace AGVSimulator.Models
|
|
{
|
|
/// <summary>
|
|
/// 시뮬레이터 환경 설정 클래스
|
|
/// </summary>
|
|
public class SimulatorConfig
|
|
{
|
|
#region Properties
|
|
|
|
/// <summary>
|
|
/// MapEditor 실행 파일 경로
|
|
/// </summary>
|
|
public string MapEditorExecutablePath { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 마지막으로 로드한 맵 파일 경로
|
|
/// </summary>
|
|
public string LastMapFilePath { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 설정 파일 자동 저장 여부
|
|
/// </summary>
|
|
public bool AutoSave { get; set; } = true;
|
|
|
|
#endregion
|
|
|
|
#region Static Methods
|
|
|
|
/// <summary>
|
|
/// 설정 파일 기본 경로
|
|
/// </summary>
|
|
private static string ConfigFilePath => Path.Combine(
|
|
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
|
"AGVSimulator",
|
|
"config.json");
|
|
|
|
/// <summary>
|
|
/// 설정을 파일에서 로드
|
|
/// </summary>
|
|
/// <returns>로드된 설정 객체</returns>
|
|
public static SimulatorConfig Load()
|
|
{
|
|
try
|
|
{
|
|
if (File.Exists(ConfigFilePath))
|
|
{
|
|
var json = File.ReadAllText(ConfigFilePath);
|
|
return JsonConvert.DeserializeObject<SimulatorConfig>(json) ?? new SimulatorConfig();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
System.Diagnostics.Debug.WriteLine($"설정 로드 실패: {ex.Message}");
|
|
}
|
|
|
|
return new SimulatorConfig();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 설정을 파일에 저장
|
|
/// </summary>
|
|
/// <param name="config">저장할 설정 객체</param>
|
|
/// <returns>저장 성공 여부</returns>
|
|
public static bool Save(SimulatorConfig config)
|
|
{
|
|
try
|
|
{
|
|
var directory = Path.GetDirectoryName(ConfigFilePath);
|
|
if (!Directory.Exists(directory))
|
|
{
|
|
Directory.CreateDirectory(directory);
|
|
}
|
|
|
|
var json = JsonConvert.SerializeObject(config, Formatting.Indented);
|
|
File.WriteAllText(ConfigFilePath, json);
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
System.Diagnostics.Debug.WriteLine($"설정 저장 실패: {ex.Message}");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Instance Methods
|
|
|
|
/// <summary>
|
|
/// 현재 설정을 저장
|
|
/// </summary>
|
|
/// <returns>저장 성공 여부</returns>
|
|
public bool Save()
|
|
{
|
|
return Save(this);
|
|
}
|
|
|
|
/// <summary>
|
|
/// MapEditor 실행 파일 경로 유효성 확인
|
|
/// </summary>
|
|
/// <returns>유효한 경로인지 여부</returns>
|
|
public bool IsMapEditorPathValid()
|
|
{
|
|
return !string.IsNullOrEmpty(MapEditorExecutablePath) &&
|
|
File.Exists(MapEditorExecutablePath);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |