示例#1
0
        public void CanTestFullExtentMultipleTiles()
        {
            IFeatureClass fc = CreatePointClass(_testWs, "CanTestFullExtentMultipleTiles");

            AddPoints(fc);

            QaContainerTestRunner runner = CreateTestRunner(fc, 10, 9.5);

            runner.Execute();

            Assert.AreEqual(2, runner.Errors.Count);
        }
示例#2
0
        private static QaContainerTestRunner CreateTestRunner(
            [NotNull] IFeatureClass featureClass,
            double tileSize,
            double maximumDistance)
        {
            var test = new QaMustBeNearOther(featureClass, new[] { featureClass },
                                             maximumDistance, null);
            var runner = new QaContainerTestRunner(tileSize, test);

            test.ErrorDistanceFormat = "{0:N2} m";

            return(runner);
        }
示例#3
0
        public void CanTestDefinedSmallPolySingleTile()
        {
            IFeatureClass fc = CreatePointClass(_testWs, "CanTestDefinedSmallPolySingleTile");

            AddPoints(fc);

            QaContainerTestRunner runner = CreateTestRunner(fc, 1000, 9.5);

            IEnvelope envelope = GeometryFactory.CreateEnvelope(10.5, 10.5, 11.5, 11.5);

            runner.Execute(GeometryFactory.CreatePolygon(envelope));

            Assert.AreEqual(0, runner.Errors.Count);
        }
示例#4
0
        public void CanTestDefinedExtentPartialLines()
        {
            IFeatureClass fc = CreateLineClass(_testWs, "CanTestDefinedExtentPartialLines");

            AddLines(fc);

            QaContainerTestRunner runner = CreateTestRunner(fc, 1000, 9.5);

            IEnvelope envelope = GeometryFactory.CreateEnvelope(9, 9, 20.5, 20.5);

            runner.Execute(GeometryFactory.CreatePolygon(envelope));

            Assert.AreEqual(0, runner.Errors.Count);
        }
示例#5
0
        public void CanReportManyErrors()
        {
            const string testName = "CanReportManyErrors";

            IFeatureClass nodeClass = CreateFeatureClass(string.Format("{0}_node", testName),
                                                         esriGeometryType.esriGeometryPoint);
            IFeatureClass nearClass = CreateFeatureClass(string.Format("{0}_near", testName),
                                                         esriGeometryType.esriGeometryPolyline);

            var nearClasses = new List <IFeatureClass> {
                nearClass
            };

            IFeature nodeRow = nodeClass.CreateFeature();

            nodeRow.Shape = GeometryFactory.CreatePoint(0, 0);
            nodeRow.Store();
            IFeature nodeRow1 = nodeClass.CreateFeature();

            nodeRow1.Shape = GeometryFactory.CreatePoint(4, 4);
            nodeRow1.Store();
            IFeature nodeRow2 = nodeClass.CreateFeature();

            nodeRow2.Shape = GeometryFactory.CreatePoint(1, 4);
            nodeRow2.Store();
            IFeature nodeRow3 = nodeClass.CreateFeature();

            nodeRow3.Shape = GeometryFactory.CreatePoint(5, 3);
            nodeRow3.Store();

            IFeature nearRow = nearClass.CreateFeature();

            nearRow.Shape = CurveConstruction.StartLine(1, 1)
                            .LineTo(2, 1)
                            .LineTo(3, 3)
                            .LineTo(1, 2)
                            .LineTo(1, 3)
                            .Curve;
            nearRow.Store();

            IEnvelope verificationEnvelope = GeometryFactory.CreateEnvelope(0, 0, 500, 500);

            var test = new QaNodeLineCoincidence(nodeClass, nearClasses, 4);

            var runner = new QaContainerTestRunner(1000, test);

            runner.Execute(verificationEnvelope);

            Assert.AreEqual(4, runner.Errors.Count);
        }
示例#6
0
        public void CanTestDefinedExtentMultipleTiles()
        {
            IFeatureClass fc = CreatePointClass(_testWs, "CanTestDefinedExtentMultipleTiles");

            AddPoints(fc);

            QaContainerTestRunner runner = CreateTestRunner(fc, 10, 9.5);

            IEnvelope envelope = GeometryFactory.CreateEnvelope(9, 9, 41, 41);

            runner.Execute(GeometryFactory.CreatePolygon(envelope));

            Assert.AreEqual(2, runner.Errors.Count);
        }
示例#7
0
        public void TestMultipart()
        {
            IFeatureWorkspace ws = TestWorkspaceUtils.CreateInMemoryWorkspace("Testmultipart");

            IFieldsEdit fields = new FieldsClass();

            fields.AddField(FieldUtils.CreateOIDField());
            fields.AddField(FieldUtils.CreateIntegerField("LineTyp", "LineTyp"));
            fields.AddField(FieldUtils.CreateShapeField(
                                "Shape", esriGeometryType.esriGeometryPolyline,
                                SpatialReferenceUtils.CreateSpatialReference
                                    ((int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95,
                                    true), 1000, false, false));

            IFeatureClass fc =
                DatasetUtils.CreateSimpleFeatureClass(ws, "TestConnections", fields,
                                                      null);
            IList <ITable> tbls = new[] { (ITable)fc };

            {
                IFeature row = fc.CreateFeature();
                row.set_Value(1, 1);
                row.Shape =
                    CurveConstruction.StartLine(1, 1).LineTo(2, 2).MoveTo(3, 2).LineTo(4, 2).Curve;
                row.Store();
            }
            {
                IFeature row = fc.CreateFeature();
                row.set_Value(1, 2);
                row.Shape =
                    CurveConstruction.StartLine(1, 5).LineTo(2, 2).Curve;
                row.Store();
            }

            IList <QaConnectionRule> rules = new List <QaConnectionRule>
            {
                new QaConnectionRule(tbls, new[] { "LineTyp = 1" }),
                new QaConnectionRule(tbls, new[] { "LineTyp = 2" })
            };
            var test = new QaConnections(new[] { fc }, rules, 0);

            test.UseMultiParts = false;
            var runner = new QaContainerTestRunner(1000, test);

            Assert.AreEqual(0, runner.Execute());

            test.UseMultiParts = true;
            runner             = new QaContainerTestRunner(1000, test);
            Assert.AreEqual(1, runner.Execute());
        }
示例#8
0
        public void CanReportErrorUseMultipleTolerancesInTileLeft()
        {
            const string testName = "CanReportErrorUseMultipleTolerancesInTileLeft";

            IFeatureClass nodeClass = CreateFeatureClass(string.Format("{0}_node", testName),
                                                         esriGeometryType.esriGeometryPoint);
            IFeatureClass nearClass = CreateFeatureClass(string.Format("{0}_near", testName),
                                                         esriGeometryType.esriGeometryPolyline);
            IFeatureClass nearClass1 = CreateFeatureClass(string.Format("{0}_near1", testName),
                                                          esriGeometryType.esriGeometryPolyline);

            var nearClasses = new List <IFeatureClass> {
                nearClass, nearClass1
            };

            IFeature nodeRow = nodeClass.CreateFeature();

            nodeRow.Shape = GeometryFactory.CreatePoint(201, 199);
            nodeRow.Store();

            IFeature nearRow = nearClass.CreateFeature();

            nearRow.Shape = CurveConstruction.StartLine(199, 198)
                            .LineTo(100, 100)
                            .Curve;
            nearRow.Store();

            IFeature nearRow1 = nearClass1.CreateFeature();

            nearRow1.Shape = CurveConstruction.StartLine(100, 205)
                             .LineTo(199, 199)
                             .LineTo(100, 103)
                             .Curve;
            nearRow1.Store();

            IEnvelope verificationEnvelope = GeometryFactory.CreateEnvelope(0, 0, 500, 500);

            var test = new QaNodeLineCoincidence(nodeClass, nearClasses,
                                                 new List <double> {
                2.0, 3.0
            }, 0, false, false);

            var runner = new QaContainerTestRunner(200, test);

            runner.Execute(verificationEnvelope);

            AssertUtils.OneError(runner,
                                 "NodeLineCoincidence.NodeTooCloseToLine.BetweenFeatures");
        }
        private static void TestGroupContraints(IFeatureWorkspace ws)
        {
            ITable tbl =
                DatasetUtils.CreateTable(ws, "TestGroupContraints",
                                         FieldUtils.CreateOIDField(),
                                         FieldUtils.CreateTextField("Kostenstelle", 20));

            // make sure the table is known by the workspace
            ((IWorkspaceEdit)ws).StartEditing(false);
            ((IWorkspaceEdit)ws).StopEditing(true);

            IRow row1 = tbl.CreateRow();

            row1.set_Value(1, "123456-10");
            row1.Store();

            IRow row2 = tbl.CreateRow();

            row2.set_Value(1, "123456-11");
            row2.Store();

            IRow row3 = tbl.CreateRow();

            row3.set_Value(1, "123456-11");
            row3.Store();

            IRow row4 = tbl.CreateRow();

            row4.set_Value(1, "023456-10");
            row4.Store();

            const bool limitToTestedRows = false;
            var        test = new QaGroupConstraints(tbl,
                                                     "IIF(LEN(Kostenstelle) >=6, SUBSTRING(Kostenstelle, 1, 6), '')",
                                                     "SUBSTRING(Kostenstelle, 8, 9)",
                                                     1,
                                                     limitToTestedRows);

            using (var runner = new QaTestRunner(test))
            {
                runner.Execute();
                Assert.AreEqual(1, runner.Errors.Count);
            }

            var containerRunner = new QaContainerTestRunner(100, test);

            containerRunner.Execute();
            Assert.AreEqual(1, containerRunner.Errors.Count);
        }
        public void CanDetectBorderGapBackslashed()
        {
            IFeatureClass fcArea1;
            IFeatureClass fcArea2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcArea1, out fcArea2, out fcBorder1, out fcBorder2);

            // border lines are not coincident
            AddLineFeature(fcBorder1, -2, 2, 1, -2, stateId: "A");
            AddLineFeature(fcBorder2, 1.01, -2, -1.99, 2, stateId: "B");

            AddFeature(fcArea1,
                       CurveConstruction.StartPoly(-2, 2)
                       .LineTo(1, -2)
                       .LineTo(-5, -10)
                       .ClosePolygon(), stateId: "A");                              // connected
            AddFeature(fcArea2,
                       CurveConstruction.StartPoly(1.01, -2)
                       .LineTo(-1.99, 2)
                       .LineTo(5, 10)
                       .ClosePolygon(), stateId: "B");                              // connected

            var test = new QaEdgeMatchCrossingAreas(fcArea1, fcBorder1,
                                                    fcArea2, fcBorder2,
                                                    searchDistance: 0.2,
                                                    boundingClasses1: null,
                                                    boundingClasses2: null)
            {
                AreaClass1BorderMatchCondition = "AREA.STATE = BORDER.STATE",
                AreaClass2BorderMatchCondition = "AREA.STATE = BORDER.STATE",
                CrossingAreaMatchCondition     = "AREA1.STATE <> AREA2.STATE"
            };

            AssertUtils.ExpectedErrors(3, Run(test, 1000));

            AssertUtils.ExpectedErrors(3, Run(test, 1));

            var runner = new QaContainerTestRunner(1, test)
            {
                KeepGeometry = true
            };

            runner.Execute(GeometryFactory.CreateEnvelope(-9, -4, 9, 8));
            AssertUtils.ExpectedErrors(3, runner.Errors);
        }
        public void TestTOP_4404()
        {
            var ws = (IFeatureWorkspace)
                     TestDataUtils.OpenPgdb("AVR_CH1903_LV03_original.mdb");
            IFeatureClass avr_lie = ws.OpenFeatureClass("avr_lie");
            IFeatureClass avr_gem = ws.OpenFeatureClass("avr_gem");

            var test = new QaPartCoincidenceOther(avr_lie, avr_gem,
                                                  0.02, 1, 0.1,
                                                  false, 5000, 0);

            test.SetConstraint(0, "ObjectId=2988");
            test.SetConstraint(1, "ObjectId=3");
            var runner = new QaContainerTestRunner(10000, test);

            runner.Execute();
        }
        public void CanDetectBorderGapVertical()
        {
            IFeatureClass fcArea1;
            IFeatureClass fcArea2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcArea1, out fcArea2, out fcBorder1, out fcBorder2);

            // border lines are not coincident
            AddLineFeature(fcBorder1, 0, 0, 0, 10, stateId: "A");
            AddLineFeature(fcBorder1, 0.7, -0.3, 10, -0.3, stateId: "A");
            AddLineFeature(fcBorder2, 0.3, 10, 0.3, 0, stateId: "B");
            AddLineFeature(fcBorder2, 10, 0, 0.7, 0, stateId: "B");

            AddAreaFeature(fcArea1, -10, 0, 0, 10, stateId: "A");             // connected
            AddAreaFeature(fcArea1, 0.7, -5, 10, -0.3, stateId: "A");         // connected
            AddAreaFeature(fcArea2, 0.3, 0, 10, 10, stateId: "B");            // connected

            var test = new QaEdgeMatchCrossingAreas(fcArea1, fcBorder1,
                                                    fcArea2, fcBorder2,
                                                    searchDistance: 0.5,
                                                    boundingClasses1: null,
                                                    boundingClasses2: null)
            {
                AreaClass1BorderMatchCondition = "AREA.STATE = BORDER.STATE",
                AreaClass2BorderMatchCondition = "AREA.STATE = BORDER.STATE",
                CrossingAreaMatchCondition     = "AREA1.STATE <> AREA2.STATE"
            };

            AssertUtils.ExpectedErrors(2, Run(test, 1000));

            AssertUtils.ExpectedErrors(2, Run(test, 3));

            var runner = new QaContainerTestRunner(3, test)
            {
                KeepGeometry = true
            };

            runner.Execute(GeometryFactory.CreateEnvelope(-9, -4, 9, 8));
            AssertUtils.ExpectedErrors(2, runner.Errors);
        }
        public void TestReportDuplicatesPairwise()
        {
            IFeatureClass featureClass = CreateLineFeatureClass(_testWs, "TestCombinedLists");

            // make sure the table is known by the workspace
            ((IWorkspaceEdit)_testWs).StartEditing(false);
            ((IWorkspaceEdit)_testWs).StopEditing(true);

            IPolycurve shape1 = CurveConstruction.StartLine(100, 0)
                                .LineTo(200, 0)
                                .Curve;

            IPolycurve shape2 = CurveConstruction.StartLine(200, 100)
                                .LineTo(300, 100)
                                .Curve;

            IPolycurve shape3 = CurveConstruction.StartLine(300, 200)
                                .LineTo(400, 200)
                                .Curve;

            AddFeature(featureClass, shape1);
            AddFeature(featureClass, shape2);
            AddFeature(featureClass, shape3);

            // first set of duplicates
            AddFeature(featureClass, shape1);
            AddFeature(featureClass, shape2);
            AddFeature(featureClass, shape3);

            // second set of duplicates
            AddFeature(featureClass, shape1);
            AddFeature(featureClass, shape2);
            AddFeature(featureClass, shape3);

            var test = new QaDuplicateGeometrySelf(featureClass, null, false);

            var testRunner = new QaContainerTestRunner(1000, test);

            testRunner.Execute();

            Assert.AreEqual(9, testRunner.Errors.Count);
        }
        private static IList <QaError> Execute(double tileSize)
        {
            var    locator = TestDataUtils.GetTestDataLocator();
            string path    = locator.GetPath("QaPartCoincidenceVolumeTest.mdb");

            IFeatureWorkspace ws = WorkspaceUtils.OpenPgdbFeatureWorkspace(path);

            IFeatureClass featureClass = ws.OpenFeatureClass("BigPolygons");

            var test   = new QaPartCoincidenceSelf(featureClass, 10, 40, false);
            var runner = new QaContainerTestRunner(tileSize, test);

            IEnvelope box = new EnvelopeClass();

            box.PutCoords(2480190, 1134100, 2497430, 1140500);

            runner.Execute(box);

            return(runner.Errors);
        }
示例#15
0
        public void CanTestCircle()
        {
            IFeatureClass fc = CreateLineClass(_testWs, "CanTestCircle");

            IFeature row1 = fc.CreateFeature();

            IConstructCircularArc arc = new CircularArcClass();

            arc.ConstructCircle(GeometryFactory.CreatePoint(0, 0, 0), 3, false);

            row1.Shape = CreatePolyLine((ISegment)arc);
            row1.Store();

            var test = new QaMinSegAngle(fc, 0.1, true);

            var runner = new QaContainerTestRunner(1000, test);

            runner.Execute();

            Assert.AreEqual(0, runner.Errors.Count);
        }
示例#16
0
        public void CanTestEllipticArc()
        {
            IFeatureClass fc = CreateLineClass(_testWs, "CanTestEllipticArc");

            IFeature row1 = fc.CreateFeature();

            IConstructEllipticArc arc = new EllipticArcClass();

            arc.ConstructEnvelope(GeometryFactory.CreateEnvelope(0, 0, 100, 10));

            row1.Shape = CreatePolyLine((ISegment)arc);
            row1.Store();

            var test = new QaMinSegAngle(fc, 0.1, true);

            var runner = new QaContainerTestRunner(1000, test);

            runner.Execute();

            Assert.AreEqual(0, runner.Errors.Count);
        }
        public void CanReportPointZError()
        {
            const string testName = "CanReportPointZError";

            IFeatureClass vertexClass = CreateFeatureClass(
                $"{testName}_vertex", esriGeometryType.esriGeometryPoint, zAware: true);

            IFeature vertexRow = vertexClass.CreateFeature();

            vertexRow.Shape = GeometryFactory.CreatePoint(199, 199, 10);
            vertexRow.Store();

            vertexRow       = vertexClass.CreateFeature();
            vertexRow.Shape = GeometryFactory.CreatePoint(199, 199, 11);
            vertexRow.Store();

            vertexRow       = vertexClass.CreateFeature();
            vertexRow.Shape = GeometryFactory.CreatePoint(150, 150, 10);
            vertexRow.Store();
            vertexRow       = vertexClass.CreateFeature();
            vertexRow.Shape =
                GeometryFactory.CreatePoint(150, 150, 13);                 // dz > ZTolerance
            vertexRow.Store();

            IEnvelope verificationEnvelope =
                GeometryFactory.CreateEnvelope(0, 0, 500, 500);

            var test = new QaVertexCoincidenceSelf(vertexClass)
            {
                PointTolerance        = 3,
                ZTolerance            = 2,
                ZCoincidenceTolerance = -1
            };

            var runner = new QaContainerTestRunner(500, test);

            runner.Execute(verificationEnvelope);

            Assert.AreEqual(1, runner.Errors.Count);
        }
示例#18
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);
        }
        public void CanReportNearlyCoincidentSectionErrorInLeftTile()
        {
            const string testName = "CanReportNearlyCoincidentSectionErrorInLeftTile";

            IFeatureClass testedClass =
                CreateFeatureClass(string.Format("{0}_tested", testName),
                                   esriGeometryType.esriGeometryPolyline);
            IFeatureClass referenceClass =
                CreateFeatureClass(string.Format("{0}_reference", testName),
                                   esriGeometryType.esriGeometryPolyline);

            IFeature testedRow = testedClass.CreateFeature();

            testedRow.Shape =
                CurveConstruction.StartLine(201, 150)
                .LineTo(201, 50)
                .Curve;
            testedRow.Store();

            IFeature referenceRow = referenceClass.CreateFeature();

            referenceRow.Shape =
                CurveConstruction.StartLine(199, 150)
                .LineTo(199, 50)
                .Curve;
            referenceRow.Store();

            IEnvelope verificationEnvelope =
                GeometryFactory.CreateEnvelope(0, 0, 500, 500);

            var test = new QaPartCoincidenceOther(testedClass, referenceClass, 3, 50);

            var runner = new QaContainerTestRunner(200, test);

            runner.Execute(verificationEnvelope);

            AssertUtils.OneError(runner,
                                 "NearCoincidence.NearlyCoincidentSection.BetweenFeatures");
        }
示例#20
0
        public void TestTopgisTMultiPatches()
        {
            IWorkspace workspace = TestDataUtils.OpenTopgisTlm();

            IFeatureClass gebaeude =
                ((IFeatureWorkspace)workspace).OpenFeatureClass(
                    "TOPGIS_TLM.TLM_GEBAEUDE");
            var tests = new ITest[]
            {
                //			                    new QaSegmentLength(gebaeude, 0.1),
                //			                    new QaSliverPolygon(gebaeude, 50),
                //			                    new QaCoplanarRings(gebaeude, 0, false),
                new QaMpFootprintHoles(gebaeude, InnerRingHandling.IgnoreInnerRings)
            };
            var runner = new QaContainerTestRunner(10000, tests);

            runner.LogErrors = false;

            runner.Execute();

            Console.WriteLine(runner.Errors.Count);
        }
        public void CanTestVertexNotNearFaceAboveHorizontal()
        {
            IFeatureClass fc =
                CreateFeatureClass(_testWs, "CanTestVertexNotNearFaceHorizontal");

            var construction = new MultiPatchConstruction();

            construction.StartOuterRing(0, 0, 10)
            .Add(0, 10, 10)
            .Add(10, 10, 10)
            .Add(10, 0, 10);
            IFeature row1 = fc.CreateFeature();

            row1.Shape = construction.MultiPatch;
            row1.Store();

            construction = new MultiPatchConstruction();
            construction.StartOuterRing(5, 5, 10.1)
            .Add(15, 5, 15.1)
            .Add(15, 15, 20.1)
            .Add(5, 15, 15.1);
            IFeature row2 = fc.CreateFeature();

            row2.Shape = construction.MultiPatch;
            row2.Store();

            ((IWorkspaceEdit)_testWs).StopEditing(true);

            var test = new QaMpVertexNotNearFace(fc, new[] { fc }, 0.2, 0)
            {
                VerifyWithinFeature = false,
                MinimumSlopeDegrees = 0
            };

            var runner = new QaContainerTestRunner(10000, test);

            runner.Execute();
            Assert.AreEqual(1, runner.Errors.Count);
        }
示例#22
0
        public void CanReportVertexInLeftTileByNearDistance()
        {
            const string testName = "CanReportVertexInLeftTileByNearDistance";

            IFeatureClass nodeClass = CreateFeatureClass(string.Format("{0}_node", testName),
                                                         esriGeometryType.esriGeometryPoint);
            IFeatureClass nearClass = CreateFeatureClass(string.Format("{0}_near", testName),
                                                         esriGeometryType.esriGeometryPolyline);

            var nearClasses = new List <IFeatureClass> {
                nearClass
            };

            IFeature nodeRow = nodeClass.CreateFeature();

            nodeRow.Shape = GeometryFactory.CreatePoint(201, 100);
            nodeRow.Store();

            IFeature nearRow = nearClass.CreateFeature();

            nearRow.Shape = CurveConstruction.StartLine(100, 100)
                            .LineTo(100, 199)
                            .LineTo(199, 199)
                            .LineTo(199, 100)
                            .Curve;
            nearRow.Store();

            IEnvelope verificationEnvelope = GeometryFactory.CreateEnvelope(0, 0, 500, 500);

            var test = new QaNodeLineCoincidence(nodeClass, nearClasses, 2.1);

            var runner = new QaContainerTestRunner(200, test);

            runner.Execute(verificationEnvelope);

            AssertUtils.OneError(runner,
                                 "NodeLineCoincidence.NodeTooCloseToLine.BetweenFeatures");
        }
示例#23
0
        public void CanAllowVertexWithinCoincidenceTolerance()
        {
            const string testName = "CanAllowVertexWithinCoincidenceTolerance";

            IFeatureClass nodeClass = CreateFeatureClass(string.Format("{0}_node", testName),
                                                         esriGeometryType.esriGeometryPoint);
            IFeatureClass nearClass = CreateFeatureClass(string.Format("{0}_near", testName),
                                                         esriGeometryType.esriGeometryPolyline);

            var nearClasses = new List <IFeatureClass> {
                nearClass
            };

            IFeature nodeRow = nodeClass.CreateFeature();

            nodeRow.Shape = GeometryFactory.CreatePoint(1, 0.1);
            nodeRow.Store();

            IFeature nearRow = nearClass.CreateFeature();

            nearRow.Shape = CurveConstruction.StartLine(0, 0)
                            .LineTo(2, 0)
                            .Curve;
            nearRow.Store();

            IEnvelope verificationEnvelope = GeometryFactory.CreateEnvelope(0, 0, 500, 500);

            var test = new QaNodeLineCoincidence(nodeClass, nearClasses, 2)
            {
                CoincidenceTolerance = 0.2
            };

            var runner = new QaContainerTestRunner(1000, test);

            runner.Execute(verificationEnvelope);

            AssertUtils.NoError(runner);
        }
示例#24
0
        public void CanReportWithinFeature()
        {
            const string testName = "CanReportWithinFeature";

            IFeatureClass lineClass = CreateFeatureClass(string.Format("{0}_near", testName),
                                                         esriGeometryType.esriGeometryPolyline);

            var nearClasses = new List <IFeatureClass> {
                lineClass
            };

            IPolycurve multipartLine = CurveConstruction.StartLine(0, 0)
                                       .LineTo(100, 0)
                                       .LineTo(101, 0)
                                       .LineTo(100, 0)
                                       .LineTo(100, 100)
                                       .Curve;

            GeometryUtils.Simplify(multipartLine, true, true);

            IFeature nearRow = lineClass.CreateFeature();

            nearRow.Shape = multipartLine;
            nearRow.Store();

            IEnvelope verificationEnvelope = GeometryFactory.CreateEnvelope(0, 0, 500, 500);

            var test = new QaNodeLineCoincidence(lineClass, nearClasses, 2);

            var runner = new QaContainerTestRunner(200, test);

            runner.Execute(verificationEnvelope);

            AssertUtils.ExpectedErrors(2, runner.Errors,
                                       "NodeLineCoincidence.NodeTooCloseToLine.WithinFeature");
        }
示例#25
0
        public void TestRealDataF5()
        {
            //          <CoveringFeatureSet name="Kanton Luzern Buffer 10m" whereClause="OBJECTID = 1">
            //<FeatureClass catalogPath=@"D:\git\ebp-far\CtLU.ProSuite\CtLU.ProSuite\src\CtLU.GDM.Services.Test\TestData\QA_Rules.mdb\Kanton_Luzern_Buffer_00010m" />

            IWorkspace    coverWs = TestDataUtils.OpenPgdb("validfields.mdb");
            IFeatureClass covers  =
                ((IFeatureWorkspace)coverWs).OpenFeatureClass("Kanton_Luzern_Buffer_00010m");

            IWorkspace withinWs =
                TestDataUtils.OpenPgdb("20111201_Produkte_SDE_zALL_bereinigt.mdb");
            IFeatureClass within =
                ((IFeatureWorkspace)withinWs).OpenFeatureClass("GEO_00100420001");

            var test = new QaContainsOther(covers, within);

            test.SetConstraint(0, "OBJECTID = 1");
            test.SetConstraint(1, "OBJECTID = 69157");

            var ctr = new QaContainerTestRunner(10000, test);

            ctr.Execute();
            Assert.AreEqual(0, ctr.Errors.Count);
        }
示例#26
0
        public void CanTestByPoints()
        {
            IFeatureClass fc = CreateLineClass(_testWs, "CanTestByPoints");

            IFeature row1 = fc.CreateFeature();

            row1.Shape =
                CurveConstruction.StartLine(0, 0, 0)
                .LineTo(0, 1, 0)
                .LineTo(0.1, 0, 0)
                .LineTo(0.1, 1, 100)
                .LineTo(0.1, 2, 100)
                .CircleTo(GeometryFactory.CreatePoint(0.2, 0, 100))
                .Curve;
            row1.Store();

            var test = new QaMinSegAngle(fc, 0.1, true);

            var runner = new QaContainerTestRunner(1000, test);

            runner.Execute();

            Assert.AreEqual(2, runner.Errors.Count);
        }
        private static void TestRelGroupContraints(IFeatureWorkspace ws)
        {
            ITable tableData =
                DatasetUtils.CreateTable(ws, "TblData1",
                                         FieldUtils.CreateOIDField(),
                                         FieldUtils.CreateField("GroupField",
                                                                esriFieldType
                                                                .esriFieldTypeInteger));

            ITable tableRel = DatasetUtils.CreateTable(ws, "TblRel1",
                                                       FieldUtils.CreateOIDField(),
                                                       FieldUtils.CreateTextField(
                                                           "Kostenstelle", 20));

            IRelationshipClass rel = TestWorkspaceUtils.CreateSimple1NRelationship(
                ws, "rel", tableRel, tableData, "ObjectId", "GroupField");

            // make sure the table is known by the workspace
            ((IWorkspaceEdit)ws).StartEditing(false);
            ((IWorkspaceEdit)ws).StopEditing(true);

            for (int i = 0; i < 20; i++)
            {
                IRow row = tableData.CreateRow();
                row.set_Value(1, 1);
                row.Store();
            }

            for (int i = 0; i < 40; i++)
            {
                IRow row = tableData.CreateRow();
                row.set_Value(1, 2);
                row.Store();
            }

            for (int i = 0; i < 30; i++)
            {
                IRow row = tableData.CreateRow();
                row.set_Value(1, 3);
                row.Store();
            }

            IRow row1 = tableRel.CreateRow();

            row1.set_Value(1, "123456-10");
            row1.Store();

            IRow row2 = tableRel.CreateRow();

            row2.set_Value(1, "123456-11");
            row2.Store();

            IRow row3 = tableRel.CreateRow();

            row3.set_Value(1, "123456-12");
            row3.Store();

            const bool limitToTestedRows = false;
            ITable     relTab            = TableJoinUtils.CreateQueryTable(rel, JoinType.InnerJoin);

            var test = new QaGroupConstraints(relTab,
                                              "IIF(LEN(TblRel1.Kostenstelle) >=6, SUBSTRING(TblRel1.Kostenstelle, 1, 6), '')",
                                              "SUBSTRING(TblRel1.Kostenstelle, 8, 9)", 1,
                                              limitToTestedRows);

            test.SetRelatedTables(new[] { tableData, tableRel });
            using (var runner = new QaTestRunner(test))
            {
                runner.Execute();
                Assert.AreEqual(1, runner.Errors.Count);
            }

            var containerRunner = new QaContainerTestRunner(100, test);

            containerRunner.Execute();
            Assert.AreEqual(1, containerRunner.Errors.Count);
        }
        private static void TestGeomGroupConstraints(IFeatureWorkspace ws)
        {
            IFieldsEdit fields = new FieldsClass();

            fields.AddField(FieldUtils.CreateOIDField());
            fields.AddField(FieldUtils.CreateTextField("Kostenstelle", 20));
            fields.AddField(FieldUtils.CreateShapeField(
                                "Shape", esriGeometryType.esriGeometryPoint,
                                SpatialReferenceUtils.CreateSpatialReference
                                    ((int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95,
                                    true), 1000, false, false));

            IFeatureClass fc =
                DatasetUtils.CreateSimpleFeatureClass(ws, "TestGeomGroupContraints",
                                                      fields,
                                                      null);

            // make sure the table is known by the workspace
            ((IWorkspaceEdit)ws).StartEditing(false);
            ((IWorkspaceEdit)ws).StopEditing(true);

            IFeature row1 = fc.CreateFeature();

            row1.set_Value(1, "123456-10");
            row1.Shape = GeometryFactory.CreatePoint(200, 100);
            row1.Store();

            IFeature row2 = fc.CreateFeature();

            row2.set_Value(1, "123456-11");
            row2.Shape = GeometryFactory.CreatePoint(200, 200);
            row2.Store();

            IFeature row3 = fc.CreateFeature();

            row3.set_Value(1, "123456-11");
            row3.Shape = GeometryFactory.CreatePoint(200, 300);
            row3.Store();

            IFeature row4 = fc.CreateFeature();

            row4.set_Value(1, "023456-10");
            row4.Shape = GeometryFactory.CreatePoint(200, 150);
            row4.Store();

            const bool limitToTestedRows = false;
            var        test = new QaGroupConstraints((ITable)fc,
                                                     "IIF(LEN(Kostenstelle) >=6, SUBSTRING(Kostenstelle, 1, 6), '')",
                                                     "SUBSTRING(Kostenstelle, 8, 9)", 1,
                                                     limitToTestedRows);

            {
                IEnvelope box = GeometryFactory.CreateEnvelope(150, 120, 250, 170);
                using (var runner = new QaTestRunner(test))
                {
                    runner.Execute(box);
                    Assert.AreEqual(0, runner.Errors.Count);
                }

                var containerRunner = new QaContainerTestRunner(100, test);
                containerRunner.Execute(box);
                Assert.AreEqual(0, containerRunner.Errors.Count);
            }
            {
                IEnvelope box = GeometryFactory.CreateEnvelope(150, 80, 250, 170);
                using (var runner = new QaTestRunner(test))
                {
                    runner.Execute(box);
                    Assert.AreEqual(1, runner.Errors.Count);
                }

                var containerRunner = new QaContainerTestRunner(100, test);
                containerRunner.Execute(box);
                Assert.AreEqual(1, containerRunner.Errors.Count);
            }
            {
                IEnvelope box = GeometryFactory.CreateEnvelope(150, 80, 250, 220);
                using (var runner = new QaTestRunner(test))
                {
                    runner.Execute(box);
                    Assert.AreEqual(1, runner.Errors.Count);
                }

                var containerRunner = new QaContainerTestRunner(100, test);
                containerRunner.Execute(box);
                Assert.AreEqual(1, containerRunner.Errors.Count);
            }

            {
                IRow row = fc.GetFeature(1);
                using (var runner = new QaTestRunner(test))
                {
                    runner.Execute(row);
                    Assert.AreEqual(1, runner.Errors.Count);
                }

                //var containerRunner = new QaContainerTestRunner(100, test);
                //containerRunner.Execute(row);
                //Assert.AreEqual(1, containerRunner.Errors.Count);
            }
            {
                IRow row = fc.GetFeature(4);
                using (var runner = new QaTestRunner(test))
                {
                    runner.Execute(row);
                    Assert.AreEqual(0, runner.Errors.Count);
                }

                //var containerRunner = new QaContainerTestRunner(100, test);
                //containerRunner.Execute(row);
                //Assert.AreEqual(1, containerRunner.Errors.Count);
            }

            {
                IQueryFilter filter = new QueryFilterClass {
                    WhereClause = "ObjectId < 3"
                };
                ISelectionSet set = fc.Select(
                    filter, esriSelectionType.esriSelectionTypeIDSet,
                    esriSelectionOption.esriSelectionOptionNormal, null);
                using (var runner = new QaTestRunner(test))
                {
                    runner.Execute(new EnumCursor(set, null, false));
                    Assert.AreEqual(1, runner.Errors.Count);
                }

                var containerRunner = new QaContainerTestRunner(100, test);
                containerRunner.Execute(new[] { set });
                Assert.AreEqual(1, containerRunner.Errors.Count);
            }

            {
                IQueryFilter filter = new QueryFilterClass {
                    WhereClause = "ObjectId > 3"
                };
                ISelectionSet set = fc.Select(
                    filter, esriSelectionType.esriSelectionTypeIDSet,
                    esriSelectionOption.esriSelectionOptionNormal, null);
                using (var runner = new QaTestRunner(test))
                {
                    runner.Execute(new EnumCursor(set, null, false));
                    Assert.AreEqual(0, runner.Errors.Count);
                }

                var containerRunner = new QaContainerTestRunner(100, test);
                containerRunner.Execute(new[] { set });
                Assert.AreEqual(0, containerRunner.Errors.Count);
            }
        }
        public void CanReportLineZError()
        {
            const string testName = "CanReportLineZError";

            IFeatureClass vertexClass = CreateFeatureClass(
                $"{testName}_line", esriGeometryType.esriGeometryPolyline, zAware: true);

            IFeature vertexRow = vertexClass.CreateFeature();

            vertexRow.Shape = CurveConstruction.StartLine(10, 10, 10)
                              .LineTo(100, 10, 10)
                              .Curve;
            vertexRow.Store();

            vertexRow       = vertexClass.CreateFeature();
            vertexRow.Shape = CurveConstruction.StartLine(100, 20, 10)
                              .LineTo(100, 10, 8)
                              .Curve;
            vertexRow.Store();

            vertexRow       = vertexClass.CreateFeature();
            vertexRow.Shape = CurveConstruction.StartLine(10, 50, 10)
                              .LineTo(50, 50, 10)
                              .LineTo(100, 50, 10)
                              .LineTo(50, 40, 10)
                              .LineTo(50, 50, 8)
                              .LineTo(50, 60, 10).Curve;
            vertexRow.Store();

            vertexRow       = vertexClass.CreateFeature();
            vertexRow.Shape = CurveConstruction.StartLine(30, 60, 10)
                              .LineTo(30, 50, 10)
                              .LineTo(30, 10, 8)
                              .LineTo(30, 5, 0).Curve;
            vertexRow.Store();

            vertexRow       = vertexClass.CreateFeature();
            vertexRow.Shape = CurveConstruction.StartLine(10, 80, 10)
                              .LineTo(100, 80, 10)
                              .LineTo(50, 70, 10)
                              .LineTo(50, 80, 8).Curve;
            vertexRow.Store();

            //vertexRow = vertexClass.CreateFeature();
            //vertexRow.Shape =
            //	GeometryFactory.CreatePoint(150, 150, 10);
            //vertexRow.Store();
            //vertexRow = vertexClass.CreateFeature();
            //vertexRow.Shape =
            //	GeometryFactory.CreatePoint(150, 150, 13); // dz > ZTolerance
            //vertexRow.Store();

            IEnvelope verificationEnvelope =
                GeometryFactory.CreateEnvelope(0, 0, 500, 500);

            var test = new QaVertexCoincidenceSelf(vertexClass)
            {
                PointTolerance            = 3,
                ZTolerance                = -1,
                ZCoincidenceTolerance     = -1,
                EdgeTolerance             = 0.001,
                RequireVertexOnNearbyEdge = false,
                VerifyWithinFeature       = true
            };

            var runner = new QaContainerTestRunner(500, test);

            runner.Execute(verificationEnvelope);

            Assert.AreEqual(4, runner.Errors.Count);
        }
示例#30
0
        private static void TestTileBorder(IFeatureWorkspace ws)
        {
            ISpatialReference sr = SpatialReferenceUtils.CreateSpatialReference
                                       ((int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95, true);

            IFieldsEdit fieldsPoint = new FieldsClass();

            fieldsPoint.AddField(FieldUtils.CreateOIDField());
            fieldsPoint.AddField(FieldUtils.CreateShapeField(
                                     "Shape", esriGeometryType.esriGeometryPoint, sr, 1000));

            IFeatureClass fcPoints =
                DatasetUtils.CreateSimpleFeatureClass(ws, "TileBorderPoints", fieldsPoint);

            IFieldsEdit fieldsLine = new FieldsClass();

            fieldsLine.AddField(FieldUtils.CreateOIDField());
            fieldsLine.AddField(FieldUtils.CreateShapeField(
                                    "Shape", esriGeometryType.esriGeometryPolyline, sr, 1000));

            IFeatureClass fcLines =
                DatasetUtils.CreateSimpleFeatureClass(ws, "TileBorderLines", fieldsLine);

            // make sure the table is known by the workspace
            ((IWorkspaceEdit)ws).StartEditing(false);
            ((IWorkspaceEdit)ws).StopEditing(true);

            IFeature point1 = fcPoints.CreateFeature();

            point1.Shape = GeometryFactory.CreatePoint(999.5, 100);
            // near fLine1, but error from tile 2 ?
            point1.Store();

            IFeature point2 = fcPoints.CreateFeature();

            point2.Shape = GeometryFactory.CreatePoint(999.5, 400);
            // near fLine2, but error from tile 1 ?
            point2.Store();

            IFeature   fLine1 = fcLines.CreateFeature();
            IPolycurve l1     = CurveConstruction.StartLine(0, 10)
                                .LineTo(998.7, 10)
                                .LineTo(998.7, 200)
                                .Curve;

            fLine1.Shape = l1;
            fLine1.Store();

            IFeature   fLine2 = fcLines.CreateFeature();
            IPolycurve l2     = CurveConstruction.StartLine(2000, 500)
                                .LineTo(1000.3, 500)
                                .LineTo(1000.3, 300)
                                .Curve;

            fLine2.Shape = l2;
            fLine2.Store();

            var test = new QaPointOnLine(fcPoints, new[] { fcLines }, 1);

            using (var r = new QaTestRunner(test))             // no tiling no problem
            {
                r.Execute();
                Assert.AreEqual(0, r.Errors.Count);
            }

            var container = new QaContainerTestRunner(1000, test);

            container.Execute(GeometryFactory.CreateEnvelope(0, 0, 2000, 500));
            Assert.AreEqual(0, container.Errors.Count);
        }