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? gScoreNodes; public string? name { get; set; } [JsonConstructor] public PathResult(TimeSpan calcTime, List pathNodes, Dictionary? gScore, HashSet? gScoreNodes) { this.calcTime = calcTime; this.pathNodes = pathNodes; this.gScore = gScore; this.gScoreNodes = gScoreNodes; } 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.gScoreNodes = new(); foreach (KeyValuePair kv in gScore) { this.gScore.Add(kv.Key.nodeId, kv.Value); this.gScoreNodes.Add(kv.Key); } } }