Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/31/12 12:52:57 (12 years ago)
Author:
spimming
Message:

#1894

  • consider driving directions (one way roads) and
  • check if edges (ways) can be traversed
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  
    3434        List<Vertex<Node>> vertices = GetNeighborVerticesOnEdge(edge, vertex);
    3535        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          }
    3840        }
    3941      }
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Osm/TagConstants.cs

    r8290 r8369  
    33  public class TagConstants {
    44    public const string HighwayTagKey = "highway";
     5    public const string OneWayTag = "oneway";
     6    public const string YesValue = "yes";
    57  }
    68}
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Osm/Way.cs

    r8293 r8369  
    5252    }
    5353
    54     private HighwayType highwayTag;
    5554    public HighwayType HighwayTag {
    5655      get {
     
    6968      }
    7069    }
     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) {}
    7196  }
    7297}
Note: See TracChangeset for help on using the changeset viewer.