Save Pathfinding result to file.
Load result for render.
This commit is contained in:
@ -16,23 +16,20 @@ var app = builder.Build();
|
||||
|
||||
app.MapGet("/getRoute", (float latStart, float lonStart, float latEnd, float lonEnd, Tag.SpeedType vehicle, double stayOnSameRoadPriority, double useHigherLevelRoadsPriority, double useRoadsWithLessJunctionsPriority) =>
|
||||
{
|
||||
DateTime startCalc = DateTime.Now;
|
||||
List<PathNode> result = Pathfinder.AStar("D:/stuttgart-regbez-latest", new Coordinates(latStart, lonStart),
|
||||
|
||||
PathResult result = Pathfinder.AStar("D:/stuttgart-regbez-latest", new Coordinates(latStart, lonStart),
|
||||
new Coordinates(latEnd, lonEnd), vehicle, useHigherLevelRoadsPriority, stayOnSameRoadPriority,
|
||||
useRoadsWithLessJunctionsPriority);
|
||||
PathResult pathResult = new PathResult(DateTime.Now - startCalc, result);
|
||||
return pathResult;
|
||||
return result;
|
||||
}
|
||||
);
|
||||
|
||||
app.MapGet("/getShortestRoute", (float latStart, float lonStart, float latEnd, float lonEnd) =>
|
||||
{
|
||||
DateTime startCalc = DateTime.Now;
|
||||
List<PathNode> result = Pathfinder.AStar("D:/stuttgart-regbez-latest", new Coordinates(latStart, lonStart),
|
||||
PathResult result = Pathfinder.AStar("D:/stuttgart-regbez-latest", new Coordinates(latStart, lonStart),
|
||||
new Coordinates(latEnd, lonEnd), Tag.SpeedType.any, 0, 0,
|
||||
0);
|
||||
PathResult pathResult = new PathResult(DateTime.Now - startCalc, result);
|
||||
return pathResult;
|
||||
return result;
|
||||
}
|
||||
);
|
||||
|
||||
@ -57,14 +54,3 @@ app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
|
||||
internal class PathResult
|
||||
{
|
||||
[JsonInclude]public TimeSpan calcTime;
|
||||
[JsonInclude]public List<PathNode> pathNodes;
|
||||
|
||||
public PathResult(TimeSpan calcTime, List<PathNode> pathNodes)
|
||||
{
|
||||
this.calcTime = calcTime;
|
||||
this.pathNodes = pathNodes;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user