コード例 #1
0
        async IAsyncEnumerable <AircraftStatusBrief> ClientStreamData()
        {
            var copy = lineSimplifier.DouglasPeucker(route.ToList(), 0.0001).ToList();

            copy.Reverse();
            foreach (var status in copy)
            {
                yield return(status);
            }
        }
コード例 #2
0
        private static async Task TestAsync(LineSimplifier lineSimplifier, string path)
        {
            var route = JsonConvert.DeserializeObject <List <AircraftStatusBrief> >(await File.ReadAllTextAsync(Path.Combine(Directory.GetCurrentDirectory(), path)));

            for (var t = 0.0001; t < 0.001; t += 0.0001)
            {
                var simplifiedRoute = lineSimplifier.DouglasPeucker(route, t).ToList();

                Debug.WriteLine($"Tolerant: {t}. Original: {route.Count}. Simplified: {simplifiedRoute.Count}.");

                Assert.IsTrue(route.Count > simplifiedRoute.Count);
            }
        }