Updated to match dependencies
This commit is contained in:
parent
65d3c97fba
commit
0a522baba5
@ -1,7 +1,6 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Runtime.Versioning;
|
using System.Runtime.Versioning;
|
||||||
using astar.PathingHelper;
|
using OSM_Graph.Enums;
|
||||||
using Graph;
|
|
||||||
using static System.Drawing.Color;
|
using static System.Drawing.Color;
|
||||||
|
|
||||||
namespace Graph_Renderer;
|
namespace Graph_Renderer;
|
||||||
@ -10,13 +9,9 @@ namespace Graph_Renderer;
|
|||||||
public static class Coloring
|
public static class Coloring
|
||||||
{
|
{
|
||||||
public static Pen DefaultPen = new(Gray, 2);
|
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 ColorDictionary[way.GetHighwayType()];
|
||||||
return DefaultPen;
|
|
||||||
if (!Enum.TryParse(highwayTypeStr, out HighwayType highwayType))
|
|
||||||
return DefaultPen;
|
|
||||||
return ColorDictionary[highwayType];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly Dictionary<HighwayType, Pen> ColorDictionary = new() {
|
private static readonly Dictionary<HighwayType, Pen> ColorDictionary = new() {
|
||||||
|
@ -24,7 +24,7 @@ public static class Renderer
|
|||||||
using(GraphicsPath capPath = new ())
|
using(GraphicsPath capPath = new ())
|
||||||
{
|
{
|
||||||
// A triangle
|
// 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);
|
previous.CustomEndCap = new CustomLineCap(null, capPath);
|
||||||
}
|
}
|
||||||
@ -34,10 +34,10 @@ public static class Renderer
|
|||||||
Point startCoordinates = PixelCoordinatesFromGeoCoordinates(node, minCoordinates, multiplier, bitmap.Height);
|
Point startCoordinates = PixelCoordinatesFromGeoCoordinates(node, minCoordinates, multiplier, bitmap.Height);
|
||||||
|
|
||||||
//All neighbors
|
//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);
|
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
|
//Previous
|
||||||
|
Loading…
Reference in New Issue
Block a user