Exemple #1
0
        CanIgnoreWhenAllowDisjointCandidateFeatureIfAttributeConstraintsAreFulfilled()
        {
            IFeatureClass fcPoint1;
            IFeatureClass fcPoint2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcPoint1, out fcPoint2, out fcBorder1, out fcBorder2);

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

            // point on border
            AddPointFeature(fcPoint1, 5, 0, stateId: "A", textFieldValue: "X");
            // point on border, offset > search tolerance
            AddPointFeature(fcPoint2, 4.8, 0, stateId: "B", textFieldValue: "X");

            var test = new QaEdgeMatchBorderingPoints(fcPoint1, fcBorder1,
                                                      fcPoint2, fcBorder2,
                                                      searchDistance: 0.5)
            {
                PointClass1BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                PointClass2BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                BorderingPointMatchCondition    = "POINT1.STATE <> POINT2.STATE",
                BorderingPointEqualAttributes   = "FLD_TEXT",
                AllowDisjointCandidateFeatureIfAttributeConstraintsAreFulfilled = true
            };

            AssertErrors(0, Run(test));
        }
Exemple #2
0
        public void CanDetectCoincidentFeaturesWithDifferingAttributes()
        {
            IFeatureClass fcPoint1;
            IFeatureClass fcPoint2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcPoint1, out fcPoint2, out fcBorder1, out fcBorder2);

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

            DateTime dateValue = DateTime.Now;

            // point on border:
            AddPointFeature(fcPoint1, 5, 0, "A", "Y#X", 10.001, dateValue);
            // point on border, exact match:
            AddPointFeature(fcPoint2, 5, 0, "B", "X#Y", 10.002, dateValue);

            var test = new QaEdgeMatchBorderingPoints(fcPoint1, fcBorder1,
                                                      fcPoint2, fcBorder2,
                                                      searchDistance: 0.5)
            {
                PointClass1BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                PointClass2BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                BorderingPointMatchCondition    = "POINT1.STATE <> POINT2.STATE",
                BorderingPointEqualAttributes   = "FLD_TEXT:#, FLD_DOUBLE, FLD_DATE"
            };

            AssertErrors(1, Run(test),
                         "Match.ConstraintsNotFulfilled");
        }
Exemple #3
0
        public void CanIgnoreCoincidentFeatures()
        {
            IFeatureClass fcPoint1;
            IFeatureClass fcPoint2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcPoint1, out fcPoint2, out fcBorder1, out fcBorder2);

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

            // point on border:
            AddPointFeature(fcPoint1, 5, 0, stateId: "A");
            // point on border, exact match:
            AddPointFeature(fcPoint2, 5, 0, stateId: "B");

            var test = new QaEdgeMatchBorderingPoints(fcPoint1, fcBorder1,
                                                      fcPoint2, fcBorder2,
                                                      searchDistance: 0.5)
            {
                PointClass1BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                PointClass2BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                BorderingPointMatchCondition    = "POINT1.STATE <> POINT2.STATE"
            };

            AssertErrors(0, Run(test));
        }
Exemple #4
0
        public void CanDetectNoCandidateFeaturesDueToLateralOffset()
        {
            IFeatureClass fcPoint1;
            IFeatureClass fcPoint2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcPoint1, out fcPoint2, out fcBorder1, out fcBorder2);

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

            // point on border
            AddPointFeature(fcPoint1, 5, 0, stateId: "A");
            // point on border, offset > search tolerance
            AddPointFeature(fcPoint2, 4.4, 0, stateId: "B");

            var test = new QaEdgeMatchBorderingPoints(fcPoint1, fcBorder1,
                                                      fcPoint2, fcBorder2,
                                                      searchDistance: 0.5)
            {
                PointClass1BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                PointClass2BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                BorderingPointMatchCondition    = "POINT1.STATE <> POINT2.STATE"
            };

            // two errors expected, one for each line (both end on the border)
            AssertErrors(2, Run(test), "NoMatch.NoCandidate");
        }
Exemple #5
0
        public void CanDetectNonCoincidentCandidateFeatureDuetoBorderOverlap()
        {
            IFeatureClass fcPoint1;
            IFeatureClass fcPoint2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcPoint1, out fcPoint2, out fcBorder1, out fcBorder2);

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

            // point on border
            AddPointFeature(fcPoint1, 5, 0, stateId: "A");
            // point on border
            AddPointFeature(fcPoint2, 5, 0.3, stateId: "B");

            var test = new QaEdgeMatchBorderingPoints(fcPoint1, fcBorder1,
                                                      fcPoint2, fcBorder2,
                                                      searchDistance: 0.5)
            {
                PointClass1BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                PointClass2BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                BorderingPointMatchCondition    = "POINT1.STATE <> POINT2.STATE"
            };

            // No error currently reported, since the lines touch (end point on interior of other line)
            AssertErrors(1, Run(test),
                         "NoMatch.CandidateExists.BordersNotCoincident+ConstraintsFulfilled");
        }
Exemple #6
0
        public void CanDetectNoCandidateFeatureDueToOffsetFromBorder()
        {
            IFeatureClass fcPoint1;
            IFeatureClass fcPoint2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcPoint1, out fcPoint2, out fcBorder1, out fcBorder2);

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

            // point on border
            AddPointFeature(fcPoint1, 5, 0, stateId: "A");
            // point NOT on border
            AddPointFeature(fcPoint2, 5, 0.1, stateId: "B");

            var test = new QaEdgeMatchBorderingPoints(fcPoint1, fcBorder1,
                                                      fcPoint2, fcBorder2,
                                                      searchDistance: 0.5)
            {
                PointClass1BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                PointClass2BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                BorderingPointMatchCondition    = "POINT1.STATE <> POINT2.STATE"
            };

            AssertErrors(1, Run(test),
                         "NoMatch.NoCandidate");
        }
Exemple #7
0
        public void CanIgnoreNonCoincientCandidateFeatureDuetoBorderGap()
        {
            IFeatureClass fcPoint1;
            IFeatureClass fcPoint2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcPoint1, out fcPoint2, out fcBorder1, out fcBorder2);

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

            // point on border
            AddPointFeature(fcPoint1, 5, 0, stateId: "A");
            // point on border
            AddPointFeature(fcPoint2, 5, -0.3, stateId: "B");

            var test = new QaEdgeMatchBorderingPoints(fcPoint1, fcBorder1,
                                                      fcPoint2, fcBorder2,
                                                      searchDistance: 0.5)
            {
                PointClass1BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                PointClass2BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                BorderingPointMatchCondition    = "POINT1.STATE <> POINT2.STATE",
                AllowDisjointCandidateFeatureIfBordersAreNotCoincident = true
            };

            AssertErrors(0, Run(test));
        }
Exemple #8
0
        public void CanDetectNonCoincidentCandidateFeatureWithDifferingAttributes()
        {
            IFeatureClass fcPoint1;
            IFeatureClass fcPoint2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcPoint1, out fcPoint2, out fcBorder1, out fcBorder2);

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

            DateTime dateValue1 = DateTime.Now;
            DateTime dateValue2 = DateTime.Now - TimeSpan.FromHours(1);

            // point on border
            AddPointFeature(fcPoint1, 5, 0, "A", "X#Y", 100, dateValue1);
            // point on border, lateral offset
            // - text field different; double difference not significant; date field different
            AddPointFeature(fcPoint2, 4.9, 0, "B", "Y", 100.00000000000001, dateValue2);

            var test = new QaEdgeMatchBorderingPoints(fcPoint1, fcBorder1,
                                                      fcPoint2, fcBorder2,
                                                      searchDistance: 0.5)
            {
                PointClass1BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                PointClass2BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                BorderingPointMatchCondition    = "POINT1.STATE <> POINT2.STATE",
                BorderingPointEqualAttributes   = "FLD_TEXT:#, FLD_DOUBLE, FLD_DATE"
            };

            AssertErrors(1, Run(test), "NoMatch.CandidateExists.ConstraintsNotFulfilled");
        }
Exemple #9
0
        public void CanIgnoreNonCoincidentCandidateFeatureWithinCoincidenceTolerance()
        {
            IFeatureClass fcPoint1;
            IFeatureClass fcPoint2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcPoint1, out fcPoint2, out fcBorder1, out fcBorder2);

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

            // point on border
            AddPointFeature(fcPoint1, 5, 0, stateId: "A");
            // point on border, lateral offset
            AddPointFeature(fcPoint2, 4.9, 0, stateId: "B");

            var test = new QaEdgeMatchBorderingPoints(fcPoint1, fcBorder1,
                                                      fcPoint2, fcBorder2,
                                                      searchDistance: 0.5)
            {
                PointClass1BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                PointClass2BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                BorderingPointMatchCondition    = "POINT1.STATE <> POINT2.STATE",
                CoincidenceTolerance            = 0.11
            };

            AssertErrors(0, Run(test));
        }
Exemple #10
0
        public void CanDetectNonCoincidentCandidateFeature()
        {
            IFeatureClass fcPoint1;
            IFeatureClass fcPoint2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcPoint1, out fcPoint2, out fcBorder1, out fcBorder2);

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

            // point on border
            AddPointFeature(fcPoint1, 5, 0, stateId: "A");
            // point on border, lateral offset
            AddPointFeature(fcPoint2, 4.9, 0, stateId: "B");

            var test = new QaEdgeMatchBorderingPoints(fcPoint1, fcBorder1,
                                                      fcPoint2, fcBorder2,
                                                      searchDistance: 0.5)
            {
                PointClass1BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                PointClass2BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                BorderingPointMatchCondition    = "POINT1.STATE <> POINT2.STATE"
            };

            AssertErrors(1, Run(test), "NoMatch.CandidateExists.ConstraintsFulfilled");
        }
Exemple #11
0
        public void CanAttributeConstraintErrorsIndividually()
        {
            IFeatureClass fcPoint1;
            IFeatureClass fcPoint2;
            IFeatureClass fcBorder1;
            IFeatureClass fcBorder2;

            CreateFeatureClasses(out fcPoint1, out fcPoint2, out fcBorder1, out fcBorder2);

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

            DateTime dateValue = new DateTime(2000, 12, 31);

            // point on border:
            AddPointFeature(fcPoint1, 5, 0, "A", "Y#X", 10.001, dateValue);
            // point on border, exact match:
            AddPointFeature(fcPoint2, 5, 0, "B", "X#Y", 10.002, dateValue + TimeSpan.FromDays(1));

            using (AssertUtils.UseInvariantCulture())
            {
                var test = new QaEdgeMatchBorderingPoints(fcPoint1, fcBorder1,
                                                          fcPoint2, fcBorder2,
                                                          searchDistance: 0.5)
                {
                    PointClass1BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                    PointClass2BorderMatchCondition = "POINT.STATE = BORDER.STATE",
                    BorderingPointMatchCondition    = "POINT1.STATE <> POINT2.STATE",
                    BorderingPointEqualAttributes   = "FLD_TEXT:#, FLD_DOUBLE, FLD_DATE",
                    ReportIndividualAttributeConstraintViolations = true
                };

                AssertUtils.ExpectedErrors(
                    2, Run(test),
                    e => e.Description ==
                    "Values are not equal (FLD_DOUBLE:10.001,10.002)" &&
                    e.AffectedComponent == "FLD_DOUBLE" &&
                    e.IssueCode?.ID == "BorderingPoints.Match.ConstraintsNotFulfilled",
                    e => e.Description ==
                    "Values are not equal (FLD_DATE:01/01/2001 00:00:00,12/31/2000 00:00:00)" &&
                    e.AffectedComponent == "FLD_DATE" &&
                    e.IssueCode?.ID == "BorderingPoints.Match.ConstraintsNotFulfilled");
            }
        }