This commit is contained in:
backuppc
2026-02-12 09:58:01 +09:00
parent 2b3a9b3d1d
commit d6aed58516
17 changed files with 914 additions and 402 deletions

View File

@@ -374,11 +374,26 @@ namespace AGVNavigationCore.Controls
foreach (var targetNode in node.ConnectedMapNodes)
{
if (targetNode == null) continue;
// 강조된 연결은 나중에 그리기 위해 건너뜀
if (IsConnectionHighlighted(node.Id, targetNode.Id)) continue;
DrawConnection(g, node, targetNode);
}
}
}
// 1.1 강조된 연결 그리기 (항상 위에 표시되도록)
if (_highlightedConnection.HasValue)
{
var n1 = _nodes.FirstOrDefault(n => n.Id == _highlightedConnection.Value.FromNodeId);
var n2 = _nodes.FirstOrDefault(n => n.Id == _highlightedConnection.Value.ToNodeId);
if (n1 != null && n2 != null)
{
DrawConnection(g, n1, n2);
}
}
// 2. 마그넷 그리기 (별도 리스트 사용)
if (_magnets != null)
{
@@ -442,10 +457,17 @@ namespace AGVNavigationCore.Controls
g.DrawLine(_magnetPen, startPoint, endPoint);
}
// 호버된 마그넷 강조
if (magnet == _hoveredNode)
// 호버되거나 선택된 마그넷 강조 (선택: Red, 호버: Orange)
bool isHovered = (magnet == _hoveredNode);
bool isSelected = (magnet == _selectedNode);
if (isHovered || isSelected)
{
using (var highlightPen = new Pen(Color.Orange, 19))
Color highlightColor = isSelected ? Color.Red : Color.Orange;
// 선택된 상태에서 호버되면? -> 선택 색상 우선 (Red) 또는 명확한 구분 필요
// 여기서는 선택이 더 중요하므로 Red 유지
using (var highlightPen = new Pen(highlightColor, 19) { StartCap = LineCap.Round, EndCap = LineCap.Round })
{
if (magnet.ControlPoint != null)
{
@@ -470,15 +492,6 @@ namespace AGVNavigationCore.Controls
g.DrawLine(highlightPen, startPoint, endPoint);
}
}
// Redraw normal to keep it on top? No, highlight is usually outer.
// If I draw highlight AFTER, it covers.
// But DrawMagnet is void. If I draw highlight after, it's fine if I want it to glow.
// Actually _magnetPen is Width 15, very thick.
// If I draw highlight Width 19 *before* normal, it acts as border.
// But this method draws normal first.
// So I should refactor to calculate path first, then draw?
// Or just draw highlight on top with alpha?
// Let's draw highlight on top for now, maybe with alpha.
}
// 선택된 마그넷 핸들 그리기
@@ -859,7 +872,7 @@ namespace AGVNavigationCore.Controls
{
case NodeType.Normal:
var item = _selectedNode as MapNode;
if ( item.StationType == StationType.Charger1 || item.StationType == StationType.Charger2)
if ( item.StationType == StationType.Charger)
DrawTriangleGhost(g, ghostBrush);
else
DrawPentagonGhost(g, ghostBrush);
@@ -1049,13 +1062,12 @@ namespace AGVNavigationCore.Controls
switch (node.StationType)
{
case StationType.Loader:
case StationType.UnLoader:
case StationType.Clearner:
case StationType.Cleaner:
case StationType.Plating:
case StationType.Buffer:
DrawPentagonNodeShape(g, node, brush);
break;
case StationType.Charger1:
case StationType.Charger2:
case StationType.Charger:
DrawTriangleNodeShape(g, node, brush);
break;
case StationType.Limit:
@@ -1470,7 +1482,7 @@ namespace AGVNavigationCore.Controls
// 🔥 노드의 폰트 설정 사용 (0 이하일 경우 기본값 7.0f 사용)
var topFont = new Font("Arial", 9, FontStyle.Bold);
var btmFont = new Font("Arial", 12, FontStyle.Bold);
var btmFont = new Font("Arial", node.NodeTextFontSize, FontStyle.Bold);
// 메인 텍스트 크기 측정
var TopSize = g.MeasureString(TopIDText, topFont);
@@ -1496,8 +1508,7 @@ namespace AGVNavigationCore.Controls
Color bgColor = Color.White;
switch (node.StationType)
{
case StationType.Charger1:
case StationType.Charger2:
case StationType.Charger:
fgColor = Color.White;
bgColor = Color.Tomato;
break;
@@ -1505,12 +1516,12 @@ namespace AGVNavigationCore.Controls
fgColor = Color.Black;
bgColor = Color.White;
break;
case StationType.Clearner:
case StationType.Plating:
fgColor = Color.Black;
bgColor = Color.DeepSkyBlue;
break;
case StationType.Loader:
case StationType.UnLoader:
case StationType.Cleaner:
fgColor = Color.Black;
bgColor = Color.Gold;
break;
@@ -1519,6 +1530,8 @@ namespace AGVNavigationCore.Controls
break;
}
var rectpaddingx = 4;
@@ -1541,7 +1554,8 @@ namespace AGVNavigationCore.Controls
}
using (var descBrush = new SolidBrush(fgColor))
using (var descBrush = new SolidBrush(node.NodeTextForeColor))
{
g.DrawString(BottomLabelText, btmFont, descBrush, roundRect, new StringFormat
{
@@ -1793,12 +1807,16 @@ namespace AGVNavigationCore.Controls
switch (node.StationType)
{
case StationType.Normal: bgColor = Color.DeepSkyBlue; break;
case StationType.Charger1: bgColor = Color.Tomato; break;
case StationType.Charger2: bgColor = Color.Tomato; break;
case StationType.Normal:
if(node.CanTurnLeft || node.CanTurnRight)
bgColor = Color.Violet;
else
bgColor = Color.DeepSkyBlue;
break;
case StationType.Charger: bgColor = Color.Tomato; break;
case StationType.Loader:
case StationType.UnLoader: bgColor = Color.Gold; break;
case StationType.Clearner: bgColor = Color.DeepSkyBlue; break;
case StationType.Cleaner: bgColor = Color.Gold; break;
case StationType.Plating: bgColor = Color.DeepSkyBlue; break;
case StationType.Buffer: bgColor = Color.WhiteSmoke; break;
case StationType.Limit: bgColor = Color.Red; break;
default: bgColor = Color.White; break;