/// <summary> /// Reads the ways from the file. /// </summary> /// <returns>The ways.</returns> public IEnumerable <MapShape> ReadWays() { do { switch (reader.Name) { case "node": var node = MapDefinition.ParseNode(reader); this.nodes.Add(node.Index, node); break; case "way": var nextWay = ParseMapWay(); this.ways.Add(nextWay.Id, nextWay); yield return(MapShape.Create(nextWay, nextWay.Tags)); break; case "relation": { foreach (var relation in this.TryParseRelation()) { yield return(relation); } } break; } } while (reader.Read()); yield break; }
/// <summary> /// Parse the first set of nodes. /// </summary> /// <param name="reader">The xml reader.</param> private void ParseFirstSetOfNodes() { while (this.reader.Read() && string.Equals(this.reader.Name, "node", System.StringComparison.OrdinalIgnoreCase)) { var node = MapDefinition.ParseNode(reader); this.nodes.Add(node.Index, node); } }