PathResult now only includes Path and calcTime.
Other fields have been moved to Pathfinder
This commit is contained in:
parent
619cad61ee
commit
5a1dce9883
@ -1,5 +1,4 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using OSMDatastructure.Graph;
|
|
||||||
|
|
||||||
namespace Pathfinding;
|
namespace Pathfinding;
|
||||||
|
|
||||||
@ -7,41 +6,11 @@ public class PathResult
|
|||||||
{
|
{
|
||||||
[JsonInclude]public TimeSpan calcTime;
|
[JsonInclude]public TimeSpan calcTime;
|
||||||
[JsonInclude]public List<PathNode> pathNodes;
|
[JsonInclude]public List<PathNode> pathNodes;
|
||||||
[JsonInclude]public Dictionary<ulong, double>? gScore;
|
|
||||||
[JsonInclude]public HashSet<OsmNode>? gScoreNodes;
|
|
||||||
[JsonIgnore] public RegionManager? regionManager { get; set; }
|
|
||||||
public string? name { get; set; }
|
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public PathResult(TimeSpan calcTime, List<PathNode> pathNodes, Dictionary<ulong, double>? gScore, HashSet<OsmNode>? gScoreNodes)
|
|
||||||
{
|
|
||||||
this.calcTime = calcTime;
|
|
||||||
this.pathNodes = pathNodes;
|
|
||||||
this.gScore = gScore;
|
|
||||||
this.gScoreNodes = gScoreNodes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PathResult(TimeSpan calcTime, List<PathNode> pathNodes)
|
public PathResult(TimeSpan calcTime, List<PathNode> pathNodes)
|
||||||
{
|
{
|
||||||
this.calcTime = calcTime;
|
this.calcTime = calcTime;
|
||||||
this.pathNodes = pathNodes;
|
this.pathNodes = pathNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PathResult(TimeSpan calcTime, List<PathNode> pathNodes, Dictionary<OsmNode, double> gScore)
|
|
||||||
{
|
|
||||||
this.calcTime = calcTime;
|
|
||||||
this.pathNodes = pathNodes;
|
|
||||||
AddGScores(gScore);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddGScores(Dictionary<OsmNode, double> gScore)
|
|
||||||
{
|
|
||||||
this.gScore = new();
|
|
||||||
this.gScoreNodes = new();
|
|
||||||
foreach (KeyValuePair<OsmNode, double> kv in gScore)
|
|
||||||
{
|
|
||||||
this.gScore.Add(kv.Key.nodeId, kv.Value);
|
|
||||||
this.gScoreNodes.Add(kv.Key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user