시스템메세지, 정보메세지개념 추가
This commit is contained in:
@@ -82,7 +82,7 @@ namespace AGVNavigationCore.Controls
|
||||
DrawNodeLabels(g);
|
||||
DrawLabels(g); // 추가: 텍스트 라벨
|
||||
|
||||
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -91,7 +91,7 @@ namespace AGVNavigationCore.Controls
|
||||
|
||||
// UI 정보 그리기 (변환 없이)
|
||||
//if (_showGrid)
|
||||
DrawUIInfo(g);
|
||||
DrawUIInfo(g);
|
||||
|
||||
// 동기화 화면 그리기 (변환 없이, 최상위)
|
||||
if (_canvasMode == CanvasMode.Sync)
|
||||
@@ -104,6 +104,7 @@ namespace AGVNavigationCore.Controls
|
||||
{
|
||||
g.DrawString(this.PredictMessage, this.Font, Brushes.White, 10, 100);
|
||||
}
|
||||
DrawSystemMessage(g);
|
||||
DrawAlertMessage(g);
|
||||
|
||||
}
|
||||
@@ -134,18 +135,18 @@ namespace AGVNavigationCore.Controls
|
||||
var start = node.Position;
|
||||
var end = targetNode.Position;
|
||||
var angle = Math.Atan2(end.Y - start.Y, end.X - start.X);
|
||||
|
||||
|
||||
// 박스(텍스트) 중심 위치: 약 40px 거리
|
||||
var boxDist = 40;
|
||||
var boxX = start.X + boxDist * Math.Cos(angle);
|
||||
var boxY = start.Y + boxDist * Math.Sin(angle);
|
||||
|
||||
string text = dir.ToString();
|
||||
|
||||
|
||||
Color color = Color.Blue;
|
||||
if (dir == MagnetPosition.L) color = Color.LimeGreen;
|
||||
if (dir == MagnetPosition.L) color = Color.LimeGreen;
|
||||
else if (dir == MagnetPosition.R) color = Color.Red;
|
||||
|
||||
|
||||
// 화살표 및 텍스트 설정
|
||||
using (var arrowBrush = new SolidBrush(color))
|
||||
using (var arrowPen = new Pen(color, 2)) // 두께 약간 증가
|
||||
@@ -156,10 +157,10 @@ namespace AGVNavigationCore.Controls
|
||||
// 끝점: 박스 너머 (55px)
|
||||
var arrowStartDist = 25;
|
||||
var arrowEndDist = 55;
|
||||
|
||||
|
||||
var pStart = new PointF((float)(start.X + arrowStartDist * Math.Cos(angle)), (float)(start.Y + arrowStartDist * Math.Sin(angle)));
|
||||
var pEnd = new PointF((float)(start.X + arrowEndDist * Math.Cos(angle)), (float)(start.Y + arrowEndDist * Math.Sin(angle)));
|
||||
|
||||
|
||||
// 화살표 선 그리기
|
||||
g.DrawLine(arrowPen, pStart, pEnd);
|
||||
|
||||
@@ -169,7 +170,7 @@ namespace AGVNavigationCore.Controls
|
||||
// 삼각형 머리 (채우기)
|
||||
var pBackL = new PointF((float)(pEnd.X + arrowSize * Math.Cos(angle + 2.5)), (float)(pEnd.Y + arrowSize * Math.Sin(angle + 2.5)));
|
||||
var pBackR = new PointF((float)(pEnd.X + arrowSize * Math.Cos(angle - 2.5)), (float)(pEnd.Y + arrowSize * Math.Sin(angle - 2.5)));
|
||||
|
||||
|
||||
// pHead1이 가장 먼 쪽이 되도록 조정 (pEnd가 삼각형의 뒷부분 중심이 되도록)
|
||||
// pEnd에서 시작해서 앞으로 나가는 삼각형
|
||||
// pTip = pEnd + size * angle
|
||||
@@ -184,7 +185,7 @@ namespace AGVNavigationCore.Controls
|
||||
var textPoint = new PointF((float)(boxX - textSize.Width / 2), (float)(boxY - textSize.Height / 2));
|
||||
|
||||
//편집모드에서만 글자를 표시한다.
|
||||
if(Mode == CanvasMode.Edit)
|
||||
if (Mode == CanvasMode.Edit)
|
||||
{
|
||||
// 텍스트 배경 (반투명 - 선이 은은하게 보이도록 투명도 조절하거나, 가독성을 위해 불투명하게 처리)
|
||||
// 사용자가 "박스를 가로지르는" 느낌을 원했으므로 선이 보여야 함. 하지만 텍스트 가독성도 필요.
|
||||
@@ -197,8 +198,8 @@ namespace AGVNavigationCore.Controls
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,9 +208,9 @@ namespace AGVNavigationCore.Controls
|
||||
}
|
||||
}
|
||||
|
||||
void DrawAlertMessage(Graphics g)
|
||||
void DrawSystemMessage(Graphics g)
|
||||
{
|
||||
if (!showalert || String.IsNullOrEmpty(this._alertmesage)) return;
|
||||
if (!showalertsystem || String.IsNullOrEmpty(this._systemmesage)) return;
|
||||
|
||||
// 상단 중앙에 반투명 빨간색 배경 바 표시
|
||||
int barHeight = 40;
|
||||
@@ -231,7 +232,7 @@ namespace AGVNavigationCore.Controls
|
||||
{
|
||||
g.FillPath(brush, path);
|
||||
}
|
||||
|
||||
|
||||
using (var pen = new Pen(Color.FromArgb(255, 255, 255), 2))
|
||||
{
|
||||
g.DrawPath(pen, path);
|
||||
@@ -239,29 +240,80 @@ namespace AGVNavigationCore.Controls
|
||||
}
|
||||
|
||||
// 텍스트 깜박임 효과 (배경은 유지하고 텍스트만 깜박임)
|
||||
if (_isAlertBlinkOn)
|
||||
|
||||
using (var font = new Font("Malgun Gothic", 12, FontStyle.Bold))
|
||||
using (var brush = new SolidBrush(Color.White))
|
||||
{
|
||||
using (var font = new Font("Malgun Gothic", 12, FontStyle.Bold))
|
||||
using (var brush = new SolidBrush(Color.White))
|
||||
var textSize = g.MeasureString(_systemmesage, font);
|
||||
g.DrawString(_systemmesage, font, brush,
|
||||
barX + (barWidth - textSize.Width) / 2,
|
||||
barY + (barHeight - textSize.Height) / 2);
|
||||
}
|
||||
|
||||
// 경고 아이콘 그리기 (왼쪽)
|
||||
// 간단한 느낌표 아이콘
|
||||
int iconX = barX + 15;
|
||||
int iconY = barY + barHeight / 2;
|
||||
using (var brush = new SolidBrush(Color.White))
|
||||
{
|
||||
g.FillEllipse(brush, iconX - 2, iconY - 8, 4, 16); // body
|
||||
g.FillEllipse(brush, iconX - 2, iconY + 10, 4, 4); // dot
|
||||
}
|
||||
|
||||
}
|
||||
void DrawAlertMessage(Graphics g)
|
||||
{
|
||||
if (!showinfo || String.IsNullOrEmpty(this._infomessage)) return;
|
||||
|
||||
// 상단 중앙에 반투명 빨간색 배경 바 표시
|
||||
int barHeight = 40;
|
||||
int barWidth = Math.Min(600, this.Width - 40); // 최대 600px, 좌우 여백 20px
|
||||
int barX = (this.Width - barWidth) / 2;
|
||||
int barY = 20+50;
|
||||
|
||||
// 둥근 사각형 배경
|
||||
using (var path = new GraphicsPath())
|
||||
{
|
||||
int radius = 10;
|
||||
path.AddArc(barX, barY, radius * 2, radius * 2, 180, 90);
|
||||
path.AddArc(barX + barWidth - radius * 2, barY, radius * 2, radius * 2, 270, 90);
|
||||
path.AddArc(barX + barWidth - radius * 2, barY + barHeight - radius * 2, radius * 2, radius * 2, 0, 90);
|
||||
path.AddArc(barX, barY + barHeight - radius * 2, radius * 2, radius * 2, 90, 90);
|
||||
path.CloseFigure();
|
||||
|
||||
using (var brush = new SolidBrush(Color.FromArgb(255, Color.Lime)))
|
||||
{
|
||||
var textSize = g.MeasureString(_alertmesage, font);
|
||||
g.DrawString(_alertmesage, font, brush,
|
||||
barX + (barWidth - textSize.Width) / 2,
|
||||
barY + (barHeight - textSize.Height) / 2);
|
||||
g.FillPath(brush, path);
|
||||
}
|
||||
|
||||
// 경고 아이콘 그리기 (왼쪽)
|
||||
// 간단한 느낌표 아이콘
|
||||
int iconX = barX + 15;
|
||||
int iconY = barY + barHeight / 2;
|
||||
using (var brush = new SolidBrush(Color.White))
|
||||
using (var pen = new Pen(Color.FromArgb(255, 255, 255), 2))
|
||||
{
|
||||
g.FillEllipse(brush, iconX - 2, iconY - 8, 4, 16); // body
|
||||
g.FillEllipse(brush, iconX - 2, iconY + 10, 4, 4); // dot
|
||||
g.DrawPath(pen, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 텍스트 깜박임 효과 (배경은 유지하고 텍스트만 깜박임)
|
||||
|
||||
using (var font = new Font("Malgun Gothic", 12, FontStyle.Bold))
|
||||
using (var brush = new SolidBrush(Color.Black))
|
||||
{
|
||||
var textSize = g.MeasureString(_infomessage, font);
|
||||
g.DrawString(_infomessage, font, brush,
|
||||
barX + (barWidth - textSize.Width) / 2,
|
||||
barY + (barHeight - textSize.Height) / 2);
|
||||
}
|
||||
|
||||
// 경고 아이콘 그리기 (왼쪽)
|
||||
// 간단한 느낌표 아이콘
|
||||
int iconX = barX + 15;
|
||||
int iconY = barY + barHeight / 2;
|
||||
using (var brush = new SolidBrush(Color.Black))
|
||||
{
|
||||
g.FillEllipse(brush, iconX - 2, iconY - 8, 4, 16); // body
|
||||
g.FillEllipse(brush, iconX - 2, iconY + 10, 4, 4); // dot
|
||||
}
|
||||
|
||||
}
|
||||
private void DrawSyncScreen(Graphics g)
|
||||
{
|
||||
// 반투명 검은색 배경
|
||||
@@ -374,10 +426,10 @@ namespace AGVNavigationCore.Controls
|
||||
foreach (var targetNode in node.ConnectedMapNodes)
|
||||
{
|
||||
if (targetNode == null) continue;
|
||||
|
||||
|
||||
// 강조된 연결은 나중에 그리기 위해 건너뜀
|
||||
if (IsConnectionHighlighted(node.Id, targetNode.Id)) continue;
|
||||
|
||||
|
||||
DrawConnection(g, node, targetNode);
|
||||
}
|
||||
}
|
||||
@@ -386,12 +438,12 @@ namespace AGVNavigationCore.Controls
|
||||
// 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);
|
||||
}
|
||||
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. 마그넷 그리기 (별도 리스트 사용)
|
||||
@@ -723,14 +775,14 @@ namespace AGVNavigationCore.Controls
|
||||
|
||||
var angle = Math.Atan2(nextNode.Position.Y - currentNode.Position.Y,
|
||||
nextNode.Position.X - currentNode.Position.X);
|
||||
|
||||
|
||||
// 상세 경로 정보가 있으면 해당 방향 사용, 없으면 Forward
|
||||
AgvDirection arrowDir = AgvDirection.Forward;
|
||||
if (path.DetailedPath != null && i < path.DetailedPath.Count)
|
||||
{
|
||||
arrowDir = path.DetailedPath[i].MotorDirection;
|
||||
}
|
||||
|
||||
|
||||
DrawDirectionArrow(g, midPoint, angle, arrowDir);
|
||||
}
|
||||
}
|
||||
@@ -769,7 +821,7 @@ namespace AGVNavigationCore.Controls
|
||||
// 현재는 사용자 요청에 따라 Gateway 지정이 안된 경우(일반 경로)에는 교차로 강조를 끄는 것이 맞아 보임.
|
||||
// 하지만 일반 주행시에도 교차로 정보가 필요할 수 있으니 일단 둡니다.
|
||||
// 단, Gateway 로직을 타는 경우(HighlightNodeId가 Set됨)에는 위에서 return 되므로 OK.
|
||||
|
||||
|
||||
/*
|
||||
const int JUNCTION_CONNECTIONS = 3;
|
||||
|
||||
@@ -798,8 +850,8 @@ namespace AGVNavigationCore.Controls
|
||||
Color fillColor = isGateway ? Color.FromArgb(100, 255, 140, 0) : Color.FromArgb(80, 70, 130, 200);
|
||||
Color penColor = isGateway ? Color.OrangeRed : Color.FromArgb(150, 100, 150, 220);
|
||||
|
||||
using (var highlightBrush = new SolidBrush(fillColor))
|
||||
using (var highlightPen = new Pen(penColor, 3))
|
||||
using (var highlightBrush = new SolidBrush(fillColor))
|
||||
using (var highlightPen = new Pen(penColor, 3))
|
||||
{
|
||||
g.FillEllipse(
|
||||
highlightBrush,
|
||||
@@ -872,7 +924,7 @@ namespace AGVNavigationCore.Controls
|
||||
{
|
||||
case NodeType.Normal:
|
||||
var item = _selectedNode as MapNode;
|
||||
if ( item.StationType == StationType.Charger)
|
||||
if (item.StationType == StationType.Charger)
|
||||
DrawTriangleGhost(g, ghostBrush);
|
||||
else
|
||||
DrawPentagonGhost(g, ghostBrush);
|
||||
@@ -1507,7 +1559,7 @@ namespace AGVNavigationCore.Controls
|
||||
Color fgColor = Color.Black;
|
||||
Color bgColor = Color.White;
|
||||
switch (node.StationType)
|
||||
{
|
||||
{
|
||||
case StationType.Charger:
|
||||
fgColor = Color.White;
|
||||
bgColor = Color.Tomato;
|
||||
@@ -1530,7 +1582,7 @@ namespace AGVNavigationCore.Controls
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1554,7 +1606,7 @@ namespace AGVNavigationCore.Controls
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
using (var descBrush = new SolidBrush(node.NodeTextForeColor))
|
||||
{
|
||||
g.DrawString(BottomLabelText, btmFont, descBrush, roundRect, new StringFormat
|
||||
@@ -1808,9 +1860,9 @@ namespace AGVNavigationCore.Controls
|
||||
switch (node.StationType)
|
||||
{
|
||||
case StationType.Normal:
|
||||
if(node.CanTurnLeft || node.CanTurnRight)
|
||||
if (node.CanTurnLeft || node.CanTurnRight)
|
||||
bgColor = Color.Violet;
|
||||
else
|
||||
else
|
||||
bgColor = Color.DeepSkyBlue;
|
||||
break;
|
||||
case StationType.Charger: bgColor = Color.Tomato; break;
|
||||
|
||||
Reference in New Issue
Block a user