diff options
Diffstat (limited to 'src/CS340.TSP/City.cs')
-rw-r--r-- | src/CS340.TSP/City.cs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/CS340.TSP/City.cs b/src/CS340.TSP/City.cs index 962a864..a64439b 100644 --- a/src/CS340.TSP/City.cs +++ b/src/CS340.TSP/City.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using Graph; using Interfaces; @@ -16,25 +15,28 @@ namespace TSP public new double Key { get => this[Parent].Weight; set => Key = value; } - public Coordinates Location { get; set; } + public Coordinate Location { get; set; } public City() { } public City(int id) => Id = id; - public City(int id, List<Road> edges) : this(id) => - Edges = edges; - - public City(IVertex city) + public City(int id, List<Road> edges) : this(id) { - Id = city.Id; - Parent = city.Parent; - foreach (Road edge in city.Edges) + foreach (Road edge in edges) { Road newEdge = new Road(edge.U, edge.V, edge.Weight); Edges.Add(newEdge); } } + + public City(IVertex city) : this(city.Id, city.Edges) => + Parent = city.Parent; + + public City(IVertex city, Coordinate location) : this(city) => + Location = new Coordinate(location.X, location.Y); + + public City(City city) : this(city, city.Location) { } } }
\ No newline at end of file |