示例#1
0
        public void CanTestInvalidMultiPatches()
        {
            var featureClassMock = new FeatureClassMock(1, "mock",
                                                        esriGeometryType.esriGeometryMultiPatch);

            var construction = new MultiPatchConstruction();

            construction.StartRing(0, 0, 0)
            .Add(5, 0, 0);
            IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            construction = new MultiPatchConstruction();
            construction.StartFan(0, 0, 0)
            .Add(5, 0, 0);
            IFeature row2 = featureClassMock.CreateFeature(construction.MultiPatch);

            construction = new MultiPatchConstruction();
            construction.StartStrip(0, 0, 0)
            .Add(5, 0, 0);
            IFeature row3 = featureClassMock.CreateFeature(construction.MultiPatch);

            construction = new MultiPatchConstruction();
            construction.StartTris(0, 0, 0)
            .Add(5, 0, 0);
            IFeature row4 = featureClassMock.CreateFeature(construction.MultiPatch);

            var runner = new QaTestRunner(new QaSliverPolygon(featureClassMock, 50, 1000));

            runner.Execute(row1);
            runner.Execute(row2);
            runner.Execute(row3);
            runner.Execute(row4);
        }
        public void CanTestLinesMaximumDifference()
        {
            var lineClass = new FeatureClassMock(
                1, "line", esriGeometryType.esriGeometryPolyline);

            CurveConstruction line1 =
                CurveConstruction.StartLine(0, 0, 10)
                .LineTo(10, 0, 10)
                .LineTo(0, 10, 10);

            IFeature row1 = lineClass.CreateFeature(line1.Curve);

            CurveConstruction line2 =
                CurveConstruction.StartLine(2, -2, 21)
                .LineTo(2, 20, 21);

            IFeature row2 = lineClass.CreateFeature(line2.Curve);

            var test = new QaZDifferenceSelfWrapper(new[] { (IFeatureClass)lineClass },
                                                    0, 10,
                                                    ZComparisonMethod.BoundingBox,
                                                    null);
            var runner     = new QaTestRunner(test);
            int errorCount = test.TestDirect(row1, 0, row2, 0);

            Assert.AreEqual(1, errorCount);
            Assert.AreEqual(1, runner.Errors.Count);
        }
示例#3
0
        public void VerifyResolutionProblemsNotReported()
        {
            var    fc          = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryMultiPatch);
            double xyTolerance = GeometryUtils.GetXyTolerance((IFeatureClass)fc);

            const double slopeAngleDeg = 85;
            const double height        = 10;
            const double x0            = 5;

            var construction = new MultiPatchConstruction();

            construction.StartRing(x0, 4, 0).Add(x0, 8, 0).Add(x0 + xyTolerance * 0.5, 4, height);
            // less than xyTolerance
            IFeature f = fc.CreateFeature(construction.MultiPatch);

            var test   = new QaMpVerticalFaces(fc, slopeAngleDeg, 0);
            var runner = new QaTestRunner(test);

            runner.Execute(f);
            Assert.AreEqual(0, runner.Errors.Count);

            construction = new MultiPatchConstruction();
            construction.StartRing(x0, 4, 0).Add(x0, 8, 0).Add(x0 + xyTolerance * 1.5, 4, height);
            // more than xyTolerance
            f = fc.CreateFeature(construction.MultiPatch);

            test   = new QaMpVerticalFaces(fc, slopeAngleDeg, 0);
            runner = new QaTestRunner(test);
            runner.Execute(f);
            Assert.AreEqual(1, runner.Errors.Count);
        }
示例#4
0
        public void CanTestMultiPatch()
        {
            var fc = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryMultiPatch);

            var construction = new MultiPatchConstruction();

            construction.StartRing(5, 4, 1)
            .Add(5, 8, 1)
            .Add(8, 8, 1)
            .Add(8, 4, 1);
            IFeature f = fc.CreateFeature(construction.MultiPatch);

            var test   = new QaCoplanarRings(fc, 0, false);
            var runner = new QaTestRunner(test);

            runner.Execute(f);
            Assert.AreEqual(0, runner.Errors.Count);

            construction = new MultiPatchConstruction();
            construction.StartRing(5, 4, 1)
            .Add(5, 8, 1)
            .Add(8, 8, 1)
            .Add(8, 4, 1.01);
            f = fc.CreateFeature(construction.MultiPatch);

            test   = new QaCoplanarRings(fc, 0, false);
            runner = new QaTestRunner(test);
            runner.Execute(f);
            Assert.AreEqual(1, runner.Errors.Count);
        }
示例#5
0
        public void CanTestPolygon()
        {
            var fc = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryPolygon);

            CurveConstruction construction = CurveConstruction.StartPoly(5, 4, 1)
                                             .LineTo(5, 8, 1)
                                             .LineTo(8, 8, 1)
                                             .LineTo(8, 4, 1);
            IFeature f = fc.CreateFeature(construction.ClosePolygon());

            GeometryUtils.EnsureSpatialReference(f.Shape, fc);

            var test   = new QaCoplanarRings(fc, 0, false);
            var runner = new QaTestRunner(test);

            runner.Execute(f);
            Assert.AreEqual(0, runner.Errors.Count);

            construction = CurveConstruction.StartPoly(5, 4, 1)
                           .LineTo(5, 8, 1)
                           .LineTo(8, 8, 1)
                           .LineTo(8, 4, 1.01);
            f = fc.CreateFeature(construction.ClosePolygon());
            GeometryUtils.EnsureSpatialReference(f.Shape, fc);

            test   = new QaCoplanarRings(fc, 0, false);
            runner = new QaTestRunner(test);
            runner.Execute(f);
            Assert.AreEqual(1, runner.Errors.Count);
        }
        public void VerifyHeightDiffsLargerNearHeightNotChecked()
        {
            var featureClassMock = new FeatureClassMock(1, "mock",
                                                        esriGeometryType.esriGeometryMultiPatch);
            // make sure the table is known by the workspace

            const double nearHeight  = 5;
            const double zNotChecked = nearHeight + 0.001;

            var construction = new MultiPatchConstruction();

            construction.StartRing(0, 0, 0).Add(0, 10, 0).Add(0, 10, zNotChecked).Add(0, 0,
                                                                                      zNotChecked);

            IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            var test   = new QaMpHorizontalHeights(featureClassMock, nearHeight, 0);
            var runner = new QaTestRunner(test);

            runner.Execute(row1);
            Assert.AreEqual(0, runner.Errors.Count);

            const double zChecked = nearHeight - 0.001;

            construction = new MultiPatchConstruction();
            construction.StartRing(0, 0, 0).Add(0, 10, 0).Add(0, 10, zChecked).Add(0, 0,
                                                                                   zChecked);

            row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            test   = new QaMpHorizontalHeights(featureClassMock, nearHeight, 0);
            runner = new QaTestRunner(test);
            runner.Execute(row1);
            Assert.AreEqual(1, runner.Errors.Count);
        }
示例#7
0
        public void VerifySlopedPlaneNotChecked()
        {
            var fc = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryMultiPatch);

            const double slopeAngleDeg = 85;
            const double height        = 10;
            const double x0            = 5;
            double       dx            = height * Math.Atan(MathUtils.ToRadians(90 - slopeAngleDeg));

            var construction = new MultiPatchConstruction();

            construction.StartRing(x0, 4, 0).Add(x0, 8, 0).Add(x0 + dx + 0.01, 4, height);
            // slight flatter than limit
            IFeature f = fc.CreateFeature(construction.MultiPatch);

            var test   = new QaMpVerticalFaces(fc, slopeAngleDeg, 0);
            var runner = new QaTestRunner(test);

            runner.Execute(f);
            Assert.AreEqual(0, runner.Errors.Count);

            construction = new MultiPatchConstruction();
            construction.StartRing(x0, 4, 0).Add(x0, 8, 0).Add(x0 + dx - 0.01, 4, height);
            // slight steeper than limit
            f = fc.CreateFeature(construction.MultiPatch);

            test   = new QaMpVerticalFaces(fc, slopeAngleDeg, 0);
            runner = new QaTestRunner(test);
            runner.Execute(f);
            Assert.AreEqual(1, runner.Errors.Count);
        }
示例#8
0
        public static void GetMockFeatures(out IFeature mockLine1Feature,
                                           out IFeature mockLine2Feature,
                                           out IFeature mockPoly1Feature,
                                           out IFeature mockPoly2Feature)
        {
            Console.WriteLine(@"Loading test data...");

            var line1 = (IPolyline)ReadGeometryFromXml(GetGeometryTestDataPath(_line1));
            var line2 = (IPolyline)ReadGeometryFromXml(GetGeometryTestDataPath(_line2));
            var poly1 = (IPolygon)ReadGeometryFromXml(GetGeometryTestDataPath(_poly1));
            var poly2 = (IPolygon)ReadGeometryFromXml(GetGeometryTestDataPath(_poly2));

            var mockPolyFeatureClass =
                new FeatureClassMock(1, "TestPolyClass",
                                     esriGeometryType.esriGeometryPolygon,
                                     esriFeatureType.esriFTSimple, poly1.SpatialReference,
                                     GeometryUtils.IsZAware(poly1));

            mockPoly1Feature = mockPolyFeatureClass.CreateFeature(poly1);

            mockPoly2Feature = mockPolyFeatureClass.CreateFeature(poly2);

            var mockLineFeatureClass =
                new FeatureClassMock(2, "TestLineClass",
                                     esriGeometryType.esriGeometryPolyline,
                                     esriFeatureType.esriFTSimple, line1.SpatialReference,
                                     GeometryUtils.IsZAware(line1));

            mockLine1Feature = mockLineFeatureClass.CreateFeature(line1);

            mockLine2Feature = mockLineFeatureClass.CreateFeature(line2);
        }
        public void CanTestIgnoreInnerRings()
        {
            var featureClassMock = new FeatureClassMock(1, "mock",
                                                        esriGeometryType.esriGeometryMultiPatch);

            var construction = new MultiPatchConstruction();

            construction.StartOuterRing(5, 4, 0)
            .Add(5, 8, 0)
            .Add(8, 8, 0)
            .Add(8, 4, 0)
            .StartInnerRing(6, 5, 0)
            .Add(7, 5, 0)
            .Add(7, 7, 0)
            .Add(6, 7, 0);

            IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            construction = new MultiPatchConstruction();

            construction.StartRing(0, 0, 0)
            .Add(0, 1, 0)
            .Add(5, 1, 0)
            .Add(5, 0, 0)
            .StartRing(5, 1, 0)
            .Add(4, 1, 0)
            .Add(4, 5, 0)
            .Add(5, 5, 0)
            .StartRing(5, 5, 0)
            .Add(1, 5, 0)
            .Add(1, 6, 0)
            .Add(5, 6, 0)
            .StartRing(1, 6, 0)
            .Add(1, 1, 0)
            .Add(0, 1, 0)
            .Add(0, 6, 0);

            IFeature row2 = featureClassMock.CreateFeature(construction.MultiPatch);

            var test = new QaMpFootprintHoles(featureClassMock,
                                              InnerRingHandling.IgnoreInnerRings);
            var runner = new QaTestRunner(test);

            runner.Execute(row1);
            Assert.AreEqual(0, runner.Errors.Count);

            runner.Execute(row2);
            Assert.AreEqual(1, runner.Errors.Count);
        }
示例#10
0
        public void CanTestMultiPatches()
        {
            var fc = new FeatureClassMock(1, "mock", esriGeometryType.esriGeometryMultiPatch);

            var construction = new MultiPatchConstruction();

            construction.StartOuterRing(5, 4, 0, 1).Add(5, 8, 0, 1).Add(8, 8, 0, 1).Add(8, 4, 0, 1)
            .StartInnerRing(6, 5, 0, 2).Add(6, 7, 0, 2).Add(7, 7, 0, 2);
            IMultiPatch multiPatch = construction.MultiPatch;

            multiPatch.SpatialReference = ((IGeoDataset)fc).SpatialReference;
            multiPatch.SnapToSpatialReference();

            IFeature row1 = fc.CreateFeature();

            row1.Shape = multiPatch;
            row1.Store();
            const bool includeInnerRings      = true;
            const bool doNotIncludeInnerRings = false;

            var test   = new QaMpConstantPointIdsPerRing(fc, doNotIncludeInnerRings);
            var runner = new QaTestRunner(test);

            runner.Execute(row1);
            Assert.AreEqual(0, runner.Errors.Count);

            test   = new QaMpConstantPointIdsPerRing(fc, includeInnerRings);
            runner = new QaTestRunner(test);
            runner.Execute(row1);
            Assert.AreEqual(1, runner.Errors.Count);
        }
示例#11
0
        public void Gen2847_NonZawarePolylineWithInteriorLoops()
        {
            var    locator = TestDataUtils.GetTestDataLocator();
            string path    = locator.GetPath("DKM25_HOEHENKURVE_OID_2178.xml");

            var nonZAwarePolyline = (IPolyline)GeometryUtils.FromXmlFile(path);

            var fc = new FeatureClassMock(1, "Contours", esriGeometryType.esriGeometryPolyline,
                                          esriFeatureType.esriFTSimple,
                                          nonZAwarePolyline.SpatialReference,
                                          hasZ: false, hasM: false);

            IFeature f = fc.CreateFeature(nonZAwarePolyline);

            const double toleranceFactor = 1.0;
            var          test            = new QaSimpleGeometry(fc, false, toleranceFactor);
            var          runner          = new QaTestRunner(test)
            {
                KeepGeometry = true
            };

            runner.Execute(f);

            Assert.AreEqual(1, runner.Errors.Count);
            Assert.AreEqual(3, ((IPointCollection)runner.ErrorGeometries[0]).PointCount);
        }
示例#12
0
        private static IFeature CreateFeature([NotNull] FeatureClassMock featureClass,
                                              double x, object xFieldValue,
                                              double y, object yFieldValue,
                                              double z, object zFieldValue)
        {
            int fieldIndexX = featureClass.FindField(_fieldNameX);
            int fieldIndexY = featureClass.FindField(_fieldNameY);
            int fieldIndexZ = featureClass.FindField(_fieldNameZ);

            IFeature feature = featureClass.CreateFeature(GeometryFactory.CreatePoint(x, y, z));

            if (fieldIndexX >= 0)
            {
                feature.set_Value(fieldIndexX, xFieldValue);
            }

            if (fieldIndexY >= 0)
            {
                feature.set_Value(fieldIndexY, yFieldValue);
            }

            if (fieldIndexZ >= 0)
            {
                feature.set_Value(fieldIndexZ, zFieldValue);
            }

            feature.Store();

            return(feature);
        }
示例#13
0
        public void VerifyErrorTypes()
        {
            var featureClassMock = new FeatureClassMock(1, "mock",
                                                        esriGeometryType.esriGeometryMultiPatch);

            var construction = new MultiPatchConstruction();

            construction.StartRing(5, 4, 0)
            .Add(-5, 4, 0.1)
            .Add(-5, -3, 0.05)
            .Add(5, -7, -0.1)
            .Add(5, -8, -0.1)
            .Add(5, -11, 0.0);

            IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            var test   = new QaHorizontalSegments(featureClassMock, 5, 0);
            var runner = new QaTestRunner(test);

            runner.Execute(row1);

            Assert.AreEqual(2, runner.Errors.Count);
            Assert.AreNotEqual(runner.Errors[0].Description.Split()[1],
                               runner.Errors[1].Description.Split()[1]);
        }
示例#14
0
        public void CanTestMultiPatchesSimple()
        {
            var featureClassMock = new FeatureClassMock(1, "mock",
                                                        esriGeometryType.esriGeometryMultiPatch);

            var construction = new MultiPatchConstruction();

            construction.StartRing(0, 0, 0)
            .Add(1, 0, 0)
            .Add(1, 0, 1)
            .Add(0, 0, 1);

            IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            var errorRunner =
                new QaTestRunner(new QaMinMeanSegmentLength(featureClassMock, 1.5, false));

            errorRunner.Execute(row1);
            Assert.AreEqual(1, errorRunner.Errors.Count);

            var noErrorRunner =
                new QaTestRunner(new QaMinMeanSegmentLength(featureClassMock, 0.9, false));

            noErrorRunner.Execute(row1);
            Assert.AreEqual(0, noErrorRunner.Errors.Count);
        }
示例#15
0
        public void CanReportMultipartFootPrintVerticalWall()
        {
            FeatureClassMock featureClassMock = CreateFeatureClassMock();

            var construction = new MultiPatchConstruction();

            // second ring is vertical wall, disjoint from first ring
            construction.StartOuterRing(0, 0, 0)
            .Add(10, 0, 0)
            .Add(10, 10, 0)
            .Add(0, 10, 0)
            .StartOuterRing(20, 0, 100)
            .Add(30, 0, 100)
            .Add(30, 0, 110)
            .Add(20, 0, 110);

            IFeature row = featureClassMock.CreateFeature(construction.MultiPatch);

            var test   = new QaMpSinglePartFootprint(featureClassMock);
            var runner = new QaTestRunner(test);

            runner.Execute(row);

            AssertUtils.OneError(runner, "MpSinglePartFootprint.FootprintHasMultipleParts");
        }
示例#16
0
        public void CanTestMultiPatches()
        {
            var featureClassMock = new FeatureClassMock(1, "mock",
                                                        esriGeometryType.esriGeometryMultiPatch);

            var construction = new MultiPatchConstruction();

            construction.StartRing(0, 0, 0)
            .Add(5, 0, 0)
            .Add(5, 0, 1)
            .Add(0, 0, 1);

            IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            var noErrorRunner =
                new QaTestRunner(new QaSliverPolygon(featureClassMock, 50, 1000));

            noErrorRunner.Execute(row1);
            Assert.AreEqual(0, noErrorRunner.Errors.Count);

            var oneErrorRunner =
                new QaTestRunner(new QaSliverPolygon(featureClassMock, 20, 1000));

            oneErrorRunner.Execute(row1);
            Assert.AreEqual(1, oneErrorRunner.Errors.Count);
        }
示例#17
0
        public void VerifySegmentsGroupContinuously()
        {
            var featureClassMock = new FeatureClassMock(1, "mock",
                                                        esriGeometryType.esriGeometryMultiPatch);

            const double nearAngle = 5;

            var construction = new MultiPatchConstruction();

            construction.StartOuterRing(0, 0, 0)
            .Add(5, 0, 0)
            .Add(5.01, 1, 0)
            .Add(10, 1, 0)
            .Add(10.01, 0, 0)
            .Add(5, -3, 0);

            IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            var test = new QaMpHorizontalPerpendicular(featureClassMock, nearAngle, 0, 0, false,
                                                       0);
            var runner = new QaTestRunner(test);

            runner.Execute(row1);
            Assert.AreEqual(1, runner.Errors.Count);
        }
示例#18
0
        public void CanTestPolylineFeaturePath()
        {
            IFeatureClass fc = new FeatureClassMock(1, "LineFc",
                                                    esriGeometryType.esriGeometryPolyline);

            IFeature feature = fc.CreateFeature();

            IPolycurve correctPath = CurveConstruction.StartLine(100, 100)
                                     .LineTo(110, 110)
                                     .Curve;
            // note: union converts linear circular arcs to lines -> make sure the arc is not linear
            IPolycurve incorrectPath = CurveConstruction.StartLine(0, 0)
                                       .LineTo(10, 10)
                                       .CircleTo(30, 10)
                                       .Curve;

            feature.Shape = GeometryUtils.Union(correctPath, incorrectPath);
            feature.Store();

            var test   = new QaGeometryConstraint(fc, "$CircularArcCount = 0", perPart: true);
            var runner = new QaTestRunner(test);

            runner.Execute(feature);

            QaError error;

            AssertUtils.OneError(runner,
                                 "GeometryConstraint.ConstraintNotFulfilled.ForShapePart",
                                 out error);

            Assert.True(GeometryUtils.AreEqual(incorrectPath,
                                               GeometryFactory.CreatePolyline(error.Geometry)));
        }
示例#19
0
        public void CanReportNonUniquePointIds()
        {
            FeatureClassMock featureClassMock = CreateFeatureClassMock();

            var construction = new MultiPatchConstruction();

            const int id1 = 1;
            const int id2 = 2;

            construction.StartOuterRing(0, 0, 0, id1)
            .Add(10, 0, 0, id2)
            .Add(10, 10, 0, id2)
            .Add(0, 10, 0, id2);

            IFeature row = featureClassMock.CreateFeature(construction.MultiPatch);

            const bool allowIntersectionsForDifferentPointIds = true;
            var        test = new QaMpNonIntersectingRingFootprints(featureClassMock,
                                                                    allowIntersectionsForDifferentPointIds);
            var runner = new QaTestRunner(test);

            runner.Execute(row);

            // only reported if allowIntersectionsForDifferentPointIds == true
            AssertUtils.OneError(runner,
                                 "MpNonIntersectingRingFootprints.PointIdNotUniqueWithinFace");
        }
示例#20
0
        public void CanReportIntersectingFootPrints()
        {
            FeatureClassMock featureClassMock = CreateFeatureClassMock();

            var construction = new MultiPatchConstruction();

            const int id1 = 1;

            construction.StartOuterRing(0, 0, 0, id1)
            .Add(10, 0, 0, id1)
            .Add(10, 10, 0, id1)
            .Add(0, 10, 0, id1)
            .StartOuterRing(9, 0, 10, id1)
            .Add(20, 0, 10, id1)
            .Add(20, 10, 10, id1)
            .Add(9, 10, 10, id1);

            IFeature row = featureClassMock.CreateFeature(construction.MultiPatch);

            const bool allowIntersectionsForDifferentPointIds = true;
            var        test = new QaMpNonIntersectingRingFootprints(featureClassMock,
                                                                    allowIntersectionsForDifferentPointIds);
            var runner = new QaTestRunner(test);

            runner.Execute(row);

            AssertUtils.OneError(runner,
                                 "MpNonIntersectingRingFootprints.RingFootprintsIntersect");
        }
示例#21
0
        public void CanAllowIntersectingFootPrintsWithVerticalWall()
        {
            FeatureClassMock featureClassMock = CreateFeatureClassMock();

            var construction = new MultiPatchConstruction();

            // second ring is vertical wall, intersecting the first ring
            construction.StartOuterRing(0, 0, 0)
            .Add(10, 0, 0)
            .Add(10, 10, 0)
            .Add(0, 10, 0)
            .StartOuterRing(5, 5, 100)
            .Add(15, 5, 100)
            .Add(15, 5, 110)
            .Add(5, 5, 110);

            IFeature row = featureClassMock.CreateFeature(construction.MultiPatch);

            const bool allowIntersectionsForDifferentPointIds = true;
            var        test = new QaMpNonIntersectingRingFootprints(featureClassMock,
                                                                    allowIntersectionsForDifferentPointIds);
            var runner = new QaTestRunner(test);

            runner.Execute(row);

            AssertUtils.NoError(runner);
        }
示例#22
0
        public void CanAllowMultipartFootPrintTouchingInLine()
        {
            FeatureClassMock featureClassMock = CreateFeatureClassMock();

            var construction = new MultiPatchConstruction();

            construction.StartOuterRing(0, 0, 0)
            .Add(10, 0, 0)
            .Add(10, 10, 0)
            .Add(0, 10, 0)
            .StartOuterRing(10, 5, 100)
            .Add(20, 5, 100)
            .Add(20, 15, 100)
            .Add(10, 15, 100);

            IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            const bool allowIntersectionsForDifferentPointIds = true;
            var        test = new QaMpNonIntersectingRingFootprints(featureClassMock,
                                                                    allowIntersectionsForDifferentPointIds);
            var runner = new QaTestRunner(test);

            runner.Execute(row1);

            AssertUtils.NoError(runner);
        }
        public void CanTestNaNZs()
        {
            var multiPatchClass = new FeatureClassMock(
                1, "multipatch", esriGeometryType.esriGeometryMultiPatch);
            var polygonClass = new FeatureClassMock(
                1, "polygon", esriGeometryType.esriGeometryPolygon);

            var multiPatch = new MultiPatchConstruction();

            multiPatch.StartOuterRing(0, 0, 0)
            .Add(5, 0, 0)
            .Add(5, 1, 5)
            .Add(0, 1, 5);

            IFeature multiPatchRow = multiPatchClass.CreateFeature(multiPatch.MultiPatch);

            CurveConstruction polygon =
                CurveConstruction.StartPoly(0, 0)
                .LineTo(10, 0)
                .LineTo(0, 10);

            IFeature polygonRow = polygonClass.CreateFeature(polygon.ClosePolygon());

            var test = new QaZDifferenceSelfWrapper(
                new[] { (IFeatureClass)multiPatchClass, polygonClass },
                20, 0,
                ZComparisonMethod.BoundingBox,
                null);

            var runner     = new QaTestRunner(test);
            int errorCount = test.TestDirect(multiPatchRow, 0, polygonRow, 1);

            Assert.AreEqual(1, errorCount);
            Assert.AreEqual(1, runner.Errors.Count);
        }
        public void CanTestIgnoreNearlyHorizotalInnerRings()
        {
            var featureClassMock = new FeatureClassMock(1, "mock",
                                                        esriGeometryType.esriGeometryMultiPatch);

            var construction = new MultiPatchConstruction();

            construction.StartOuterRing(0, 0, 0)
            .Add(0, 10, 0)
            .Add(10, 10, 0)
            .Add(10, 0, 0)
            .StartInnerRing(2, 2, 0.1)
            .Add(2, 8, 0)
            .Add(8, 8, -0.1)
            .Add(8, 2, 0);

            IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            construction = new MultiPatchConstruction();

            construction.StartOuterRing(0, 0, 0)
            .Add(0, 10, 10)
            .Add(10, 10, 10)
            .Add(10, 0, 0)
            .StartInnerRing(2, 2, 0.11)
            .Add(2, 8, 0)
            .Add(8, 8, -0.1)
            .Add(8, 2, 0);

            IFeature row2 = featureClassMock.CreateFeature(construction.MultiPatch);

            var test = new QaMpFootprintHoles(
                featureClassMock, InnerRingHandling.IgnoreHorizontalInnerRings)
            {
                HorizontalZTolerance = 0.2
            };

            var runner = new QaTestRunner(test);

            runner.Execute(row1);
            Assert.AreEqual(0, runner.Errors.Count);

            runner.Execute(row2);
            Assert.AreEqual(1, runner.Errors.Count);
        }
        public void VerifyNotHorizontalLinesIgnored()
        {
            var featureClassMock = new FeatureClassMock(1, "mock",
                                                        esriGeometryType.esriGeometryMultiPatch);
            // make sure the table is known by the workspace

            const double horizontalToleranceDeg = 1;
            const double dy         = 10;
            double       zLimit     = dy * Math.Tan(MathUtils.ToRadians(horizontalToleranceDeg));
            double       zNotTested = zLimit + 0.001;

            var construction = new MultiPatchConstruction();

            construction.StartOuterRing(0, 0, 0)
            .Add(0.01, dy, zNotTested)
            .Add(0, 2 * dy, 0)
            .Add(-0.01, 3 * dy, zNotTested)
            .Add(8, 4, 0);

            IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            var test = new QaMpHorizontalAzimuths(featureClassMock, 5, 0,
                                                  horizontalToleranceDeg, false);
            var runner = new QaTestRunner(test);

            runner.Execute(row1);
            Assert.AreEqual(0, runner.Errors.Count);

            double zTested = zLimit - 0.001;

            construction = new MultiPatchConstruction();
            construction.StartOuterRing(0, 0, 0)
            .Add(0.01, dy, zTested)
            .Add(0, 2 * dy, 0)
            .Add(-0.01, 3 * dy, zTested)
            .Add(8, 4, 0);

            row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            test = new QaMpHorizontalAzimuths(featureClassMock, 5, 0, horizontalToleranceDeg,
                                              false);
            runner = new QaTestRunner(test);
            runner.Execute(row1);
            Assert.AreEqual(1, runner.Errors.Count);
        }
        public void VerifyAzimuthsInToleranceNotReported()
        {
            var featureClassMock = new FeatureClassMock(1, "mock",
                                                        esriGeometryType.esriGeometryMultiPatch);
            // make sure the table is known by the workspace

            const double azimuthToleranceDeg = 0.5;
            const double dy     = 10;
            double       xLimit = dy * Math.Tan(MathUtils.ToRadians(azimuthToleranceDeg));
            double       xError = xLimit + 0.001;

            var construction = new MultiPatchConstruction();

            construction.StartOuterRing(0, 0, 0)
            .Add(0, dy, 0)
            .Add(xError, 2 * dy, 0)
            .Add(xError, 3 * dy, 0)
            .Add(8, 4, 0);

            IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            var test = new QaMpHorizontalAzimuths(featureClassMock, 5, azimuthToleranceDeg, 0,
                                                  false);
            var runner = new QaTestRunner(test);

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

            double xNoError = xLimit - 0.001;

            construction = new MultiPatchConstruction();
            construction.StartOuterRing(0, 0, 0)
            .Add(0, dy, 0)
            .Add(xNoError, 2 * dy, 0)
            .Add(xNoError, 3 * dy, 0)
            .Add(8, 4, 0);

            row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            test = new QaMpHorizontalAzimuths(featureClassMock, 5, azimuthToleranceDeg, 0,
                                              false);
            runner = new QaTestRunner(test);
            runner.Execute(row1);
            Assert.AreEqual(0, runner.Errors.Count);
        }
示例#27
0
        private static IFeature CreateFeature([NotNull] FeatureClassMock networkClass,
                                              [NotNull] IGeometry shape)
        {
            IFeature result = networkClass.CreateFeature(shape);

            result.Store();

            return(result);
        }
        public void VerifyAnglesLargerNearAngleNotChecked()
        {
            var featureClassMock = new FeatureClassMock(1, "mock",
                                                        esriGeometryType.esriGeometryMultiPatch);
            // make sure the table is known by the workspace

            const double nearAngle   = 5;
            const double dy          = 10;
            double       xLimit      = dy * Math.Tan(MathUtils.ToRadians(nearAngle));
            double       xNotChecked = xLimit + 0.001;

            var construction = new MultiPatchConstruction();

            construction.StartOuterRing(0, 0, 0)
            .Add(0, dy, 0)
            .Add(xNotChecked, 2 * dy, 0)
            .Add(xNotChecked, 3 * dy, 0)
            .Add(8, 4, 0);

            IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            var test   = new QaMpHorizontalAzimuths(featureClassMock, nearAngle, 0, 0, false);
            var runner = new QaTestRunner(test);

            runner.Execute(row1);
            Assert.AreEqual(0, runner.Errors.Count);

            double xChecked = xLimit - 0.001;

            construction = new MultiPatchConstruction();
            construction.StartOuterRing(0, 0, 0)
            .Add(0, dy, 0)
            .Add(xChecked, 2 * dy, 0)
            .Add(xChecked, 3 * dy, 0)
            .Add(8, 4, 0);

            row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            test   = new QaMpHorizontalAzimuths(featureClassMock, nearAngle, 0, 0, false);
            runner = new QaTestRunner(test);
            runner.Execute(row1);
            Assert.AreEqual(1, runner.Errors.Count);
        }
        public void CanRegisterTestedFeature()
        {
            var overlaps = new OverlappingFeatures();

            var      fc        = new FeatureClassMock(1, "", esriGeometryType.esriGeometryPolyline);
            IFeature feature   = fc.CreateFeature(new Pt(0, 0), new Pt(9.95, 9.95));
            var      cachedRow = new CachedRow(feature);

            overlaps.RegisterTestedFeature(cachedRow, null);
        }
        public void CanTestMultiPatches()
        {
            ISpatialReference sref = SpatialReferenceUtils.CreateSpatialReference(
                WellKnownHorizontalCS.LV95);

            var featureClassMock = new FeatureClassMock(
                1, "mock",
                esriGeometryType.esriGeometryMultiPatch,
                esriFeatureType.esriFTSimple, sref);

            var construction = new MultiPatchConstruction();

            construction.StartOuterRing(5, 4, 0)
            .Add(5, 8, 0)
            .Add(8, 8, 0)
            .Add(8, 4, 0);

            IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            construction = new MultiPatchConstruction();
            construction.StartOuterRing(5, 4, 0)
            .Add(5, 8, 0)
            .Add(8, 8, 0)
            .Add(8, 4, 0)
            .StartInnerRing(6, 5, 0)
            .Add(7, 5, 0)
            .Add(7, 7, 0)
            .Add(6, 7, 0);

            IFeature row2 = featureClassMock.CreateFeature(construction.MultiPatch);

            var test   = new QaMpFootprintHoles(featureClassMock, InnerRingHandling.None);
            var runner = new QaTestRunner(test);

            runner.Execute(row1);
            Assert.AreEqual(0, runner.Errors.Count);

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