private void SimplifyWays() { foreach (var way in ways) { var points = new List <Vector2>(); foreach (var pp in way.nodes) { points.Add(nodes[pp]); } List <Vector2> simplified; simplified = Douglas.DouglasPeuckerReduction(points, tolerance); if (simplified != null && simplified.Count > 1) { way.Update(fc.FitCurve(simplified.ToArray(), curveError)); } else { } } var newList = new LinkedList <Way>(); foreach (var way in ways) { if (way.valid) { newList.AddLast(way); } this.ways = newList; } }
private void SimplifyWays() { OSMRoadTypes[] rtArr = new OSMRoadTypes[ways.Count]; ways.Keys.CopyTo(rtArr, 0); foreach (var rt in rtArr) { foreach (Way way in ways[rt]) { var points = new List <Vector2>(); foreach (long pp in way.nodes) { points.Add(nodes[pp]); } List <Vector2> simplified = Douglas.DouglasPeuckerReduction(points, tolerance); if (simplified != null && simplified.Count > 1) { way.Update(fc.FitCurve(simplified.ToArray(), curveError)); } } var newList = new LinkedList <Way>(); foreach (var way in ways[rt]) { if (way.valid) { newList.AddLast(way); } ways[rt] = newList; } } }