using System.Text.Json.Serialization; using OSMDatastructure.Graph; namespace Pathfinding; public class PathResult { [JsonInclude]public TimeSpan calcTime; [JsonInclude]public List pathNodes; [JsonInclude]public Dictionary? gScore; [JsonInclude]public HashSet? nodes; public string? name { get; set; } [JsonConstructor] public PathResult(TimeSpan calcTime, List pathNodes, Dictionary? gScore, HashSet? nodes) { this.calcTime = calcTime; this.pathNodes = pathNodes; this.gScore = gScore; this.nodes = nodes; } public PathResult(TimeSpan calcTime, List pathNodes) { this.calcTime = calcTime; this.pathNodes = pathNodes; } public PathResult(TimeSpan calcTime, List pathNodes, Dictionary gScore) { this.calcTime = calcTime; this.pathNodes = pathNodes; AddGScores(gScore); } public void AddGScores(Dictionary gScore) { this.gScore = new(); this.nodes = new(); foreach (KeyValuePair kv in gScore) { this.gScore.Add(kv.Key.nodeId, kv.Value); this.nodes.Add(kv.Key); } } }