From 8bd0c5a4d4f421a21c20882f10751bbb6c967ab9 Mon Sep 17 00:00:00 2001 From: glax Date: Sun, 9 Apr 2023 16:47:33 +0200 Subject: [PATCH] Added Pathfinding Time Renamed GetRoute -> GetRouteTime and GetRouteDistance --- API/Program.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/API/Program.cs b/API/Program.cs index 62a5fbc..f74b88e 100644 --- a/API/Program.cs +++ b/API/Program.cs @@ -15,7 +15,7 @@ var app = builder.Build(); -app.MapGet("/getRoute", (float latStart, float lonStart, float latEnd, float lonEnd) => +app.MapGet("/getRouteDistance", (float latStart, float lonStart, float latEnd, float lonEnd) => { DateTime startCalc = DateTime.Now; List result = Pathfinder.AStarDistance("D:/stuttgart-regbez-latest", new Coordinates(latStart, lonStart), new Coordinates(latEnd, lonEnd)); @@ -24,6 +24,15 @@ app.MapGet("/getRoute", (float latStart, float lonStart, float latEnd, float lon } ); +app.MapGet("/getRouteTime", (float latStart, float lonStart, float latEnd, float lonEnd) => + { + DateTime startCalc = DateTime.Now; + List result = Pathfinder.AStarTime("D:/stuttgart-regbez-latest", new Coordinates(latStart, lonStart), new Coordinates(latEnd, lonEnd), Tag.SpeedType.car); + PathResult pathResult = new PathResult(DateTime.Now - startCalc, result); + return pathResult; + } +); + app.MapGet("/getClosestNode", (float lat, float lon) => { RegionManager regionManager = new RegionManager("D:/stuttgart-regbez-latest");