- Timestamp:
- 07/18/12 12:56:35 (12 years ago)
- Location:
- branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3
- Files:
-
- 5 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/HeuristicLab.Problems.RoutePlanning.csproj
r8293 r8300 56 56 </ItemGroup> 57 57 <ItemGroup> 58 <Compile Include="Graph\Edge.cs" /> 59 <Compile Include="Graph\Graph.cs" /> 60 <Compile Include="Graph\IEdge.cs" /> 61 <Compile Include="Graph\Vertex.cs" /> 58 62 <Compile Include="Osm.Data\XmlDataSource.cs" /> 59 63 <Compile Include="Osm\IDataSource.cs" /> … … 74 78 <None Include="Properties\AssemblyInfo.cs.frame" /> 75 79 </ItemGroup> 80 <ItemGroup /> 76 81 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 77 82 <PropertyGroup> -
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 } -
branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Osm/IDataSource.cs
r8293 r8300 1 1 2 using System.Collections.Generic; 2 3 namespace HeuristicLab.Problems.RoutePlanning.Osm { 3 4 public interface IDataSource { … … 5 6 Node GetNode(long nodeId); 6 7 Way GetWay(long wayId); 8 List<Way> GetWays(Node node); 7 9 Relation GetRelation(long relationId); 8 10 }
Note: See TracChangeset
for help on using the changeset viewer.