예제 #1
0
        public void CanTestPolylineFeaturePath()
        {
            IFeatureClass fc = new FeatureClassMock(1, "LineFc",
                                                    esriGeometryType.esriGeometryPolyline);

            IFeature feature = fc.CreateFeature();

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

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

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

            runner.Execute(feature);

            QaError error;

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

            Assert.True(GeometryUtils.AreEqual(incorrectPath,
                                               GeometryFactory.CreatePolyline(error.Geometry)));
        }
예제 #2
0
        public void CanTestPolylineFeature()
        {
            IFeatureClass fc = new FeatureClassMock(1, "LineFc",
                                                    esriGeometryType.esriGeometryPolyline);

            IFeature feature = fc.CreateFeature();

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

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

            runner.Execute(feature);

            QaError error;

            AssertUtils.OneError(runner, "GeometryConstraint.ConstraintNotFulfilled.ForShape",
                                 out error);
            Assert.True(GeometryUtils.AreEqual(feature.Shape, error.Geometry));
        }