예제 #1
0
        private void reductionWorkerDoWork(object sender, DoWorkEventArgs args)
        {
            var worker       = sender as BackgroundWorker;
            var lineSimplify = new DouglasPeuckerLineSimplifier(CoordinateConvertor.LocationCollectionToCoordinates(Original));

            for (int i = 21; i > 0; i--)
            {
                if (worker != null && worker.CancellationPending)
                {
                    args.Cancel = true;
                    break;
                }

                var simplificationDistance = (1 / (Math.Pow(2, i - 1)));
                lineSimplify.DistanceTolerance = simplificationDistance;
                Reduced.Add(i, CoordinateConvertor.CoordinatesToLocationCollection(lineSimplify.Simplify()));
            }

            Initalized = true;
        }