diff --git a/RenderPath/Bounds.cs b/RenderPath/Bounds.cs new file mode 100644 index 0000000..cdbdef6 --- /dev/null +++ b/RenderPath/Bounds.cs @@ -0,0 +1,33 @@ +using System.Text.Json.Serialization; +using OSMDatastructure.Graph; + +namespace RenderPath; + +public class Bounds +{ + [JsonInclude]public float minLat, maxLat, minLon, maxLon; + + [JsonConstructor] + public Bounds(float minLat, float minLon, float maxLat, float maxLon) + { + this.minLon = minLon; + this.maxLat = maxLat; + this.maxLon = maxLon; + this.minLat = minLat; + } + + public static Bounds FromCoords(float lat1, float lon1, float lat2, float lon2) + { + float minLat = lat1 < lat2 ? lat1 : lat2; + float minLon = lon1 < lon2 ? lon1 : lon2; + float maxLat = lat1 > lat2 ? lat1 : lat2; + float maxLon = lon1 > lon2 ? lon1 : lon2; + + return new Bounds(minLat, minLon, maxLat, maxLon); + } + + public static Bounds FromCoords(Coordinates c1, Coordinates c2) + { + return FromCoords(c1.latitude, c1.longitude, c2.latitude, c2.longitude); + } +} \ No newline at end of file diff --git a/RenderPath/Renderer.cs b/RenderPath/Renderer.cs index f8f761f..ecf3bbd 100644 --- a/RenderPath/Renderer.cs +++ b/RenderPath/Renderer.cs @@ -18,35 +18,6 @@ public static class Renderer private static readonly Color RoadPrioStart = Color.FromArgb(200, 100, 100, 100); private static readonly Color RoadPrioEnd = Color.FromArgb(255, 255, 180, 0); - public class Bounds - { - [JsonInclude]public float minLat, maxLat, minLon, maxLon; - - [JsonConstructor] - public Bounds(float minLat, float minLon, float maxLat, float maxLon) - { - this.minLon = minLon; - this.maxLat = maxLat; - this.maxLon = maxLon; - this.minLat = minLat; - } - - public static Bounds FromCoords(float lat1, float lon1, float lat2, float lon2) - { - float minLat = lat1 < lat2 ? lat1 : lat2; - float minLon = lon1 < lon2 ? lon1 : lon2; - float maxLat = lat1 > lat2 ? lat1 : lat2; - float maxLon = lon1 > lon2 ? lon1 : lon2; - - return new Bounds(minLat, minLon, maxLat, maxLon); - } - - public static Bounds FromCoords(Coordinates c1, Coordinates c2) - { - return FromCoords(c1.latitude, c1.longitude, c2.latitude, c2.longitude); - } - } - [SuppressMessage("Interoperability", "CA1416:Plattformkompatibilität überprüfen")] public static Image DrawPathfinder(Pathfinder pathfinder) {