- Timestamp:
- 07/18/12 12:56:35 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Osm.Data/XmlDataSource.cs
r8293 r8300 10 10 private IDictionary<long, Way> ways; 11 11 private IDictionary<long, Relation> relations; 12 13 private IDictionary<long, List<long>> nodeWays; 12 14 13 15 … … 38 40 relations = new Dictionary<long, Relation>(); 39 41 42 nodeWays = new Dictionary<long, List<long>>(); 43 40 44 ReadData(); 41 45 } … … 55 59 if (ways.ContainsKey(wayId)) { 56 60 return ways[wayId]; 61 } 62 return null; 63 } 64 65 public List<Way> GetWays(Node node) { 66 if (nodeWays.ContainsKey(node.Id)) { 67 List<long> wayIds = nodeWays[node.Id]; 68 List<Way> result = new List<Way>(wayIds.Count); 69 for (int i = 0; i < wayIds.Count; i++) { 70 result.Add(GetWay(wayIds[i])); 71 } 72 return result; 57 73 } 58 74 return null; … … 117 133 118 134 ways.Add(way.Id, way); 135 InsertNodeWayRelation(way); 119 136 120 137 reader.Read(); … … 170 187 171 188 } 189 190 private void InsertNodeWayRelation(Way way) { 191 foreach (Node node in way.Nodes) { 192 if (!nodeWays.ContainsKey(node.Id)) { 193 nodeWays.Add(node.Id, new List<long>()); 194 } 195 nodeWays[node.Id].Add(way.Id); 196 } 197 } 172 198 } 173 199 }
Note: See TracChangeset
for help on using the changeset viewer.