Ejemplo n.º 1
0
        public void CanIgnoreConnectedFeaturesWithMatchConditions()
        {
            IFeatureClass fcLine1;
            IFeatureClass fcLine2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcLine1, out fcLine2, out fcBorder1, out fcBorder2);

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

            // connected to border:
            AddLineFeature(fcLine1, 5, 0, 7, 0, stateId: "A");
            // dummy to run
            AddLineFeature(fcLine1, 5, 1, 7, 1, stateId: "A");

            // connected to border, exact match:
            AddLineFeature(fcLine2, 7, 0, 5, 0, stateId: "B");

            var test = new QaEdgeMatchBorderingLines(fcLine1, fcBorder1,
                                                     fcLine2, fcBorder2, 0)
            {
                LineClass1BorderMatchCondition = "LINE.STATE = BORDER.STATE",
                LineClass2BorderMatchCondition = "LINE.STATE = BORDER.STATE",
                BorderingLineMatchCondition    = "LINE1.STATE <> LINE2.STATE"
            };

            AssertNoErrors(Run(test, 1000));

            AssertNoErrors(Run(test, 5));
        }
Ejemplo n.º 2
0
        public void CanIgnoreNearCoincidentFeatures()
        {
            IFeatureClass fcLine1;
            IFeatureClass fcLine2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcLine1, out fcLine2, out fcBorder1, out fcBorder2);

            // border lines are coincident
            AddLineFeature(fcBorder1, 0, 0.1, 10, 0.1, stateId: "A");
            AddLineFeature(fcBorder2, 10, 0, 0, 0, stateId: "B");

            // connected to border:
            AddLineFeature(fcLine1, 5, 0.1, 7, 0.1, stateId: "A");

            // connected to border, exact match:
            AddLineFeature(fcLine2, 7, 0, 5, 0, stateId: "B");

            var test = new QaEdgeMatchBorderingLines(fcLine1, fcBorder1,
                                                     fcLine2, fcBorder2, 0.3)
            {
                LineClass1BorderMatchCondition = "LINE.STATE = BORDER.STATE",
                LineClass2BorderMatchCondition = "LINE.STATE = BORDER.STATE",
                BorderingLineMatchCondition    = "LINE1.STATE <> LINE2.STATE",
                AllowDisjointCandidateFeatureIfBordersAreNotCoincident = true
            };

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

            AssertUtils.ExpectedErrors(0, Run(test, 5));
        }
Ejemplo n.º 3
0
        public void CanIgnoreEndNotCoincident()
        {
            IFeatureClass fcLine1;
            IFeatureClass fcLine2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcLine1, out fcLine2, out fcBorder1, out fcBorder2);

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

            // connected to border:
            AddFeature(fcLine1,
                       CurveConstruction.StartLine(4, 2).LineTo(4, 0).LineTo(8, 0).Curve,
                       stateId: "A");

            // connected to border, exact match:
            AddLineFeature(fcLine2, 8, 0, 5, 0, stateId: "B");
            AddLineFeature(fcLine2, 5, 0, 4, 0, stateId: "B");

            var test = new QaEdgeMatchBorderingLines(fcLine1, fcBorder1,
                                                     fcLine2, fcBorder2, 0)
            {
                LineClass1BorderMatchCondition      = "LINE.STATE = BORDER.STATE",
                LineClass2BorderMatchCondition      = "LINE.STATE = BORDER.STATE",
                BorderingLineMatchCondition         = "LINE1.STATE <> LINE2.STATE",
                AllowNonCoincidentEndPointsOnBorder = true
            };

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

            AssertUtils.ExpectedErrors(0, Run(test, 5));
        }
Ejemplo n.º 4
0
        public void CanIgnoreConnectedFeatures()
        {
            IFeatureClass fcLine1;
            IFeatureClass fcLine2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcLine1, out fcLine2, out fcBorder1, out fcBorder2);

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

            // connected to border:
            AddLineFeature(fcLine1, 5, 0, 7, 0, stateId: "A");
            // dummy to run
            AddLineFeature(fcLine1, 5, 1, 7, 1, stateId: "A");

            // connected to border, exact match:
            AddLineFeature(fcLine2, 7, 0, 5, 0, stateId: "B");

            var test = new QaEdgeMatchBorderingLines(fcLine1, fcBorder1,
                                                     fcLine2, fcBorder2, 0);

            AssertNoErrors(Run(test, 1000));

            AssertNoErrors(Run(test, 5));
        }
Ejemplo n.º 5
0
        public void CanIgnoreMissingFull()
        {
            IFeatureClass fcLine1;
            IFeatureClass fcLine2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcLine1, out fcLine2, out fcBorder1, out fcBorder2);

            // border lines are coincident
            AddLineFeature(fcBorder1, 0, 0, 10, 0, stateId: "A");

            // connected to border:
            AddLineFeature(fcLine1, 5, 0, 7, 0, stateId: "A");
            // dummy to run
            AddLineFeature(fcLine1, 5, 1, 7, 1, stateId: "A");

            var test = new QaEdgeMatchBorderingLines(fcLine1, fcBorder1,
                                                     fcLine2, fcBorder2, 0)
            {
                LineClass1BorderMatchCondition     = "LINE.STATE = BORDER.STATE",
                LineClass2BorderMatchCondition     = "LINE.STATE = BORDER.STATE",
                BorderingLineMatchCondition        = "LINE1.STATE <> LINE2.STATE",
                AllowNoFeatureWithinSearchDistance = true
            };

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

            AssertUtils.ExpectedErrors(0, Run(test, 5));
        }
Ejemplo n.º 6
0
        public void CanDetectMissingPartWithLineMatchConditions()
        {
            IFeatureClass fcLine1;
            IFeatureClass fcLine2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcLine1, out fcLine2, out fcBorder1, out fcBorder2);

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

            // connected to border:
            AddLineFeature(fcLine1, 5, 0, 7, 0, stateId: "A");
            // dummy to run
            AddLineFeature(fcLine1, 5, 1, 7, 1, stateId: "A");

            // connected to border, exact match:
            AddLineFeature(fcLine2, 7, 0, 5, 0, stateId: "B");

            var test = new QaEdgeMatchBorderingLines(fcLine1, fcBorder1,
                                                     fcLine2, fcBorder2, 0)
            {
                LineClass1BorderMatchCondition = "LINE.STATE = BORDER.STATE",
                LineClass2BorderMatchCondition = "LINE.STATE = BORDER.STATE",
                BorderingLineMatchCondition    = "LINE1.STATE = LINE2.STATE"
                                                 // --> will not be fulfilled
            };

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

            AssertUtils.ExpectedErrors(2, Run(test, 5));
        }
Ejemplo n.º 7
0
        public void CanAttributeConstraintErrorsIndividually()
        {
            IFeatureClass fcLine1;
            IFeatureClass fcLine2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcLine1, out fcLine2, out fcBorder1, out fcBorder2);

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

            // connected to border:
            AddLineFeature(fcLine1, 5, 0, 7, 0, stateId: "A", textFieldValue: "X");
            // dummy to run
            AddLineFeature(fcLine1, 5, 1, 7, 1, stateId: "A");

            // connected to border, exact match:
            AddLineFeature(fcLine2, 7, 0, 5, 0, stateId: "B", textFieldValue: "Y");

            using (AssertUtils.UseInvariantCulture())
            {
                var test = new QaEdgeMatchBorderingLines(fcLine1, fcBorder1,
                                                         fcLine2, fcBorder2, 0)
                {
                    LineClass1BorderMatchCondition   = "LINE.STATE = BORDER.STATE",
                    LineClass2BorderMatchCondition   = "LINE.STATE = BORDER.STATE",
                    BorderingLineMatchCondition      = "LINE1.STATE <> LINE2.STATE",
                    BorderingLineAttributeConstraint = "LINE1.STATE = LINE2.STATE",
                    BorderingLineEqualAttributes     = _textFieldName,
                    ReportIndividualAttributeConstraintViolations = true
                };

                AssertUtils.ExpectedErrors(2, Run(test, 1000),
                                           e => e.Description ==
                                           "Values are not equal (FLD_TEXT:'X','Y')" &&
                                           e.AffectedComponent == "FLD_TEXT" &&
                                           e.IssueCode?.ID ==
                                           "BorderingLines.Match.ConstraintsNotFulfilled",
                                           e => e.Description ==
                                           "Constraint is not fulfilled (LINE1.STATE:'A';LINE2.STATE:'B')" &&
                                           e.AffectedComponent == "STATE" &&
                                           e.IssueCode?.ID ==
                                           "BorderingLines.Match.ConstraintsNotFulfilled"
                                           );

                AssertUtils.ExpectedErrors(2, Run(test, 5));
            }
        }
Ejemplo n.º 8
0
        CanIgnoreWhenAllowDisjointCandidateFeatureIfAttributeConstraintsAreFulfilled()
        {
            IFeatureClass fcLine1;
            IFeatureClass fcLine2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;
            int           ticks = CreateFeatureClasses(out fcLine1, out fcLine2,
                                                       out fcBorder1, out fcBorder2);

            // border lines are coincident
            AddLineFeature(fcBorder1, 0, 0, 100, 0, stateId: "A");
            AddLineFeature(fcBorder2, 100, -0.1, 0, -0.1, stateId: "B");

            // connected to border:
            AddLineFeature(fcLine1, 10, 0, 30, 0, stateId: "A", textFieldValue: "Y");
            AddLineFeature(fcLine1, 30, 0, 70, 0, stateId: "A", textFieldValue: "Y");
            AddLineFeature(fcLine1, 70, 0, 90, 0, stateId: "A", textFieldValue: "Y");
            AddLineFeature(fcLine2, 10, -0.1, 15, -0.1, stateId: "B", textFieldValue: "Y");
            AddLineFeature(fcLine2, 15, -0.1, 50, -0.1, stateId: "B", textFieldValue: "Y");
            AddLineFeature(fcLine2, 50, -0.1, 55, -0.1, stateId: "B", textFieldValue: "Y");
            AddLineFeature(fcLine2, 55, -0.1, 90, -0.1, stateId: "B", textFieldValue: "Y");

            var test = new QaEdgeMatchBorderingLines(fcLine1, fcBorder1,
                                                     fcLine2, fcBorder2,
                                                     0.5)
            {
                LineClass1BorderMatchCondition = "LINE.STATE = BORDER.STATE",
                LineClass2BorderMatchCondition = "LINE.STATE = BORDER.STATE",
                BorderingLineMatchCondition    = "LINE1.STATE <> LINE2.STATE",
                BorderingLineEqualAttributes   = "FLD_TEXT",
                AllowDisjointCandidateFeatureIfAttributeConstraintsAreFulfilled = true
            };

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

            AssertUtils.ExpectedErrors(0, Run(test, 2));
        }
Ejemplo n.º 9
0
        public void CanDetectMissingPart()
        {
            IFeatureClass fcLine1;
            IFeatureClass fcLine2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcLine1, out fcLine2, out fcBorder1, out fcBorder2);

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

            // connected to border:
            AddFeature(fcLine1,
                       CurveConstruction.StartLine(4, 2).LineTo(4, 0)
                       .LineTo(7, 0).LineTo(7, 2).Curve,
                       stateId: "A");

            // connected to border, exact match:
            AddFeature(fcLine2,
                       CurveConstruction.StartLine(8, -2).LineTo(8, 0)
                       .LineTo(5, 0).LineTo(5, -2).Curve,
                       stateId: "B");

            var test = new QaEdgeMatchBorderingLines(fcLine1, fcBorder1,
                                                     fcLine2, fcBorder2, 0)
            {
                LineClass1BorderMatchCondition = "LINE.STATE = BORDER.STATE",
                LineClass2BorderMatchCondition = "LINE.STATE = BORDER.STATE",
                BorderingLineMatchCondition    = "LINE1.STATE <> LINE2.STATE"
            };

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

            AssertUtils.ExpectedErrors(2, Run(test, 5));
        }
Ejemplo n.º 10
0
        public void CanIgnoreConnectedFeaturesWithAreaBorders()
        {
            IFeatureClass fcLine1;
            IFeatureClass fcLine2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcLine1, out fcLine2, out fcBorder1, out fcBorder2, true);

            // border lines are coincident
            AddFeature(fcBorder1,
                       CurveConstruction.StartPoly(0, 0).LineTo(10, 0).LineTo(5, 5)
                       .ClosePolygon(),
                       stateId: "A");
            AddFeature(fcBorder2,
                       CurveConstruction.StartPoly(10, 0).LineTo(0, 0).LineTo(5, -5)
                       .ClosePolygon(),
                       stateId: "B");

            // connected to border:
            AddLineFeature(fcLine1, 5, 0, 7, 0, stateId: "A");

            // connected to border, exact match:
            AddLineFeature(fcLine2, 7, 0, 5, 0, stateId: "B");

            var test = new QaEdgeMatchBorderingLines(fcLine1, fcBorder1,
                                                     fcLine2, fcBorder2, 0)
            {
                LineClass1BorderMatchCondition = "LINE.STATE = BORDER.STATE",
                LineClass2BorderMatchCondition = "LINE.STATE = BORDER.STATE",
                BorderingLineMatchCondition    = "LINE1.STATE <> LINE2.STATE"
            };

            AssertNoErrors(Run(test, 1000));

            AssertNoErrors(Run(test, 5));
        }