Moved Bounds to seperate Class
This commit is contained in:
parent
a5f272dfb9
commit
7c5d87ca76
33
RenderPath/Bounds.cs
Normal file
33
RenderPath/Bounds.cs
Normal file
@ -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);
|
||||
}
|
||||
}
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user