Files
ENIG/Cs_HMI/AGVLogic/AGVMapEditor/Models/ImagePathEditor.cs
backuppc d932b8d332 fix: Add motor direction parameter to magnet direction calculation in pathfinding
- Fixed critical issue in ConvertToDetailedPath where motor direction was not passed to GetRequiredMagnetDirection
- Motor direction is essential for backward movement as Left/Right directions must be inverted
- Modified AGVPathfinder.cs line 280 to pass currentDirection parameter
- Ensures backward motor direction properly inverts magnet sensor directions

feat: Add waypoint support to pathfinding system

- Added FindPath overload with params string[] waypointNodeIds in AStarPathfinder
- Supports sequential traversal through multiple intermediate nodes
- Validates waypoints and prevents duplicates in sequence
- Returns combined path result with aggregated metrics

feat: Implement path result merging with DetailedPath preservation

- Added CombineResults method in AStarPathfinder for intelligent path merging
- Automatically deduplicates nodes when last of previous path equals first of current
- Preserves DetailedPath information including motor and magnet directions
- Essential for multi-segment path operations

feat: Integrate magnet direction with motor direction awareness

- Modified JunctionAnalyzer.GetRequiredMagnetDirection to accept AgvDirection parameter
- Inverts Left/Right magnet directions when moving Backward
- Properly handles motor direction context throughout pathfinding

feat: Add automatic start node selection in simulator

- Added SetStartNodeToCombo method to SimulatorForm
- Automatically selects start node combo box when AGV position is set via RFID
- Improves UI usability and workflow efficiency

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 15:46:16 +09:00

78 lines
2.9 KiB
C#

using System;
using System.ComponentModel;
using System.Drawing.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;
namespace AGVMapEditor.Models
{
/// <summary>
/// PropertyGrid에서 이미지 파일 경로를 선택하기 위한 커스텀 UITypeEditor
/// PropertyGrid에 "..." 버튼을 표시하고, 클릭 시 파일 열기 대화상자를 표시
/// </summary>
public class ImagePathEditor : UITypeEditor
{
/// <summary>
/// PropertyGrid에서 이 에디터의 UI 스타일 반환
/// DropDown 스타일을 사용하여 "..." 버튼을 표시
/// </summary>
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.Modal;
}
/// <summary>
/// 사용자가 "..." 버튼을 클릭할 때 호출되는 메서드
/// </summary>
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
// IWindowsFormsEditorService를 얻어서 대화상자를 표시
var editorService = provider?.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
if (editorService == null)
return value;
// 파일 열기 대화상자 생성
using (var ofd = new OpenFileDialog())
{
ofd.Title = "이미지 파일 선택";
ofd.Filter = "이미지 파일|*.jpg;*.jpeg;*.png;*.bmp;*.gif|모든 파일|*.*";
ofd.CheckFileExists = true;
// 현재 경로가 있으면 해당 위치에서 시작
if (!string.IsNullOrEmpty(value?.ToString()))
{
try
{
string currentPath = value.ToString();
if (System.IO.File.Exists(currentPath))
{
ofd.InitialDirectory = System.IO.Path.GetDirectoryName(currentPath);
ofd.FileName = System.IO.Path.GetFileName(currentPath);
}
}
catch { }
}
// 대화상자 표시
if (ofd.ShowDialog() == DialogResult.OK)
{
// 선택된 파일 경로를 Base64로 변환하고 반환
string filePath = ofd.FileName;
return filePath; // MapNode의 ConvertImageToBase64는 setter에서 호출됨
}
}
return value;
}
/// <summary>
/// PropertyGrid에서 이 타입의 값을 표시하는 방법
/// 파일 경로를 파일명만 표시하도록 처리
/// </summary>
public override bool GetPaintValueSupported(ITypeDescriptorContext context)
{
return false;
}
}
}