public static Way ToDomain(this WayDto way) { var newWay = new Way { Id = way.Id.ToString(CultureInfo.InvariantCulture), Bounds = way.Bounds == null ? null : way.Bounds.ToDomain(), Geometry = ConvertGeometryToDomain(way), Tags = way.Tags == null ? new Dictionary <string, object>() : new Dictionary <string, object>(way.Tags), Version = way.Version, Center = way.Center == null ? null : way.Center.ToDomain(0), Nodes = way.Nodes == null ? null : way.Nodes.Select(n => n.ToString(CultureInfo.InvariantCulture)).ToList() }; MapElementProperties(newWay, way); return(newWay); }
private static List <Coordinates> ConvertGeometryToDomain(WayDto way) { var coordinates = new List <Coordinates>(); if (way.Geometry == null) { return(null); } int indexCounter = 0; foreach (var coordinatesDto in way.Geometry) { if (coordinatesDto == null) { continue; } coordinates.Add(ToDomain(coordinatesDto, indexCounter)); indexCounter++; } return(coordinates); }