Added Pathfinding Time

Renamed GetRoute -> GetRouteTime and GetRouteDistance
This commit is contained in:
glax 2023-04-09 16:47:33 +02:00
parent feb9b70e50
commit 8bd0c5a4d4

View File

@ -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<PathNode> 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<PathNode> 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");