Intellisense
This commit is contained in:
parent
f38f7f4c87
commit
52254de1aa
@ -1,3 +1,3 @@
|
||||
Logging.Logger logger = new Logging.Logger(Logging.LogType.CONSOLE, Logging.LogLevel.DEBUG);
|
||||
Logging.Logger logger = new (Logging.LogType.CONSOLE, Logging.LogLevel.DEBUG);
|
||||
Dictionary<UInt64, Graph.Node> nodes = OpenStreetMap_Importer.Importer.Import(logger);
|
||||
new astar.Astar(nodes, logger);
|
||||
astar.Astar astar = new(nodes, logger);
|
@ -20,6 +20,6 @@
|
||||
this.goalDistance = double.MaxValue;
|
||||
this.pathLength = double.MaxValue;
|
||||
}
|
||||
public static Node nullnode = new Node(float.NaN, float.NaN);
|
||||
public static Node nullnode = new(float.NaN, float.NaN);
|
||||
}
|
||||
}
|
||||
|
@ -9,17 +9,17 @@ namespace OpenStreetMap_Importer
|
||||
|
||||
public static Dictionary<ulong, Node> Import(Logger ?logger = null)
|
||||
{
|
||||
List<Way> ways = new List<Way>();
|
||||
Dictionary<ulong, Node> nodes = new Dictionary<ulong, Node>();
|
||||
List<Way> ways = new();
|
||||
Dictionary<ulong, Node> nodes = new();
|
||||
|
||||
bool wayTag = false;
|
||||
Way currentWay = new Way();
|
||||
Way currentWay = new();
|
||||
|
||||
/*
|
||||
* First iteration
|
||||
* Import "ways" with a tag "highway" and add the node-ids to the list of nodes
|
||||
*/
|
||||
XmlReaderSettings readerSettings = new XmlReaderSettings()
|
||||
XmlReaderSettings readerSettings = new()
|
||||
{
|
||||
IgnoreWhitespace = true,
|
||||
IgnoreComments = true
|
||||
@ -172,33 +172,33 @@ namespace OpenStreetMap_Importer
|
||||
{
|
||||
NONE = 1,
|
||||
motorway = 130,
|
||||
trunk = 130,
|
||||
primary = 100,
|
||||
trunk = 125,
|
||||
primary = 110,
|
||||
secondary = 100,
|
||||
tertiary = 80,
|
||||
unclassified = 50,
|
||||
residential = 30,
|
||||
motorway_link = 50,
|
||||
unclassified = 40,
|
||||
residential = 23,
|
||||
motorway_link = 55,
|
||||
trunk_link = 50,
|
||||
primary_link = 30,
|
||||
secondary_link = 30,
|
||||
tertiary_link = 20,
|
||||
living_street = 5,
|
||||
service = 1,
|
||||
pedestrian = 1,
|
||||
track = 5,
|
||||
bus_guideway = 1,
|
||||
escape = 1,
|
||||
raceway = 1,
|
||||
road = 30,
|
||||
busway = 1,
|
||||
footway = 1,
|
||||
bridleway = 1,
|
||||
steps = 1,
|
||||
corridor = 1,
|
||||
path = 1,
|
||||
cycleway = 1,
|
||||
construction = 1
|
||||
secondary_link = 25,
|
||||
tertiary_link = 24,
|
||||
living_street = 20,
|
||||
service = 14,
|
||||
pedestrian = 12,
|
||||
track = 6,
|
||||
bus_guideway = 15,
|
||||
escape = 3,
|
||||
raceway = 4,
|
||||
road = 28,
|
||||
busway = 13,
|
||||
footway = 8,
|
||||
bridleway = 7,
|
||||
steps = 5,
|
||||
corridor = 9,
|
||||
path = 10,
|
||||
cycleway = 11,
|
||||
construction = 2
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,8 +11,8 @@ namespace astar
|
||||
*/
|
||||
public Astar(Dictionary<UInt64, Node> nodes, Logger ?logger = null)
|
||||
{
|
||||
Random r = new Random();
|
||||
List<Node> path = new List<Node>();
|
||||
Random r = new();
|
||||
List<Node> path = new();
|
||||
while(path.Count < 1)
|
||||
{
|
||||
Node n1 = nodes[nodes.Keys.ElementAt(r.Next(0, nodes.Count - 1))];
|
||||
@ -44,7 +44,7 @@ namespace astar
|
||||
private static List<Node> FindPath(ref Dictionary<ulong, Node> nodes, Node start, Node goal, ref Logger ?logger)
|
||||
{
|
||||
Reset(ref nodes);
|
||||
List<Node> toVisit = new List<Node>();
|
||||
List<Node> toVisit = new();
|
||||
toVisit.Add(start);
|
||||
Node currentNode = start;
|
||||
start.pathLength = 0;
|
||||
@ -69,7 +69,7 @@ namespace astar
|
||||
toVisit.Sort(CompareDistanceToGoal);
|
||||
}
|
||||
|
||||
List<Node> path = new List<Node>();
|
||||
List<Node> path = new();
|
||||
|
||||
if (currentNode != goal)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user