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);
        }
示例#2
0
        public void TestNonEqualXCoordinateDoubleField()
        {
            var featureClass = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryPoint);

            featureClass.AddField(FieldUtils.CreateDoubleField(_fieldNameX));

            // create point feature
            const double x = 2600000;
            const double y = 1200000;
            const double z = 500;

            IFeature feature = CreateFeature(featureClass,
                                             x, x + 1.01 * _xyTolerance,
                                             y, null,
                                             z, null);

            var test = new QaValidCoordinateFields(featureClass,
                                                   _fieldNameX, null, null,
                                                   _xyTolerance, _zTolerance, _culture);

            var runner = new QaTestRunner(test);

            runner.Execute(feature);

            QaError error;

            AssertUtils.OneError(runner,
                                 "ValidCoordinateFields.XYFieldCoordinateValueTooFarFromShape",
                                 out error);
            Assert.AreEqual(_fieldNameX, error.AffectedComponent);
        }
        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);
        }
示例#4
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);
        }
示例#5
0
        public void TestAllowedCoordinatesForUndefinedShape()
        {
            var featureClass = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryPoint);

            featureClass.AddField(FieldUtils.CreateDoubleField(_fieldNameX));
            featureClass.AddField(FieldUtils.CreateDoubleField(_fieldNameY));
            featureClass.AddField(FieldUtils.CreateDoubleField(_fieldNameZ));

            // create point feature
            const double x = 2600000;
            const double y = 1200000;
            const double z = 500;

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

            feature.Shape.SetEmpty();

            var test = new QaValidCoordinateFields(featureClass,
                                                   _fieldNameX, _fieldNameY, _fieldNameZ,
                                                   _xyTolerance, _zTolerance, _culture)
            {
                AllowXYFieldValuesForUndefinedShape = true,
                AllowZFieldValueForUndefinedShape   = true
            };

            var runner = new QaTestRunner(test);

            runner.Execute(feature);

            Assert.AreEqual(0, runner.Errors.Count);
        }
示例#6
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);
        }
示例#7
0
        public void CanAllowIntersectingFootPrintsWithDifferentPointIds()
        {
            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, id1)
            .Add(10, 10, 0, id1)
            .Add(0, 10, 0, id1)
            .StartOuterRing(9, 0, 10, id2)
            .Add(20, 0, 10, id2)
            .Add(20, 10, 10, id2)
            .Add(9, 10, 10, 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);

            AssertUtils.NoError(runner);
        }
示例#8
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]);
        }
示例#9
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);
        }
示例#10
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);
        }
示例#11
0
        public void TestEqualCoordinatesTextFields()
        {
            var featureClass = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryPoint);

            featureClass.AddField(FieldUtils.CreateTextField(_fieldNameX, 50));
            featureClass.AddField(FieldUtils.CreateTextField(_fieldNameY, 50));
            featureClass.AddField(FieldUtils.CreateTextField(_fieldNameZ, 50));

            // create point feature
            const double x = 2600000.12345;
            const double y = 1200000.12345;
            const double z = 500.12345;

            IFeature feature = CreateFeature(
                featureClass,
                x, string.Format(_cultureInfo, "{0:N3}", x),
                y, string.Format(_cultureInfo, "{0:N3}", y),
                z, string.Format(_cultureInfo, "{0:N3}", z));

            var test = new QaValidCoordinateFields(featureClass,
                                                   _fieldNameX, _fieldNameY, _fieldNameZ,
                                                   _xyTolerance, _zTolerance, _culture);

            var runner = new QaTestRunner(test);

            runner.Execute(feature);

            Assert.AreEqual(0, runner.Errors.Count);
        }
示例#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 TestNonEqualCoordinatesTextFieldsBothXYJustBelowTolerance()
        {
            var featureClass = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryPoint);

            featureClass.AddField(FieldUtils.CreateTextField(_fieldNameX, 50));
            featureClass.AddField(FieldUtils.CreateTextField(_fieldNameY, 50));
            featureClass.AddField(FieldUtils.CreateTextField(_fieldNameZ, 50));

            // create point feature
            const double x = 2600000.12345;
            const double y = 1200000.12345;

            IFeature feature = CreateFeature(
                featureClass,
                x, string.Format(_cultureInfo, "{0:N3}", x + 0.9 * _xyTolerance),
                y, string.Format(_cultureInfo, "{0:N3}", y - 0.9 * _xyTolerance),
                z: 100, zFieldValue: "100");

            var test = new QaValidCoordinateFields(featureClass,
                                                   _fieldNameX, _fieldNameY, _fieldNameZ,
                                                   _xyTolerance, _zTolerance, _culture);

            var runner = new QaTestRunner(test);

            runner.Execute(feature);

            AssertUtils.OneError(runner,
                                 "ValidCoordinateFields.XYFieldCoordinatesTooFarFromShape");
        }
        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);
        }
示例#15
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);
        }
示例#16
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);
        }
        public void CanDetermineNodeDegreeAtAreaOfInterestBoundaryOneEdgeFullyOutside()
        {
            // General idea: The southernmost edge can be traversed from the inside to the
            // outside, but not vice versa. Degree 3 should be determined correctly
            //  _______________________
            //  |                     |
            //  |    \     /          |
            //  |_____\___/___________|
            //         \ /
            //          |
            //          |
            //          |
            ISpatialReference sr = SpatialReferenceUtils.CreateSpatialReference(
                WellKnownHorizontalCS.LV95, WellKnownVerticalCS.LHN95);

            IEnvelope aoi = GeometryFactory.CreateEnvelope(2600000, 1200000, 2600100, 1200100, sr);

            FeatureClassMock edgeClass =
                new FeatureClassMock(1, "ROADS", esriGeometryType.esriGeometryPolyline);

            PolylineGraphConnectivity connectivity = new PolylineGraphConnectivity(sr, aoi);

            // Create node with degree 3 where one feature is partially outside the AOI

            IPoint junction = GeometryFactory.CreatePoint(2600050, 1199900, sr);

            FeatureMock feature1 =
                new FeatureMock(11, edgeClass)
            {
                Shape = GeometryFactory.CreatePolyline(
                    GeometryFactory.CreatePoint(2600050, 1199800, sr),
                    junction)
            };

            FeatureMock feature2 =
                new FeatureMock(12, edgeClass)
            {
                Shape = GeometryFactory.CreatePolyline(
                    junction,
                    GeometryFactory.CreatePoint(2600030, 1200050, sr))
            };

            FeatureMock feature3 =
                new FeatureMock(13, edgeClass)
            {
                Shape = GeometryFactory.CreatePolyline(
                    junction,
                    GeometryFactory.CreatePoint(2600070, 1200050, sr))
            };

            connectivity.AddConnectivity(feature1, false);
            connectivity.AddConnectivity(feature2, false);
            connectivity.AddConnectivity(feature3, false);

            var edges = connectivity.GetIncidentEdges(junction).ToList();

            Assert.AreEqual(0, edges.Count);
        }
示例#18
0
        private static IFeature CreateFeature([NotNull] FeatureClassMock networkClass,
                                              [NotNull] IGeometry shape)
        {
            IFeature result = networkClass.CreateFeature(shape);

            result.Store();

            return(result);
        }
        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 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);
        }
示例#22
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);
        }
示例#23
0
        private static TopologicalLine CreateTopologicalLine([NotNull] IPolyline polyline)
        {
            const bool hasZ             = false;
            const bool hasM             = false;
            var        featureClassMock = new FeatureClassMock(1, "test_polylines",
                                                               esriGeometryType.esriGeometryPolyline,
                                                               esriFeatureType.esriFTSimple,
                                                               polyline.SpatialReference,
                                                               hasZ, hasM);
            IFeature feature = featureClassMock.CreateFeature(polyline);

            const int tableIndex = 0;

            return(new TopologicalLine(new TableIndexRow(feature, tableIndex), -1));
        }
示例#24
0
        public void CanDetectTooFewRows()
        {
            var verified = new FeatureClassMock(1, "v", _gt)
            {
                RowCountResult = 999
            };

            var test = new QaRowCount(verified, 1000, 2000);

            var runner = new QaTestRunner(test);

            runner.Execute();

            AssertUtils.OneError(runner, "RowCount.TooFewRows");
        }
示例#25
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);
        }
        public void CanTestNonEmptyGeometry_Polyline()
        {
            IFeatureClass fc = new FeatureClassMock(1, "LineFc",
                                                    esriGeometryType.esriGeometryPolyline);

            IFeature feature = fc.CreateFeature();

            feature.Shape = CurveConstruction.StartLine(0, 0).LineTo(10, 10).Curve;
            feature.Store();

            var test   = new QaNonEmptyGeometry(fc);
            var runner = new QaTestRunner(test);

            runner.Execute(feature);

            AssertUtils.NoError(runner);
        }
        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);
        }
示例#28
0
        public void CantDefineTestWithoutOffset()
        {
            Assert.Throws <ArgumentException>(
                delegate
            {
                var verified = new FeatureClassMock(1, "v", _gt)
                {
                    RowCountResult = 500
                };
                var r = new FeatureClassMock(2, "r", _gt)
                {
                    RowCountResult = 1000
                };

                new QaRowCount(verified, new ITable[] { r }, " ", null);
            });
        }
        public void CanTestNonEmptyGeometry_Point()
        {
            IFeatureClass fc = new FeatureClassMock(1, "PointFc",
                                                    esriGeometryType.esriGeometryPoint);

            IFeature feature = fc.CreateFeature();

            feature.Shape = GeometryFactory.CreatePoint(0, 0);
            feature.Store();

            var test   = new QaNonEmptyGeometry(fc);
            var runner = new QaTestRunner(test);

            runner.Execute(feature);

            AssertUtils.NoError(runner);
        }
示例#30
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);
        }