This repository has been archived on 2025-01-15. You can view files and clone it, but cannot push or open issues or pull requests.
Files
OSMServer/Pathfinding/PathResult.cs
2023-04-22 17:49:27 +02:00

27 lines
779 B
C#

using System.Text.Json;
using System.Text.Json.Serialization;
namespace Pathfinding;
public class PathResult
{
[JsonInclude]public double distance;
[JsonInclude]public double weight;
[JsonInclude]public TimeSpan calcTime;
[JsonInclude]public List<PathNode> pathNodes;
[JsonConstructor]
public PathResult(TimeSpan calcTime, List<PathNode> pathNodes, double distance, double weight)
{
this.calcTime = calcTime;
this.pathNodes = pathNodes;
this.distance = distance;
this.weight = weight;
}
public static PathResult PathresultFromFile(string filePath)
{
return JsonSerializer.Deserialize<PathResult>(new FileStream(filePath, FileMode.Open, FileAccess.Read,
FileShare.Read))!;
}
}