예제 #1
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);
        }
예제 #2
0
        public void CanTestMultiPatch()
        {
            IPolygon polygon =
                GeometryFactory.CreatePolygon(GeometryFactory.CreateEnvelope(0, 0, 10, 10,
                                                                             100, 100));

            IMultiPatch multiPatch = GeometryFactory.CreateMultiPatch(polygon, 10);

            multiPatch.SpatialReference = CreateSpatialReference();
            multiPatch.SnapToSpatialReference();

            AssertFulfilled("$ISCLOSED IS NULL", multiPatch);
            AssertFulfilled("$CIRCULARARCCOUNT = 0", multiPatch);
            AssertFulfilled("$ELLIPTICARCCOUNT = 0", multiPatch);
            AssertFulfilled("$BEZIERCOUNT = 0", multiPatch);
            AssertFulfilled("$SEGMENTCOUNT = 0", multiPatch);
            AssertFulfilled("$LINEARSEGMENTCOUNT = 0", multiPatch);
            AssertFulfilled("$NONLINEARSEGMENTCOUNT = 0", multiPatch);
            AssertFulfilled("$PARTCOUNT = 3", multiPatch);             // 2 rings, one triangle strip
            AssertFulfilled("$VERTEXCOUNT = 20", multiPatch);
            AssertFulfilled("$ISMULTIPART", multiPatch);
            AssertFulfilled("$AREA = 100", multiPatch);
            AssertFulfilled("$LENGTH = 40", multiPatch);
            AssertFulfilled("$SLIVERRATIO = 16", multiPatch);
            AssertFulfilled("$DIMENSION = 2", multiPatch);
            AssertFulfilled("$INTERIORRINGCOUNT = 0", multiPatch);
            AssertFulfilled("$EXTERIORRINGCOUNT = 2", multiPatch);
            AssertFulfilled("$RINGCOUNT = 2", multiPatch);
            AssertFulfilled("$TRIANGLEFANCOUNT = 0", multiPatch);
            AssertFulfilled("$TRIANGLESTRIPCOUNT = 1", multiPatch);
            AssertFulfilled("$TRIANGLESPATCHCOUNT = 0", multiPatch);
            AssertFulfilled("NOT $ISEXTERIORRING", multiPatch);
            AssertFulfilled("NOT $ISINTERIORRING", multiPatch);
            AssertFulfilled("$XMIN = 0", multiPatch);
            AssertFulfilled("$YMIN = 0", multiPatch);
            AssertFulfilled("$XMAX = 10", multiPatch);
            AssertFulfilled("$YMAX = 10", multiPatch);
            AssertFulfilled("$ZMIN = 100", multiPatch);
            AssertFulfilled("$ZMAX = 110", multiPatch);
            AssertFulfilled("$MMIN IS NULL", multiPatch);
            AssertFulfilled("$MMAX IS NULL", multiPatch);
            AssertFulfilled("$UNDEFINEDMVALUECOUNT = 20", multiPatch);
            AssertFulfilled("$CONTROLPOINTCOUNT = 0", multiPatch);
        }
예제 #3
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, "");
        }