コード例 #1
0
        public void PerformanceTest()
        {
            var ws = (IFeatureWorkspace)TestDataUtils.OpenTopgisTlm();

            IFeatureClass ptFc   = ws.OpenFeatureClass("TOPGIS_TLM.TLM_EINZELBAUM_GEBUESCH");
            IFeatureClass polyFc = ws.OpenFeatureClass("TOPGIS_TLM.TLM_BODENBEDECKUNG");

            var test = new QaPointNotNear(ptFc, polyFc, 2);

            test.SetConstraint(1, "Objektart = 12");             // wald

            double tileSize = 10000;
            var    runner   = new QaContainerTestRunner(tileSize, test);

            IEnvelope testBox = GeometryFactory.CreateEnvelope(2554000, 1147000, 2561000, 1151000);
            var       w       = new Stopwatch();

            w.Start();
            runner.Execute(testBox);
            w.Stop();
            string msg = $"Direct:{w.ElapsedMilliseconds} ms";

            Console.WriteLine(msg);
            int nDirect = runner.Errors.Count;

            QaPointNotNear.UseQueryPointAndDistance = true;

            runner.ClearErrors();
            w.Reset();
            w.Start();
            runner.Execute(testBox);
            w.Stop();
            msg = $"QueryDistance:{w.ElapsedMilliseconds} ms";
            Console.WriteLine(msg);
            int nQuery = runner.Errors.Count;

            QaPointNotNear.UseQueryPointAndDistance = false;

            Assert.AreEqual(nQuery, nDirect);
        }