public void SetupFixture()
        {
            _lic.Checkout();

            _testWs =
                TestWorkspaceUtils.CreateInMemoryWorkspace("QaVertexCoincidenceSelfTest");
        }
Example #2
0
        public void MultipartTest()
        {
            IFeatureWorkspace workspace =
                TestWorkspaceUtils.CreateInMemoryWorkspace("MultipartTest");

            IFieldsEdit fields = new FieldsClass();

            fields.AddField(FieldUtils.CreateOIDField());
            fields.AddField(FieldUtils.CreateShapeField(
                                "Shape", esriGeometryType.esriGeometryPolyline, CreateLV95(),
                                1000));

            IFeatureClass linesFc = DatasetUtils.CreateSimpleFeatureClass(workspace, "Flow",
                                                                          fields);

            AddFeature(
                linesFc,
                CurveConstruction.StartLine(0, 0).LineTo(4, 0).MoveTo(6, 0).LineTo(6, 10).Curve);
            AddFeature(linesFc, CurveConstruction.StartLine(4, 0).LineTo(6, 0).Curve);

            AddFeature(linesFc, CurveConstruction.StartLine(0, 20).LineTo(4, 20).Curve);

            AddFeature(
                linesFc,
                CurveConstruction.StartLine(0, 30).LineTo(4, 30).MoveTo(0, 32).LineTo(4, 30)
                .MoveTo(4, 30).LineTo(8, 30).Curve);

            // expect counter-clockwise: 0 errors
            var runner = new QaContainerTestRunner(
                1000, new QaFlowLogic(linesFc));

            Assert.AreEqual(3, runner.Execute());
        }
Example #3
0
        public void SetupFixture()
        {
            _lic.Checkout();

            _featureWorkspace = TestWorkspaceUtils.CreateInMemoryWorkspace(
                "EqualFieldValuesConditionTest");
        }
Example #4
0
        public void SetupFixture()
        {
            _lic.Checkout();

            _testWs = TestWorkspaceUtils.CreateInMemoryWorkspace(
                "QaNodeLineCoincidenceTest");
        }
        public void SetupFixture()
        {
            _lic.Checkout();

            _testWs =
                TestWorkspaceUtils.CreateInMemoryWorkspace("QaMpVertexNotNearFaceTest");
        }
Example #6
0
        public void CanTestLoopEndPoints()
        {
            IFeatureWorkspace ws =
                TestWorkspaceUtils.CreateInMemoryWorkspace("CanTestLoopEndPoints");
            IFeatureClass fc = CreateLineClass(ws);

            IFeature row1 = fc.CreateFeature();

            row1.Shape =
                CurveConstruction.StartLine(0, 0).LineTo(1, 1).LineTo(1, 0).LineTo(0, 0).Curve;
            row1.set_Value(fc.Fields.FindField(_nrFieldName), 1);
            row1.Store();

            var test = new QaPseudoNodes(fc, new string[] { });

            var runner = new QaTestRunner(test);

            runner.Execute();
            Assert.AreEqual(1, runner.Errors.Count);

            test.IgnoreLoopEndpoints = true;
            runner = new QaTestRunner(test);
            runner.Execute();
            Assert.AreEqual(0, runner.Errors.Count);
        }
Example #7
0
        public void MultipartTest()
        {
            IFeatureWorkspace workspace =
                TestWorkspaceUtils.CreateInMemoryWorkspace("MultipartTest");

            IFieldsEdit fields = new FieldsClass();

            fields.AddField(FieldUtils.CreateOIDField());
            fields.AddField(FieldUtils.CreateShapeField(
                                "Shape", esriGeometryType.esriGeometryPolyline, CreateLV95(),
                                1000));

            IFeatureClass featureClass = DatasetUtils.CreateSimpleFeatureClass(
                workspace, "Border", fields);

            AddFeature(featureClass,
                       CurveConstruction.StartLine(0, 0).LineTo(4, 0).MoveTo(6, 0).LineTo(6, 10)
                       .Curve);
            AddFeature(featureClass, CurveConstruction.StartLine(6, 10).LineTo(4, 10).Curve);
            AddFeature(featureClass,
                       CurveConstruction.StartLine(4, 0).LineTo(6, 0).MoveTo(4, 10).LineTo(0, 0)
                       .Curve);

            // expect counter-clockwise: 0 errors
            var runnerCounterClockwise = new QaContainerTestRunner(
                1000, new QaBorderSense(featureClass, false));

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

            // expect clockwise: 1 error
            var runnerClockwise = new QaContainerTestRunner(
                1000, new QaBorderSense(featureClass, true));

            Assert.AreEqual(1, runnerClockwise.Execute());
        }
Example #8
0
        public void CanTestPseudoNodesFactory()
        {
            IFeatureWorkspace ws =
                TestWorkspaceUtils.CreateInMemoryWorkspace("CanTestPseudoNodes");
            IFeatureClass fc = CreateLineClass(ws);

            IFeature row1 = fc.CreateFeature();

            row1.Shape =
                CurveConstruction.StartLine(0, 0).LineTo(1, 1).LineTo(1, 0).LineTo(0, 0).Curve;
            row1.set_Value(fc.Fields.FindField(_nrFieldName), 1);
            row1.Store();

            var ds1 = (IDataset)fc;

            var     model = new SimpleModel("model", fc);
            Dataset mds1  = model.AddDataset(new ModelVectorDataset(ds1.Name));

            var clsDesc   = new ClassDescriptor(typeof(QaFactoryPseudoNodes));
            var tstDesc   = new TestDescriptor("GroupEnds", clsDesc);
            var condition = new QualityCondition("cndPseudoNodes", tstDesc);

            QualityConditionParameterUtils.AddParameterValue(
                condition, QaFactoryPseudoNodes.PolylineClassesParam, mds1);
            QualityConditionParameterUtils.AddParameterValue(
                condition, QaFactoryPseudoNodes.IgnoreFieldsParam, _nrFieldName);
            QualityConditionParameterUtils.AddParameterValue(
                condition, QaFactoryPseudoNodes.IgnoreFieldsParam,
                QaFactoryPseudoNodes.EndLayerFields);
            // implicit: ignoreLoopEndPoints = false

            var fact = new QaFactoryPseudoNodes();

            fact.Condition = condition;

            IList <ITest> tests =
                fact.CreateTests(new SimpleDatasetOpener(model.MasterDatabaseWorkspaceContext));

            Assert.AreEqual(1, tests.Count);

            ITest test   = tests[0];
            var   runner = new QaTestRunner(test);

            runner.Execute();
            Assert.AreEqual(1, runner.Errors.Count);

            // set ignoreLoopEndPoints = true and rerun
            QualityConditionParameterUtils.AddParameterValue(
                condition, QaFactoryPseudoNodes.IgnoreLoopEndPointsParam, true);
            fact.Condition = condition;

            tests = fact.CreateTests(new SimpleDatasetOpener(model.MasterDatabaseWorkspaceContext));
            Assert.AreEqual(1, tests.Count);

            test   = tests[0];
            runner = new QaTestRunner(test);
            runner.Execute();
            Assert.AreEqual(0, runner.Errors.Count);
        }
        public void SetupFixture()
        {
            _lic.Checkout();

            _spatialReference = CreateLV95();
            _testWs           = TestWorkspaceUtils.CreateInMemoryWorkspace(
                "QaRegularExpressionTest");
        }
        public void SetupFixture()
        {
            _lic.Checkout();

            _spatialReference = CreateLV95();
            _featureWorkspace = TestWorkspaceUtils.CreateInMemoryWorkspace(
                "QaEdgeMatchCrossingAreasTest");
        }
Example #11
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());
        }
Example #12
0
        public void TestStringsWithNulls()
        {
            Console.WriteLine(@"In Memory Gdb");
            TestStringsWithNulls(
                TestWorkspaceUtils.CreateInMemoryWorkspace("TestStringsWithNulls"));
            Console.WriteLine(@"-----------------");

            Console.WriteLine(@"FileGdb");
            TestStringsWithNulls(_fgdbWorkspace);
            Console.WriteLine(@"-----------------");

            Console.WriteLine(@"Personal Gdb");
            TestStringsWithNulls(_pgdbWorkspace);
            Console.WriteLine(@"-----------------");
        }
        public void TestExcludedFields()
        {
            IFeatureWorkspace initTestWs = _testWs;

            try
            {
                _testWs = TestWorkspaceUtils.CreateInMemoryWorkspace("QaRegularExpression");

                IFieldsEdit fields = new FieldsClass();
                fields.AddField(FieldUtils.CreateOIDField());
                fields.AddField(FieldUtils.CreateIntegerField(_fkFieldName));
                fields.AddField(FieldUtils.CreateTextField(_textFieldName, 200));
                fields.AddField(FieldUtils.CreateTextField(_textFieldName2, 200));

                const string tableName = "RegEx_table_excluded";
                ITable       table     =
                    TestWorkspaceUtils.CreateSimpleTable(_testWs, tableName, fields);

                ((IWorkspaceEdit)_testWs).StartEditing(false);

                AddRow(table, textFieldValue: "A", textFieldValue2: "X");
                AddRow(table, textFieldValue: "B", textFieldValue2: "X");
                AddRow(table, textFieldValue: "A", textFieldValue2: "X");

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

                var test =
                    new QaRegularExpression(table, "A", _textFieldName2)
                {
                    FieldListType = FieldListType.IgnoredFields
                };

                IList <QaError> errors = Run(test, 1000);
                AssertErrors(1, errors);

                IList <InvolvedRow> involvedRows = errors[0].InvolvedRows;
                Assert.AreEqual(1, involvedRows.Count);
                Assert.AreEqual($"{_textFieldName}", errors[0].AffectedComponent);
                Assert.AreEqual("RegularExpression.FieldValueDoesNotMatchRegularExpression",
                                errors[0].IssueCode?.ID);
            }
            finally
            {
                _testWs = initTestWs;
            }
        }
Example #14
0
        public void SetupFixture()
        {
            _lic.Checkout();

            _testWs = TestWorkspaceUtils.CreateInMemoryWorkspace("QaMinSegAngleTest");
        }
        public void CanIgnoreArea()
        {
            IFeatureWorkspace ws = TestWorkspaceUtils.CreateInMemoryWorkspace("ignoreArea");

            IFieldsEdit fields = new FieldsClass();

            fields.AddField(FieldUtils.CreateOIDField());
            fields.AddField(FieldUtils.CreateField("Objektart",
                                                   esriFieldType.esriFieldTypeInteger));
            fields.AddField(FieldUtils.CreateShapeField(
                                "Shape", esriGeometryType.esriGeometryPolyline,
                                SpatialReferenceUtils.CreateSpatialReference
                                    ((int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95,
                                    true), 1000));

            IFeatureClass lineFc = DatasetUtils.CreateSimpleFeatureClass(ws, "lineFc", fields);

            fields = new FieldsClass();
            fields.AddField(FieldUtils.CreateOIDField());
            fields.AddField(FieldUtils.CreateField("Objektart",
                                                   esriFieldType.esriFieldTypeInteger));
            fields.AddField(FieldUtils.CreateShapeField(
                                "Shape", esriGeometryType.esriGeometryPolygon,
                                SpatialReferenceUtils.CreateSpatialReference
                                    ((int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95,
                                    true), 1000));

            IFeatureClass areaFc = DatasetUtils.CreateSimpleFeatureClass(ws, "areaFc", fields);

            fields = new FieldsClass();
            fields.AddField(FieldUtils.CreateOIDField());
            fields.AddField(FieldUtils.CreateField("Objektart",
                                                   esriFieldType.esriFieldTypeInteger));
            fields.AddField(FieldUtils.CreateShapeField(
                                "Shape", esriGeometryType.esriGeometryPolygon,
                                SpatialReferenceUtils.CreateSpatialReference
                                    ((int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95,
                                    true), 1000));

            IFeatureClass ignoreFc = DatasetUtils.CreateSimpleFeatureClass(ws, "ignoreFc", fields);

            ((IWorkspaceEdit)ws).StartEditing(false);
            ((IWorkspaceEdit)ws).StopEditing(true);

            ((IWorkspaceEdit)ws).StartEditing(false);
            ((IWorkspaceEdit)ws).StopEditing(true);

            Create(lineFc, 10, CurveConstruction.StartLine(0, 0)
                   .LineTo(10, 10)
                   .Curve);

            Create(areaFc, 10, CurveConstruction.StartPoly(1, 1)
                   .LineTo(2, 1)
                   .LineTo(2, 2)
                   .LineTo(1, 2)
                   .ClosePolygon());

            Create(areaFc, 10, CurveConstruction.StartPoly(6, 6)
                   .LineTo(7, 6)
                   .LineTo(7, 7)
                   .LineTo(6, 7)
                   .ClosePolygon());

            Create(ignoreFc, 0, CurveConstruction.StartPoly(1, 1)
                   .LineTo(2, 1)
                   .LineTo(2, 2)
                   .LineTo(1, 2)
                   .ClosePolygon());

            Create(ignoreFc, 10, CurveConstruction.StartPoly(6, 6)
                   .LineTo(7, 6)
                   .LineTo(7, 7)
                   .LineTo(6, 7)
                   .ClosePolygon());

            var test = new QaIntersectsOther(lineFc, areaFc);

            test.IgnoreArea = ignoreFc;
            test.SetConstraint(2, "objektart in (10)");
            {
                // Container test
                var runner     = new QaContainerTestRunner(1000, test);
                int errorCount = runner.Execute();

                Assert.AreEqual(
                    1, errorCount);                     // only line errors, point error is removed by test container!
            }
            {
                // simple test
                var runner     = new QaTestRunner(test);
                int errorCount = runner.Execute();

                Assert.AreEqual(2, errorCount);                 // line AND point errors!
            }
        }
Example #16
0
        public void TestMultipart()
        {
            IFeatureWorkspace ws         = TestWorkspaceUtils.CreateInMemoryWorkspace("TestMultipart");
            IFieldsEdit       lineFields = new FieldsClass();

            lineFields.AddField(FieldUtils.CreateOIDField());
            lineFields.AddField(FieldUtils.CreateTextField("FromVal", 50));
            lineFields.AddField(FieldUtils.CreateTextField("ToVal", 50));
            lineFields.AddField(FieldUtils.CreateShapeField(
                                    "Shape", esriGeometryType.esriGeometryPolyline,
                                    SpatialReferenceUtils.CreateSpatialReference
                                        ((int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95,
                                        true), 1000));

            IFeatureClass lineFc = DatasetUtils.CreateSimpleFeatureClass(
                ws, "TestFieldValuesExpression1", lineFields);

            IFieldsEdit pointFields = new FieldsClass();

            pointFields.AddField(FieldUtils.CreateOIDField());
            pointFields.AddField(FieldUtils.CreateTextField("Name", 50));
            pointFields.AddField(FieldUtils.CreateShapeField(
                                     "Shape", esriGeometryType.esriGeometryPoint,
                                     SpatialReferenceUtils.CreateSpatialReference
                                         ((int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95,
                                         true), 1000));

            IFeatureClass pointFc = DatasetUtils.CreateSimpleFeatureClass(
                ws, "TestFieldValuesExpression2", pointFields);

            IPoint center = new PointClass();

            center.PutCoords(200, 200);

            IFeature row1 = lineFc.CreateFeature();

            row1.set_Value(1, "Name");
            row1.set_Value(2, "AndererName");
            row1.Shape =
                CurveConstruction.StartLine(100, 100).LineTo(200, 160).MoveTo(100, 160)
                .LineTo(center).Curve;
            row1.Store();

            IFeature row2 = lineFc.CreateFeature();

            row2.set_Value(1, "Name");
            row2.Shape = CurveConstruction
                         .StartLine(200, 100).LineTo(300, 140).MoveTo(200, 160).LineTo(center)
                         .Curve;
            row2.Store();

            IFeature row3 = lineFc.CreateFeature();

            row3.set_Value(1, "Name");
            row3.Shape = CurveConstruction
                         .StartLine(300, 100).LineTo(300, 140).MoveTo(300, 160).LineTo(center)
                         .Curve;
            row3.Store();

            IFeature row4 = pointFc.CreateFeature();

            row4.set_Value(1, "AndererName");
            row4.Shape = center;
            row4.Store();

            string lineField = $"IIF({QaConnections.StartsIn}, FromVal, ToVal)";
            var    test      = new QaLineConnectionFieldValues(
                lineFc, lineField,
                LineFieldValuesConstraint.AllEqualOrValidPointExists,
                pointFc, "Name",
                PointFieldValuesConstraint.AllEqualAndMatchAnyLineValue);

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

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

            test.UseMultiParts = true;
            runner             = new QaContainerTestRunner(500, test);
            Assert.AreEqual(1, runner.Execute());
        }
Example #17
0
        public void CanTestPointNotNearPolylineRightSide()
        {
            IFeatureWorkspace testWs =
                TestWorkspaceUtils.CreateInMemoryWorkspace(
                    "CanTestPointNotNearPolylineRightSide");

            IFieldsEdit fields = new FieldsClass();

            fields.AddField(FieldUtils.CreateOIDField());
            fields.AddField(FieldUtils.CreateDoubleField("minDistance"));
            fields.AddField(FieldUtils.CreateDoubleField("rightSideDistance"));
            fields.AddField(FieldUtils.CreateIntegerField("flip"));
            fields.AddField(FieldUtils.CreateShapeField(
                                "Shape", esriGeometryType.esriGeometryPolyline,
                                SpatialReferenceUtils.CreateSpatialReference
                                    ((int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95,
                                    true), 1000, true));

            IFeatureClass polyFc = DatasetUtils.CreateSimpleFeatureClass(
                testWs, "polylineFc",
                fields);

            IFeatureClass pointFc = CreatePointClass(testWs, "pointFc");

            IFeature polyFeature = polyFc.CreateFeature();

            polyFeature.set_Value(1, 5);
            polyFeature.set_Value(2, 10);
            polyFeature.set_Value(3, 1);
            polyFeature.Shape = CurveConstruction.StartLine(0, 0, 0)
                                .LineTo(100, 0, 10)
                                .LineTo(100, 100, 10)
                                .Curve;
            polyFeature.Store();

            IFeature p1 = pointFc.CreateFeature();

            p1.Shape = GeometryFactory.CreatePoint(10, 7, 0);
            p1.Store();

            IFeature p2 = pointFc.CreateFeature();

            p2.Shape = GeometryFactory.CreatePoint(-0.1, 7, 0);
            p2.Store();

            IFeature p3 = pointFc.CreateFeature();

            p3.Shape = GeometryFactory.CreatePoint(93, 100.1, 10);
            p3.Store();

            //QaPointNotNear.UseQueryPointAndDistance = true;

            var test1  = new QaPointNotNear(pointFc, polyFc, 10.0);
            var runner = new QaContainerTestRunner(1000, test1);

            runner.Execute();
            Assert.AreEqual(3, runner.Errors.Count);

            var test2 = new QaPointNotNear(pointFc, new[] { polyFc }, 10.0, null,
                                           new[] { "minDistance" });

            runner = new QaContainerTestRunner(1000, test2);
            runner.Execute();
            Assert.AreEqual(0, runner.Errors.Count);

            var test3 = new QaPointNotNear(pointFc, new[] { polyFc }, 10, null, new[] { "5" },
                                           new[] { "rightSideDistance" },
                                           null);

            runner = new QaContainerTestRunner(1000, test3);
            runner.Execute();
            Assert.AreEqual(0, runner.Errors.Count);

            var test4 = new QaPointNotNear(pointFc, new[] { polyFc }, 10, null,
                                           new[] { "5" },
                                           new[] { "rightSideDistance" },
                                           new[] { "true" });

            runner = new QaContainerTestRunner(1000, test4);
            runner.Execute();
            Assert.AreEqual(3, runner.Errors.Count);

            var test5 = new QaPointNotNear(pointFc, new[] { polyFc }, 10, null,
                                           new[] { "5" },
                                           new[] { "rightSideDistance" },
                                           new[] { "flip > 0" });

            runner = new QaContainerTestRunner(1000, test5);
            runner.Execute();
            Assert.AreEqual(3, runner.Errors.Count);
        }
Example #18
0
        public void CanTestPointNotNearPolygon()
        {
            IFeatureWorkspace testWs =
                TestWorkspaceUtils.CreateInMemoryWorkspace("QaPointNotNearTest");

            IFieldsEdit fields = new FieldsClass();

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

            IFeatureClass polyFc = DatasetUtils.CreateSimpleFeatureClass(
                testWs, "polygonFc",
                fields);

            IFeatureClass pointFc0 = CreatePointClass(testWs, "pointFc0");
            IFeatureClass pointFc1 = CreatePointClass(testWs, "pointFc1");
            IFeatureClass pointFc2 = CreatePointClass(testWs, "pointFc2");

            IFeature polyFeature = polyFc.CreateFeature();

            polyFeature.Shape =
                CurveConstruction.StartPoly(0, 0, 0)
                .LineTo(100, 0, 10)
                .LineTo(50, 100, 10)
                .ClosePolygon();
            polyFeature.Store();

            IFeature p0 = pointFc0.CreateFeature();

            p0.Shape = GeometryFactory.CreatePoint(20, 1.5, 0);
            p0.Store();

            IFeature p1 = pointFc1.CreateFeature();

            p1.Shape = GeometryFactory.CreatePoint(101, -1, 0);
            p1.Store();

            IFeature p2 = pointFc2.CreateFeature();

            p2.Shape = GeometryFactory.CreatePoint(1, 99, 0);
            p2.Store();

            var test1  = new QaPointNotNear(pointFc0, polyFc, 1.0);
            var runner = new QaContainerTestRunner(1000, test1);

            runner.Execute();
            Assert.AreEqual(1, runner.Errors.Count);

            var test2 = new QaPointNotNear(pointFc0, polyFc, 1.0);

            test2.GeometryComponents = new[] { GeometryComponent.Boundary };
            runner = new QaContainerTestRunner(1000, test2);
            runner.Execute();
            Assert.AreEqual(0, runner.Errors.Count);

            var test3 = new QaPointNotNear(pointFc0, polyFc, 2.0);

            test3.GeometryComponents = new[] { GeometryComponent.Boundary };
            runner = new QaContainerTestRunner(1000, test3);
            runner.Execute();
            Assert.AreEqual(1, runner.Errors.Count);

            var test3_1 = new QaPointNotNear(pointFc1, polyFc, 2.0);

            test3.GeometryComponents = new[] { GeometryComponent.Boundary };
            runner = new QaContainerTestRunner(1000, test3_1);
            runner.Execute();
            Assert.AreEqual(1, runner.Errors.Count);

            var test4 = new QaPointNotNear(pointFc0, polyFc, 2.0);

            test4.GeometryComponents = new[] { GeometryComponent.Vertices };
            runner = new QaContainerTestRunner(1000, test4);
            runner.Execute();
            Assert.AreEqual(0, runner.Errors.Count);

            var test5 = new QaPointNotNear(pointFc0, polyFc, 22.0);

            test5.GeometryComponents = new[] { GeometryComponent.Vertices };
            runner = new QaContainerTestRunner(1000, test5);
            runner.Execute();
            Assert.AreEqual(1, runner.Errors.Count);

            var test6 = new QaPointNotNear(pointFc0, polyFc, 44);             // dist is 43.74

            test6.GeometryComponents = new[] { GeometryComponent.Centroid };
            runner = new QaContainerTestRunner(1000, test6);
            runner.Execute();
            Assert.AreEqual(1, runner.Errors.Count);

            var test8 = new QaPointNotNear(pointFc0, polyFc, 43);

            test8.GeometryComponents = new[] { GeometryComponent.Centroid };
            runner = new QaContainerTestRunner(1000, test8);
            runner.Execute();
            Assert.AreEqual(0, runner.Errors.Count);

            var test7 = new QaPointNotNear(pointFc0, polyFc, 44);             // dist is 43.74

            test7.GeometryComponents = new[] { GeometryComponent.LabelPoint };
            runner = new QaContainerTestRunner(1000, test7);
            runner.Execute();
            Assert.AreEqual(1, runner.Errors.Count);

            var test9 = new QaPointNotNear(pointFc0, polyFc, 43);

            test9.GeometryComponents = new[] { GeometryComponent.LabelPoint };
            runner = new QaContainerTestRunner(1000, test9);
            runner.Execute();
            Assert.AreEqual(0, runner.Errors.Count);

            var test10 = new QaPointNotNear(pointFc0, new[] { polyFc }, 43, "43", null);

            test10.GeometryComponents = new[] { GeometryComponent.LabelPoint };
            runner = new QaContainerTestRunner(1000, test10);
            runner.Execute();
            Assert.AreEqual(0, runner.Errors.Count);

            var test11 = new QaPointNotNear(pointFc2, polyFc, 0);

            runner = new QaContainerTestRunner(1000, test11);
            runner.Execute();
            Assert.AreEqual(0, runner.Errors.Count);
        }
Example #19
0
        public void CanTestPointNotNearWithConstraint()
        {
            IFeatureWorkspace testWs =
                TestWorkspaceUtils.CreateInMemoryWorkspace("QaPointNotNearTest");

            IFieldsEdit fields = new FieldsClass();

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

            IFeatureClass polyFc = DatasetUtils.CreateSimpleFeatureClass(
                testWs, "polygonFc",
                fields);

            IFeatureClass pointFc = CreatePointClass(testWs, "pointFc");

            IFeature polyFeature = polyFc.CreateFeature();

            polyFeature.Shape =
                CurveConstruction.StartPoly(0, 0, 0)
                .LineTo(100, 0, 10)
                .LineTo(50, 100, 10)
                .ClosePolygon();
            polyFeature.Store();

            IFeature p1 = pointFc.CreateFeature();

            p1.Shape = GeometryFactory.CreatePoint(20, 1.5, 0);
            p1.Store();

            var test1  = new QaPointNotNear(pointFc, polyFc, 1.0);
            var runner = new QaContainerTestRunner(1000, test1);

            runner.Execute();
            Assert.AreEqual(1, runner.Errors.Count);

            var test2 = new QaPointNotNear(pointFc, polyFc, 1.0);

            test2.ValidRelationConstraints = new[] { "G1.ObjectId = 1" };
            runner = new QaContainerTestRunner(1000, test2);
            runner.Execute();
            Assert.AreEqual(0, runner.Errors.Count);

            var test3 = new QaPointNotNear(pointFc, polyFc, 2.0);

            test3.ValidRelationConstraints = new[] { "G2.ObjectId = 1" };
            runner = new QaContainerTestRunner(1000, test3);
            runner.Execute();
            Assert.AreEqual(0, runner.Errors.Count);

            var test4 = new QaPointNotNear(pointFc, polyFc, 2.0);

            test4.ValidRelationConstraints = new[] { "G1.ObjectId = G2.ObjectId" };
            runner = new QaContainerTestRunner(1000, test4);
            runner.Execute();
            Assert.AreEqual(0, runner.Errors.Count);

            var test5 = new QaPointNotNear(pointFc, polyFc, 2.0);

            test5.ValidRelationConstraints = new[] { "G1.ObjectId > G2.ObjectId" };
            runner = new QaContainerTestRunner(1000, test5);
            runner.Execute();
            Assert.AreEqual(1, runner.Errors.Count);
        }
Example #20
0
        public void CanTestPointNotNearPolyline()
        {
            IFeatureWorkspace testWs =
                TestWorkspaceUtils.CreateInMemoryWorkspace("QaPointNotNearTest");

            IFieldsEdit fields = new FieldsClass();

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

            IFeatureClass polyFc = DatasetUtils.CreateSimpleFeatureClass(
                testWs, "polylineFc",
                fields);

            IFeatureClass pointFc = CreatePointClass(testWs, "pointFc");

            IFeature polyFeature = polyFc.CreateFeature();

            polyFeature.Shape = CurveConstruction.StartLine(0, 0, 0)
                                .LineTo(100, 0, 10)
                                .LineTo(50, 100, 10)
                                .Curve;
            polyFeature.Store();

            IFeature p1 = pointFc.CreateFeature();

            p1.Shape = GeometryFactory.CreatePoint(90, 0, 0);
            p1.Store();

            var test1  = new QaPointNotNear(pointFc, polyFc, 1.0);
            var runner = new QaContainerTestRunner(1000, test1);

            runner.Execute();
            Assert.AreEqual(1, runner.Errors.Count);

            var test2 = new QaPointNotNear(pointFc, polyFc, 1.0);

            test2.GeometryComponents = new[] { GeometryComponent.Boundary };
            runner = new QaContainerTestRunner(1000, test2);
            runner.Execute();
            Assert.AreEqual(0, runner.Errors.Count);

            var test3 = new QaPointNotNear(pointFc, polyFc, 95);

            test3.GeometryComponents = new[] { GeometryComponent.Boundary };
            runner = new QaContainerTestRunner(1000, test3);
            runner.Execute();
            Assert.AreEqual(1, runner.Errors.Count);

            var test4 = new QaPointNotNear(pointFc, polyFc, 2.0);

            test4.GeometryComponents = new[] { GeometryComponent.Vertices };
            runner = new QaContainerTestRunner(1000, test4);
            runner.Execute();
            Assert.AreEqual(0, runner.Errors.Count);

            var test5 = new QaPointNotNear(pointFc, polyFc, 11.0);

            test5.GeometryComponents = new[] { GeometryComponent.Vertices };
            runner = new QaContainerTestRunner(1000, test5);
            runner.Execute();
            Assert.AreEqual(1, runner.Errors.Count);

            var test6 = new QaPointNotNear(pointFc, polyFc, 11.0);

            test6.GeometryComponents = new[] { GeometryComponent.LineStartPoint };
            runner = new QaContainerTestRunner(1000, test6);
            runner.Execute();
            Assert.AreEqual(0, runner.Errors.Count);

            var test7 = new QaPointNotNear(pointFc, polyFc, 91.0);

            test7.GeometryComponents = new[] { GeometryComponent.LineStartPoint };
            runner = new QaContainerTestRunner(1000, test7);
            runner.Execute();
            Assert.AreEqual(1, runner.Errors.Count);

            var test8 = new QaPointNotNear(pointFc, polyFc, 91.0);

            test8.GeometryComponents = new[] { GeometryComponent.LineEndPoint };
            runner = new QaContainerTestRunner(1000, test8);
            runner.Execute();
            Assert.AreEqual(0, runner.Errors.Count);

            var test9 = new QaPointNotNear(pointFc, polyFc, 120.0);

            test9.GeometryComponents = new[] { GeometryComponent.LineEndPoint };
            runner = new QaContainerTestRunner(1000, test9);
            runner.Execute();
            Assert.AreEqual(1, runner.Errors.Count);

            var test10 = new QaPointNotNear(pointFc, polyFc, 89.0);

            test10.GeometryComponents = new[] { GeometryComponent.LineEndPoints };
            runner = new QaContainerTestRunner(1000, test10);
            runner.Execute();
            Assert.AreEqual(0, runner.Errors.Count);

            var test11 = new QaPointNotNear(pointFc, polyFc, 92.0);

            test11.GeometryComponents = new[] { GeometryComponent.LineEndPoints };
            runner = new QaContainerTestRunner(1000, test11);
            runner.Execute();
            Assert.AreEqual(1, runner.Errors.Count);
        }
Example #21
0
        public void SetupFixture()
        {
            _lic.Checkout();

            _testWs = TestWorkspaceUtils.CreateInMemoryWorkspace("QaMustBeNearOtherTest");
        }
Example #22
0
        public void SetupFixture()
        {
            _lic.Checkout();

            _testWs = TestWorkspaceUtils.CreateInMemoryWorkspace("QaLineConnectionFieldValues");
        }
Example #23
0
 public void SetupFixture()
 {
     _lic.Checkout();
     _testWs = TestWorkspaceUtils.CreateInMemoryWorkspace("TableViewTest");
 }
        public void TestClosedLines()
        {
            var           ws = TestWorkspaceUtils.CreateInMemoryWorkspace("ClosedLines");
            IFeatureClass polylineFeatureClass;
            IFeatureClass pointFeatureClass;

            CreateTestFeatureClasses("polygons5", "points5",
                                     out polylineFeatureClass,
                                     out pointFeatureClass, ws, polygonAsClosedLines: true);

            IFeature emptyFeature = polylineFeatureClass.CreateFeature();

            emptyFeature.Shape =
                CurveConstruction.StartLine(100, 300)
                .LineTo(200, 300)
                .LineTo(200, 400)
                .LineTo(100, 400)
                .LineTo(100, 300)
                .Curve;
            emptyFeature.Store();

            IFeature counterClockwiseFeature = polylineFeatureClass.CreateFeature();

            counterClockwiseFeature.Shape =
                CurveConstruction.StartLine(100, 100)
                .LineTo(200, 100)
                .LineTo(200, 200)
                .LineTo(100, 200)
                .LineTo(100, 100)
                .Curve;
            counterClockwiseFeature.Store();

            IFeature clockwiseFeature = polylineFeatureClass.CreateFeature();

            clockwiseFeature.Shape =
                CurveConstruction.StartLine(100, 100)
                .LineTo(100, 200)
                .LineTo(200, 200)
                .LineTo(200, 100)
                .LineTo(100, 100)
                .Curve;
            clockwiseFeature.Store();

            IFeature notClosedFeature = polylineFeatureClass.CreateFeature();

            notClosedFeature.Shape =
                CurveConstruction.StartLine(300, 100)
                .LineTo(400, 100)
                .LineTo(400, 200)
                .Curve;
            notClosedFeature.Store();

            IFeature pointFeature1 = pointFeatureClass.CreateFeature();

            pointFeature1.Shape = GeometryFactory.CreatePoint(150, 150);
            pointFeature1.Store();

            IFeature pointFeature2 = pointFeatureClass.CreateFeature();

            pointFeature2.Shape = GeometryFactory.CreatePoint(350, 100);
            pointFeature2.Store();

            var test = new QaContainedPointsCount(polylineFeatureClass, pointFeatureClass, 1,
                                                  string.Empty)
            {
                PolylineUsage = PolylineUsage.AsIs
            };
            var containerRunner = new QaContainerTestRunner(1000, test);

            containerRunner.Execute();
            Assert.AreEqual(3, containerRunner.Errors.Count);

            test = new QaContainedPointsCount(polylineFeatureClass, pointFeatureClass, 1,
                                              string.Empty)
            {
                PolylineUsage = PolylineUsage.AsPolygonIfClosedElseReportIssue
            };
            containerRunner = new QaContainerTestRunner(1000, test);
            containerRunner.Execute();
            Assert.AreEqual(2, containerRunner.Errors.Count);

            test = new QaContainedPointsCount(polylineFeatureClass, pointFeatureClass, 1,
                                              string.Empty)
            {
                PolylineUsage = PolylineUsage.AsPolygonIfClosedElseIgnore
            };
            containerRunner = new QaContainerTestRunner(1000, test);
            containerRunner.Execute();
            Assert.AreEqual(1, containerRunner.Errors.Count);

            test = new QaContainedPointsCount(polylineFeatureClass, pointFeatureClass, 1,
                                              string.Empty)
            {
                PolylineUsage = PolylineUsage.AsPolygonIfClosedElseAsPolyline
            };
            containerRunner = new QaContainerTestRunner(1000, test);
            containerRunner.Execute();
            Assert.AreEqual(1, containerRunner.Errors.Count);
        }
Example #25
0
        public void SetupFixture()
        {
            _lic.Checkout(EsriProduct.ArcEditor);

            _testWs = TestWorkspaceUtils.CreateInMemoryWorkspace("QaMinSegAngleTest");
        }
Example #26
0
		public void SetupFixture()
		{
			_lic.Checkout();

			_testWs = TestWorkspaceUtils.CreateInMemoryWorkspace("QaValidUrlsTest");
		}