This commit is contained in:
backuppc
2025-11-10 14:43:47 +09:00
parent 68745f23bb
commit 6e54633c08
57 changed files with 4432 additions and 1018 deletions

View File

@@ -12,6 +12,15 @@ namespace AGVNavigationCore.Models
/// </summary>
public static class MapLoader
{
/// <summary>
/// 맵 설정 정보 (배경색, 그리드 표시 등)
/// </summary>
public class MapSettings
{
public int BackgroundColorArgb { get; set; } = System.Drawing.Color.White.ToArgb();
public bool ShowGrid { get; set; } = true;
}
/// <summary>
/// 맵 파일 로딩 결과
/// </summary>
@@ -19,6 +28,7 @@ namespace AGVNavigationCore.Models
{
public bool Success { get; set; }
public List<MapNode> Nodes { get; set; } = new List<MapNode>();
public MapSettings Settings { get; set; } = new MapSettings();
public string ErrorMessage { get; set; } = string.Empty;
public string Version { get; set; } = string.Empty;
public DateTime CreatedDate { get; set; }
@@ -30,8 +40,9 @@ namespace AGVNavigationCore.Models
public class MapFileData
{
public List<MapNode> Nodes { get; set; } = new List<MapNode>();
public MapSettings Settings { get; set; } = new MapSettings();
public DateTime CreatedDate { get; set; }
public string Version { get; set; } = "1.0";
public string Version { get; set; } = "1.1"; // 버전 업그레이드 (설정 추가)
}
/// <summary>
@@ -66,6 +77,7 @@ namespace AGVNavigationCore.Models
if (mapData != null)
{
result.Nodes = mapData.Nodes ?? new List<MapNode>();
result.Settings = mapData.Settings ?? new MapSettings(); // 설정 로드
result.Version = mapData.Version ?? "1.0";
result.CreatedDate = mapData.CreatedDate;
@@ -111,8 +123,9 @@ namespace AGVNavigationCore.Models
/// </summary>
/// <param name="filePath">저장할 파일 경로</param>
/// <param name="nodes">맵 노드 목록</param>
/// <param name="settings">맵 설정 (배경색, 그리드 표시 등)</param>
/// <returns>저장 성공 여부</returns>
public static bool SaveMapToFile(string filePath, List<MapNode> nodes)
public static bool SaveMapToFile(string filePath, List<MapNode> nodes, MapSettings settings = null)
{
try
{
@@ -122,8 +135,9 @@ namespace AGVNavigationCore.Models
var mapData = new MapFileData
{
Nodes = nodes,
Settings = settings ?? new MapSettings(), // 설정 저장
CreatedDate = DateTime.Now,
Version = "1.0"
Version = "1.1"
};
var json = JsonConvert.SerializeObject(mapData, Formatting.Indented);

View File

@@ -124,7 +124,7 @@ namespace AGVNavigationCore.Models
public FontStyle FontStyle { get; set; } = FontStyle.Regular;
/// <summary>
/// 라벨 전경색 (NodeType.Label인 경우 사용)
/// 텍스트 전경색 (모든 노드 타입에서 사용)
/// </summary>
public Color ForeColor { get; set; } = Color.Black;
@@ -133,6 +133,33 @@ namespace AGVNavigationCore.Models
/// </summary>
public Color BackColor { get; set; } = Color.Transparent;
private float _textFontSize = 7.0f;
/// <summary>
/// 텍스트 폰트 크기 (모든 노드 타입의 텍스트 표시에 사용, 픽셀 단위)
/// 0 이하의 값이 설정되면 기본값 7.0f로 자동 설정
/// </summary>
public float TextFontSize
{
get => _textFontSize;
set => _textFontSize = value > 0 ? value : 7.0f;
}
/// <summary>
/// 텍스트 볼드체 여부 (모든 노드 타입의 텍스트 표시에 사용)
/// </summary>
public bool TextFontBold { get; set; } = true;
/// <summary>
/// 노드 이름 말풍선 배경색 (하단에 표시되는 노드 이름의 배경색)
/// </summary>
public Color NameBubbleBackColor { get; set; } = Color.Gold;
/// <summary>
/// 노드 이름 말풍선 글자색 (하단에 표시되는 노드 이름의 글자색)
/// </summary>
public Color NameBubbleForeColor { get; set; } = Color.Black;
/// <summary>
/// 라벨 배경 표시 여부 (NodeType.Label인 경우 사용)
/// </summary>
@@ -347,6 +374,10 @@ namespace AGVNavigationCore.Models
FontStyle = FontStyle,
ForeColor = ForeColor,
BackColor = BackColor,
TextFontSize = TextFontSize,
TextFontBold = TextFontBold,
NameBubbleBackColor = NameBubbleBackColor,
NameBubbleForeColor = NameBubbleForeColor,
ShowBackground = ShowBackground,
Padding = Padding,
ImagePath = ImagePath,

View File

@@ -306,15 +306,15 @@ namespace AGVNavigationCore.Models
}
// 5. 방향체크
if(CurrentDirection != TargetNode.MotorDirection)
{
return new AGVCommand(
MotorCommand.Stop,
MagnetPosition.S,
SpeedLevel.L,
$"(재탐색요청)모터방향 불일치 현재위치:{_currentNode.NodeId}"
);
}
//if(CurrentDirection != TargetNode.MotorDirection)
//{
// return new AGVCommand(
// MotorCommand.Stop,
// MagnetPosition.S,
// SpeedLevel.L,
// $"(재탐색요청)모터방향 불일치 현재위치:{_currentNode.NodeId}"
// );
//}
//this.CurrentNodeId