示例#1
0
        public void CanCalculateDifferenceInLargeGeometry()
        {
            const int manyPointsPerPart = 123456;
            const int holes             = 3;

            IPolygon poly2a =
                CreatePunchedSquarePolygon("2a", manyPointsPerPart, holes, 1);

            GeometryUtils.Simplify(poly2a, true, true);

            IPolygon poly2b = GeometryFactory.Clone(poly2a);

            var watch = new Stopwatch();

            watch.Start();

            IPolyline line2a = GeometryFactory.CreatePolyline(poly2a);
            IPolyline line2b = GeometryFactory.CreatePolyline(poly2b);

            watch.Stop();

            Console.WriteLine(@"Created polylines in {0} ms", watch.ElapsedMilliseconds);

            watch.Reset();
            watch.Start();

            IPolyline result = ReshapeUtils.GetZOnlyDifference(line2a,
                                                               line2b);

            watch.Stop();

            Assert.IsNull(result);

            Console.WriteLine(@"Calculate Z-only difference (no changes) in {0} ms",
                              watch.ElapsedMilliseconds);

            var comparison = new GeometryComparison(line2a, line2b);

            watch.Reset();
            watch.Start();

            IDictionary <WKSPointZ, VertexIndex> differences =
                comparison.GetDifference(true);

            watch.Stop();

            Console.WriteLine(@"Calculate Difference (no changes) in {0} ms",
                              watch.ElapsedMilliseconds);

            Assert.AreEqual(0, differences.Count);
        }