Exemple #1
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");
        }
        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);
        }
Exemple #3
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);
        }
Exemple #4
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);
        }
Exemple #5
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);
        }
Exemple #6
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);
        }
Exemple #7
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");
        }
Exemple #8
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");
        }
        public void CanTestConstraint()
        {
            ISpatialReference sref = SpatialReferenceUtils.CreateSpatialReference(
                WellKnownHorizontalCS.LV95);

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

            multiPatchClass.AddField("Level", esriFieldType.esriFieldTypeInteger);
            int levelIndex = multiPatchClass.FindField("Level");

            var polygonClass = new FeatureClassMock(
                1, "polygon", esriGeometryType.esriGeometryPolygon,
                esriFeatureType.esriFTSimple, sref);

            polygonClass.AddField("Level", esriFieldType.esriFieldTypeInteger);

            var multiPatchConstruction = new MultiPatchConstruction();

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

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

            multiPatchRow.set_Value(levelIndex, 2);

            CurveConstruction curveConstruction =
                CurveConstruction.StartPoly(0, 0, 50)
                .LineTo(10, 0, 50)
                .LineTo(0, 10, 50);

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

            polygonRow.set_Value(levelIndex, 1);

            var test = new QaZDifferenceSelfWrapper(
                new[] { (IFeatureClass)multiPatchClass, polygonClass },
                20, 0,
                ZComparisonMethod.BoundingBox,
                "U.Level > L.Level");

            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 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);
        }
Exemple #11
0
        private static IMultiPatch GetMultiPatch(int pointCount)
        {
            var construction = new MultiPatchConstruction();

            construction.StartOuterRing(5, 4, 0);

            double dx = 10.0 / pointCount;

            for (int i = 1; i < pointCount; i++)
            {
                construction.Add(5 - i * dx, 4, 0);
            }

            construction.Add(-5, 4, 0).Add(-5, -4, 0).Add(5, -4, 0);

            return(construction.MultiPatch);
        }
        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);
        }
        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 CanTestMultiPatches()
        {
            var featureClassMock = new FeatureClassMock(1, "mock",
                                                        esriGeometryType.esriGeometryMultiPatch);
            // make sure the table is known by the workspace

            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(6.01, 7, 0).Add(7, 7, 0);

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

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

            runner.Execute(row1);
            Assert.AreEqual(1, runner.Errors.Count);
        }
        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);
        }
Exemple #17
0
        public void CanAllowSimpleMultiPatch()
        {
            FeatureClassMock featureClassMock = CreateFeatureClassMock();

            var construction = new MultiPatchConstruction();

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

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

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

            runner.Execute(row);

            AssertUtils.NoError(runner);
        }
Exemple #18
0
        public void CanGetInnerPartIndexesOuterRingRing()
        {
            var construction = new MultiPatchConstruction();

            construction.StartOuterRing(5, 4, 0).Add(-5, 4, 0).Add(-5, -4, 0).Add(5, -4, 0)
            .StartRing(4, 3, 0).Add(-4, 3, 0).Add(-4, -3, 0).Add(4, -3, 0);

            IMultiPatch multiPatch = construction.MultiPatch;

            ((IGeometry)multiPatch).SpatialReference =
                SpatialReferenceUtils.CreateSpatialReference(
                    (int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95);

            IIndexedMultiPatch indexedMultiPatch =
                QaGeometryUtils.CreateIndexedMultiPatch(multiPatch);

            List <int> innerPartIndexes =
                MultiPatchUtils.GetInnerRingPartIndexes(indexedMultiPatch, 0);

            Assert.AreEqual(0, innerPartIndexes.Count);
        }
        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);
        }
        public void CanTestVertexNotNearFaceAboveHorizontal()
        {
            IFeatureClass fc =
                CreateFeatureClass(_testWs, "CanTestVertexNotNearFaceHorizontal");

            var construction = new MultiPatchConstruction();

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

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

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

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

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

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

            var runner = new QaContainerTestRunner(10000, test);

            runner.Execute();
            Assert.AreEqual(1, runner.Errors.Count);
        }
Exemple #21
0
        public void VerifyErrorInToleranceNotReported()
        {
            var featureClassMock = new FeatureClassMock(1, "mock",
                                                        esriGeometryType.esriGeometryMultiPatch);

            const double toleranceAngle = 0.5;
            const double dy             = 10;
            double       dz             = dy * Math.Tan(MathUtils.ToRadians(toleranceAngle));

            var construction = new MultiPatchConstruction();

            construction.StartOuterRing(5, 0, 0)
            .Add(5, dy, 1.1 * dz)
            .Add(5, 2 * dy, 0)
            .Add(4, 4, 0);

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

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

            runner.Execute(row1);

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

            construction = new MultiPatchConstruction();
            construction.StartOuterRing(5, 0, 0)
            .Add(5, dy, 0.9 * dz)
            .Add(5, 2 * dy, 0)
            .Add(4, 4, 0);

            row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            test   = new QaHorizontalSegments(featureClassMock, 5, toleranceAngle);
            runner = new QaTestRunner(test);
            runner.Execute(row1);

            Assert.AreEqual(0, runner.Errors.Count);
        }
Exemple #22
0
        public void VerifyStepSegmentsNotTested()
        {
            var featureClassMock = new FeatureClassMock(1, "mock",
                                                        esriGeometryType.esriGeometryMultiPatch);

            const double limitAngle = 5;
            const double dy         = 10;
            double       dz         = dy * Math.Tan(MathUtils.ToRadians(limitAngle));

            var construction = new MultiPatchConstruction();

            construction.StartOuterRing(5, 0, 0)
            .Add(5, dy, dz + 0.01)
            .Add(5, 2 * dy, 0)
            .Add(4, 4, 0);

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

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

            runner.Execute(row1);

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

            construction = new MultiPatchConstruction();
            construction.StartOuterRing(5, 0, 0)
            .Add(5, dy, dz - 0.01)
            .Add(5, 2 * dy, 0)
            .Add(4, 4, 0);

            row1 = featureClassMock.CreateFeature(construction.MultiPatch);

            test   = new QaHorizontalSegments(featureClassMock, limitAngle, 0);
            runner = new QaTestRunner(test);
            runner.Execute(row1);

            Assert.AreEqual(1, runner.Errors.Count);
        }
Exemple #23
0
        public void CanReportMultipartFootPrintTouchingInPoint()
        {
            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, 10, 0)
            .Add(20, 10, 0)
            .Add(20, 20, 0)
            .Add(10, 20, 0);

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

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

            runner.Execute(row);

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

            var construction = new MultiPatchConstruction();

            construction.StartOuterRing(5, 4, 10)
            .Add(-5, 4, 10.1)
            .Add(-5, -3, 10.05)
            .Add(5, -7, 10);

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

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

            runner.KeepGeometry = true;

            runner.Execute(row1);

            Assert.AreEqual(1, runner.Errors.Count);
            Assert.IsTrue(runner.ErrorGeometries[0].Envelope.ZMin > 5);
        }
Exemple #25
0
        public void VerifyErrorTypes()
        {
            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();

            var errorDict = new Dictionary <string, string>();
            // throws an error if the same error description is added

            IFeature   row1 = fc.CreateFeature(multiPatch);
            const bool includeInnerRings      = true;
            const bool doNotIncludeInnerRings = false;

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

            runner.Execute(row1);
            Assert.AreEqual(1, runner.Errors.Count);
            errorDict.Add(runner.Errors[0].Description, "");

            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, 3);
            multiPatch = construction.MultiPatch;
            multiPatch.SpatialReference = ((IGeoDataset)fc).SpatialReference;
            multiPatch.SnapToSpatialReference();

            row1 = fc.CreateFeature(multiPatch);

            test   = new QaMpConstantPointIdsPerRing(fc, includeInnerRings);
            runner = new QaTestRunner(test);
            runner.Execute(row1);
            Assert.AreEqual(1, runner.Errors.Count);
            errorDict.Add(runner.Errors[0].Description, "");

            construction = new MultiPatchConstruction();
            construction.StartOuterRing(5, 4, 0, 1).Add(5, 8, 0, 3).Add(8, 8, 0, 4).Add(8, 4, 0, 1)
            .StartInnerRing(6, 5, 0, 2).Add(6, 7, 0, 2).Add(7, 7, 0, 3);
            multiPatch = construction.MultiPatch;
            multiPatch.SpatialReference = ((IGeoDataset)fc).SpatialReference;
            multiPatch.SnapToSpatialReference();

            row1 = fc.CreateFeature(multiPatch);

            test   = new QaMpConstantPointIdsPerRing(fc, includeInnerRings);
            runner = new QaTestRunner(test);
            runner.Execute(row1);
            Assert.AreEqual(1, runner.Errors.Count);
            errorDict.Add(runner.Errors[0].Description, "");

            construction = new MultiPatchConstruction();
            construction.StartOuterRing(5, 4, 0, 1).Add(5, 8, 0, 2).Add(8, 8, 0, 3).Add(8, 4, 0, 3)
            .StartInnerRing(6, 5, 0, 1).Add(6, 7, 0, 1).Add(7, 7, 0, 1);
            multiPatch = construction.MultiPatch;
            multiPatch.SpatialReference = ((IGeoDataset)fc).SpatialReference;
            multiPatch.SnapToSpatialReference();

            row1 = fc.CreateFeature(multiPatch);

            test   = new QaMpConstantPointIdsPerRing(fc, doNotIncludeInnerRings);
            runner = new QaTestRunner(test);
            runner.Execute(row1);
            Assert.AreEqual(1, runner.Errors.Count);
            errorDict.Add(runner.Errors[0].Description, "");

            construction = new MultiPatchConstruction();
            construction.StartOuterRing(5, 4, 0, 1).Add(5, 8, 0, 1).Add(8, 8, 0, 3).Add(8, 4, 0, 1)
            .StartInnerRing(6, 5, 0, 1).Add(6, 7, 0, 1).Add(7, 7, 0, 1);
            multiPatch = construction.MultiPatch;
            multiPatch.SpatialReference = ((IGeoDataset)fc).SpatialReference;
            multiPatch.SnapToSpatialReference();

            row1 = fc.CreateFeature(multiPatch);

            test   = new QaMpConstantPointIdsPerRing(fc, doNotIncludeInnerRings);
            runner = new QaTestRunner(test);
            runner.Execute(row1);
            Assert.AreEqual(1, runner.Errors.Count);
            errorDict.Add(runner.Errors[0].Description, "");
        }
        public void VerifySegmentsGroupContinuously()
        {
            var featureClassMock = new FeatureClassMock(1, "mock",
                                                        esriGeometryType.esriGeometryMultiPatch);
            // make sure the table is known by the workspace

            const double nearAngle = 5;
            const double y         = 10;

            var    construction = new MultiPatchConstruction();
            double xi           = 0;
            double yi           = y;

            construction.StartOuterRing(0, 0, 0)
            .Add(xi, yi, 0);

            double angleRad = 1.01 * MathUtils.ToRadians(nearAngle);

            for (int i = 1; i < 4; i++)
            {
                double currentAngle = i * angleRad;
                double dx           = y * Math.Sin(currentAngle);
                double dy           = y * Math.Cos(currentAngle);

                xi += dx;
                yi += dy;

                construction.Add(xi, yi, 0);
            }

            construction.Add(20, 0, 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);

            construction = new MultiPatchConstruction();
            xi           = 0;
            yi           = y;
            construction.StartOuterRing(0, 0, 0)
            .Add(xi, yi, 0);

            angleRad = 0.99 * MathUtils.ToRadians(nearAngle);
            for (int i = 1; i < 4; i++)
            {
                double currentAngle = i * angleRad;
                double dx           = y * Math.Sin(currentAngle);
                double dy           = y * Math.Cos(currentAngle);

                xi += dx;
                yi += dy;

                construction.Add(xi, yi, 0);
            }

            construction.Add(20, 0, 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 CanTestVerticalMultiPatches()
        {
            var featureClassMock = new FeatureClassMock(1, "mock",
                                                        esriGeometryType.esriGeometryMultiPatch);

            var construction = new MultiPatchConstruction();

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

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

            construction = new MultiPatchConstruction();

            construction.StartOuterRing(0, 0, 0)
            .Add(5, 0, 0)
            .Add(5, 0, 5)
            .Add(0, 0, 5)
            .StartOuterRing(5, 0, 0)
            .Add(2, 5, 0)
            .Add(2, 5, 0)
            .Add(5, 0, 5)
            .StartOuterRing(2, 5, 0)
            .Add(0, 0, 0)
            .Add(0, 0, 5)
            .Add(2, 5, 5)
            .StartOuterRing(0, 0, 5)
            .Add(5, 0, 5)
            .Add(2, 5, 5)
            .StartInnerRing(1, 1, 5)
            .Add(2, 4, 5)
            .Add(4, 1, 5);

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

            construction = new MultiPatchConstruction();
            // 1 vertical rings building building a hole --> leads to no error !? Handle specially?
            construction.StartOuterRing(0, 0, 0)
            .Add(5, 0, 0)
            .Add(5, 0, 5)
            .Add(0, 0, 5)
            .StartOuterRing(0, 0, 5)
            .Add(2, 5, 5)
            .Add(2, 8, 5)
            .StartOuterRing(5, 0, 5)
            .Add(2, 8, 5)
            .Add(2, 5, 5);

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

            construction = new MultiPatchConstruction();
            // 3 vertical rings building a prisma --> leads to no error !? Handle specially?
            construction.StartOuterRing(0, 0, 0)
            .Add(5, 0, 0)
            .Add(5, 0, 5)
            .Add(0, 0, 5)
            .StartOuterRing(5, 0, 0)
            .Add(2, 5, 0)
            .Add(2, 5, 5)
            .Add(5, 0, 5)
            .StartOuterRing(2, 5, 0)
            .Add(0, 0, 0)
            .Add(0, 0, 5)
            .Add(2, 5, 5);

            IFeature row4 = 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);

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

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