diff --git a/Executable/Program.cs b/Executable/Program.cs index e2a7710..8a82e22 100644 --- a/Executable/Program.cs +++ b/Executable/Program.cs @@ -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 nodes = OpenStreetMap_Importer.Importer.Import(logger); -new astar.Astar(nodes, logger); \ No newline at end of file +astar.Astar astar = new(nodes, logger); \ No newline at end of file diff --git a/Graph/Node.cs b/Graph/Node.cs index 3689394..23ab811 100644 --- a/Graph/Node.cs +++ b/Graph/Node.cs @@ -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); } } diff --git a/OpenStreetMap Importer/Importer.cs b/OpenStreetMap Importer/Importer.cs index 4516530..285d8aa 100644 --- a/OpenStreetMap Importer/Importer.cs +++ b/OpenStreetMap Importer/Importer.cs @@ -9,17 +9,17 @@ namespace OpenStreetMap_Importer public static Dictionary Import(Logger ?logger = null) { - List ways = new List(); - Dictionary nodes = new Dictionary(); + List ways = new(); + Dictionary 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 } diff --git a/astar/Astar.cs b/astar/Astar.cs index dd7a0ac..ddf5b8d 100644 --- a/astar/Astar.cs +++ b/astar/Astar.cs @@ -11,8 +11,8 @@ namespace astar */ public Astar(Dictionary nodes, Logger ?logger = null) { - Random r = new Random(); - List path = new List(); + Random r = new(); + List 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 FindPath(ref Dictionary nodes, Node start, Node goal, ref Logger ?logger) { Reset(ref nodes); - List toVisit = new List(); + List toVisit = new(); toVisit.Add(start); Node currentNode = start; start.pathLength = 0; @@ -69,7 +69,7 @@ namespace astar toVisit.Sort(CompareDistanceToGoal); } - List path = new List(); + List path = new(); if (currentNode != goal) {