Free cookie consent management tool by TermsFeed Policy Generator

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

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

#1894:

  • new default constructor for osm base types
  • defined common interface for data sources
  • implemented xml data source
  • added test project with osm test files
File size: 1.5 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() {
42      nodes = new List<Node>();
43    }
44
45    public Way(long id)
46      : base(id) {
47      nodes = new List<Node>();
48    }
49
50    public List<Node> Nodes {
51      get { return nodes; }
52    }
53
54    private HighwayType highwayTag;
55    public HighwayType HighwayTag {
56      get {
57        if (!base.Tags.ContainsKey(TagConstants.HighwayTagKey)) {
58          return HighwayType.null_type;
59        }
60        if (Enum.IsDefined(typeof(HighwayType), base.Tags[TagConstants.HighwayTagKey])) {
61          HighwayType ht = (HighwayType)Enum.Parse(
62            typeof(HighwayType),
63            base.Tags[TagConstants.HighwayTagKey],
64            true);
65          return ht;
66        } else {
67          return HighwayType.null_type;
68        }
69      }
70    }
71  }
72}
Note: See TracBrowser for help on using the repository browser.