Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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");
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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");
        }
        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);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
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);
        }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
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");
        }
Ejemplo n.º 15
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]);
        }
Ejemplo n.º 16
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);
        }
Ejemplo n.º 17
0
        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);
        }
Ejemplo n.º 18
0
        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);
        }
Ejemplo n.º 19
0
        public void CanFindNonVerticalPlane()
        {
            var fc = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryMultiPatch);

            var construction = new MultiPatchConstruction();

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

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

            runner.Execute(f);
            Assert.AreEqual(1, runner.Errors.Count);
        }
Ejemplo n.º 20
0
        public void CanTestMultiPatchesPerPart()
        {
            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)
            .StartFan(2, 0, 0)
            .Add(2, 1, 0)
            .Add(3, 0, 0);

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

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

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

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

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

            var noErrorPerPartsRunner =
                new QaTestRunner(new QaMinMeanSegmentLength(featureClassMock, 0.9, true));

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

            var oneErrorRunner =
                new QaTestRunner(new QaMinMeanSegmentLength(featureClassMock, 1.1, true));

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

            var twoErrorRunner =
                new QaTestRunner(new QaMinMeanSegmentLength(featureClassMock, 1.5, true));

            twoErrorRunner.Execute(row1);
            Assert.AreEqual(2, twoErrorRunner.Errors.Count);
        }
Ejemplo n.º 21
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);
        }
Ejemplo n.º 22
0
        public void IsPlaneVerticalTest()
        {
            var construction = new MultiPatchConstruction();

            construction.StartRing(0, 0, 0)
            .Add(5, 0, 0)
            .Add(5, 0, 5)
            .Add(0, 0, 5);
            IMultiPatch        multiPatch        = construction.MultiPatch;
            IIndexedMultiPatch indexedMultiPatch =
                QaGeometryUtils.CreateIndexedMultiPatch(multiPatch);

            Plane     plane  = QaGeometryUtils.CreatePlane(indexedMultiPatch.GetSegments());
            WKSPointZ normal = plane.GetNormalVector();

            Assert.AreEqual(0, normal.Z);
        }
        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 test   = new QaMpHorizontalHeights(featureClassMock, 5, 0);
            var runner = new QaTestRunner(test);

            runner.Execute(row1);
            Assert.AreEqual(1, runner.Errors.Count);
        }
Ejemplo n.º 24
0
        public void CanTestMultiPatch1()
        {
            var fc = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryMultiPatch);

            var construction = new MultiPatchConstruction();

            construction.StartRing(2579203.89625, 1079769.675, 2485.86625000001)
            .Add(2579201.77375, 1079771.97375, 2488.5175)
            .Add(2579198.27, 1079775.7675, 2484.82375);
            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);
        }
        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 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);
        }
Ejemplo n.º 27
0
        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);
        }
Ejemplo n.º 28
0
        public void CanProjectToPlaneTest()
        {
            var construction = new MultiPatchConstruction();

            construction.StartRing(0, 0, 0)
            .Add(5, 0, 0)
            .Add(5, 0, 5)
            .Add(0, 0, 5);
            IMultiPatch        multiPatch        = construction.MultiPatch;
            IIndexedMultiPatch indexedMultiPatch =
                QaGeometryUtils.CreateIndexedMultiPatch(multiPatch);

            IList <Pnt>       points    = QaGeometryUtils.GetPoints(indexedMultiPatch.GetSegments());
            Plane             plane     = QaGeometryUtils.CreatePlane(points);
            IList <WKSPointZ> projected = QaGeometryUtils.ProjectToPlane(plane, points);

            ValidateForm(indexedMultiPatch, projected);
        }
Ejemplo n.º 29
0
        public void VerticalPlaneIssue()
        {
            var fc = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryMultiPatch);

            var construction = new MultiPatchConstruction();

            construction.StartRing(2646275.33625, 1249624.19375, 379.188750000001)
            .Add(2646269.675, 1249621.20625, 374.068750000006)
            .Add(2646280.9975, 1249627.18125, 374.068750000006);

            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);
        }
        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);
        }