Free cookie consent management tool by TermsFeed Policy Generator

source: branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Osm/Way.cs @ 8290

Last change on this file since 8290 was 8290, checked in by spimming, 12 years ago

#1984: core data types for osm graphs implemented

File size: 1.4 KB
Line 
1
2using System;
3using System.Collections.Generic;
4namespace HeuristicLab.Problems.RoutePlanning.Osm {
5  #region Highway Types
6
7  // see: https://wiki.openstreetmap.org/wiki/Key:highway
8  public enum HighwayType {
9    null_type,
10    motorway,
11    motorway_link,
12    trunk,
13    trunk_link,
14    primary,
15    primary_link,
16    secondary,
17    secondary_link,
18    tertiary,
19    tertiary_link,
20    living_street,
21    pedestrian,
22    residential,
23    unclassified,
24    service,
25    track,
26    bus_guideway,
27    raceway,
28    road,
29    path,
30    footway,
31    cycleway,
32    bridleway,
33    steps
34  }
35
36  #endregion
37
38  public class Way : OsmBase {
39    private List<Node> nodes;
40
41    public Way(int id)
42      : base(id) {
43      nodes = new List<Node>();
44    }
45
46    public List<Node> Nodes {
47      get { return nodes; }
48    }
49
50    private HighwayType highwayTag;
51    public HighwayType HighwayTag {
52      get {
53        if (!base.Tags.ContainsKey(TagConstants.HighwayTagKey)) {
54          return HighwayType.null_type;
55        }
56        if (Enum.IsDefined(typeof(HighwayType), base.Tags[TagConstants.HighwayTagKey])) {
57          HighwayType ht = (HighwayType)Enum.Parse(
58            typeof(HighwayType),
59            base.Tags[TagConstants.HighwayTagKey],
60            true);
61          return ht;
62        } else {
63          return HighwayType.null_type;
64        }
65      }
66    }
67  }
68}
Note: See TracBrowser for help on using the repository browser.