Updated to match dependencies

This commit is contained in:
glax 2024-07-23 16:14:53 +02:00
parent 65d3c97fba
commit 0a522baba5
2 changed files with 6 additions and 11 deletions

View File

@ -1,7 +1,6 @@
using System.Drawing;
using System.Runtime.Versioning;
using astar.PathingHelper;
using Graph;
using OSM_Graph.Enums;
using static System.Drawing.Color;
namespace Graph_Renderer;
@ -10,13 +9,9 @@ namespace Graph_Renderer;
public static class Coloring
{
public static Pen DefaultPen = new(Gray, 2);
public static Pen GetPenForWay(Way way)
public static Pen GetPenForWay(OSM_Graph.Way way)
{
if (!way.Tags.TryGetValue("highway", out string? highwayTypeStr))
return DefaultPen;
if (!Enum.TryParse(highwayTypeStr, out HighwayType highwayType))
return DefaultPen;
return ColorDictionary[highwayType];
return ColorDictionary[way.GetHighwayType()];
}
private static readonly Dictionary<HighwayType, Pen> ColorDictionary = new() {

View File

@ -24,7 +24,7 @@ public static class Renderer
using(GraphicsPath capPath = new ())
{
// A triangle
capPath.AddLines(new Point[]{new (-2, -2), new (0, 2), new (2, -2)});
capPath.AddLines(new Point[]{new (-2, -2), new (0, 0), new (2, -2)});
previous.CustomEndCap = new CustomLineCap(null, capPath);
}
@ -34,10 +34,10 @@ public static class Renderer
Point startCoordinates = PixelCoordinatesFromGeoCoordinates(node, minCoordinates, multiplier, bitmap.Height);
//All neighbors
foreach ((ulong neighborNodeId, ulong wayId) in node.Neighbors.Where(kv => r.Graph.ContainsNode(kv.Key)))
foreach ((ulong neighborNodeId, KeyValuePair<ulong, bool> wayId) in node.Neighbors.Where(kv => r.Graph.ContainsNode(kv.Key)))
{
Point endCoordinates = PixelCoordinatesFromGeoCoordinates(r.Graph.Nodes[neighborNodeId], minCoordinates, multiplier, bitmap.Height);
graphics.DrawLine(Coloring.GetPenForWay(r.Graph.Ways[wayId]), startCoordinates, endCoordinates);
graphics.DrawLine(Coloring.GetPenForWay(r.Graph.Ways[wayId.Key]), startCoordinates, endCoordinates);
}
//Previous