appropriate names in PathResult for nodes gSCoreNodes
This commit is contained in:
parent
055a751c9d
commit
9e0c4f65db
@ -8,16 +8,16 @@ public class PathResult
|
||||
[JsonInclude]public TimeSpan calcTime;
|
||||
[JsonInclude]public List<PathNode> pathNodes;
|
||||
[JsonInclude]public Dictionary<ulong, double>? gScore;
|
||||
[JsonInclude]public HashSet<OsmNode>? nodes;
|
||||
[JsonInclude]public HashSet<OsmNode>? gScoreNodes;
|
||||
public string? name { get; set; }
|
||||
|
||||
[JsonConstructor]
|
||||
public PathResult(TimeSpan calcTime, List<PathNode> pathNodes, Dictionary<ulong, double>? gScore, HashSet<OsmNode>? nodes)
|
||||
public PathResult(TimeSpan calcTime, List<PathNode> pathNodes, Dictionary<ulong, double>? gScore, HashSet<OsmNode>? gScoreNodes)
|
||||
{
|
||||
this.calcTime = calcTime;
|
||||
this.pathNodes = pathNodes;
|
||||
this.gScore = gScore;
|
||||
this.nodes = nodes;
|
||||
this.gScoreNodes = gScoreNodes;
|
||||
}
|
||||
|
||||
public PathResult(TimeSpan calcTime, List<PathNode> pathNodes)
|
||||
@ -36,11 +36,11 @@ public class PathResult
|
||||
public void AddGScores(Dictionary<OsmNode, double> gScore)
|
||||
{
|
||||
this.gScore = new();
|
||||
this.nodes = new();
|
||||
this.gScoreNodes = new();
|
||||
foreach (KeyValuePair<OsmNode, double> kv in gScore)
|
||||
{
|
||||
this.gScore.Add(kv.Key.nodeId, kv.Value);
|
||||
this.nodes.Add(kv.Key);
|
||||
this.gScoreNodes.Add(kv.Key);
|
||||
}
|
||||
}
|
||||
}
|
@ -33,10 +33,10 @@ public static class Pathfinder
|
||||
{
|
||||
Console.WriteLine("Path found.");
|
||||
PathResult path = GetPath(cameFromDict, goalNode, regionManager, DateTime.Now - startCalc);
|
||||
path.AddGScores(gScore);
|
||||
string fileName = $"{new DirectoryInfo(workingDir).Name}-{DateTime.Now.ToFileTime()}.result";
|
||||
string outputFilepath = Path.Join(Directory.GetParent(workingDir)!.FullName, fileName);
|
||||
path.name = outputFilepath;
|
||||
path.AddGScores(gScore);
|
||||
SaveGraph(path, outputFilepath);
|
||||
return path;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user