- Timestamp:
- 07/31/12 12:52:57 (12 years ago)
- Location:
- branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Graph/Graph.cs
r8321 r8369 34 34 List<Vertex<Node>> vertices = GetNeighborVerticesOnEdge(edge, vertex); 35 35 foreach (Vertex<Node> neighbor in vertices) { 36 float weight = GetWeight(edge, vertex, neighbor); 37 neighbors[neighbor.Node.Id] = weight; 36 if (edge.CanBeTraversed(vertex.Node, neighbor.Node)) { 37 float weight = GetWeight(edge, vertex, neighbor); 38 neighbors[neighbor.Node.Id] = weight; 39 } 38 40 } 39 41 } -
branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Osm/TagConstants.cs
r8290 r8369 3 3 public class TagConstants { 4 4 public const string HighwayTagKey = "highway"; 5 public const string OneWayTag = "oneway"; 6 public const string YesValue = "yes"; 5 7 } 6 8 } -
branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Osm/Way.cs
r8293 r8369 52 52 } 53 53 54 private HighwayType highwayTag;55 54 public HighwayType HighwayTag { 56 55 get { … … 69 68 } 70 69 } 70 71 public bool OneWay { 72 get { 73 if (base.Tags.ContainsKey(TagConstants.OneWayTag)) { 74 string value = base.Tags[TagConstants.OneWayTag]; 75 return value.Equals(TagConstants.YesValue); 76 } else { 77 return false; 78 } 79 } 80 } 81 82 public bool CanBeTraversed(Node source, Node target) { 83 // check if way can be traveld by a specific vehicle (car, public transport, pedestiran, bicycle) 84 // if (!CanBeTraversed(Vehicle)) return false 85 if (OneWay) { 86 // if vehicle == pedestrian or bicylce -> return true 87 int sourceIndex = Nodes.IndexOf(source); 88 int targetIndex = Nodes.IndexOf(target); 89 // order of the nodes determines the driving direction 90 return (sourceIndex < targetIndex); 91 } 92 return true; 93 } 94 95 //public bool CanBeTraversed(Vehicle) {} 71 96 } 72 97 }
Note: See TracChangeset
for help on using the changeset viewer.