Пример #1
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);
        }
Пример #2
0
        public void CanGetChangedDuplicateVerticesPolylineSelfIntersecting()
        {
            // the source polyline visits the same points several times by going back and forth
            ISpatialReference lv95 =
                SpatialReferenceUtils.CreateSpatialReference(WellKnownHorizontalCS.LV95);

            var fc = new FeatureClassMock(1, "Fc",
                                          esriGeometryType.esriGeometryPolyline,
                                          esriFeatureType.esriFTSimple,
                                          lv95);

            IPolyline polyline = GeometryFactory.CreatePolyline(
                lv95,
                GeometryFactory.CreatePoint(0, 0),
                GeometryFactory.CreatePoint(10, 0),
                GeometryFactory.CreatePoint(10, 10),
                GeometryFactory.CreatePoint(5, 0),
                GeometryFactory.CreatePoint(20, 10),
                GeometryFactory.CreatePoint(30, 10));

            IFeature f = fc.CreateFeature(polyline);

            var test   = new QaSimpleGeometry(fc, false);
            var runner = new QaTestRunner(test)
            {
                KeepGeometry = true
            };

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

            IGeometry errorGeometry = runner.ErrorGeometries[0];

            Console.WriteLine(GeometryUtils.ToString(errorGeometry));
            Assert.AreEqual(2, ((IPointCollection)errorGeometry).PointCount);

            GeometryUtils.Simplify(polyline);

            runner = new QaTestRunner(test);

            // The error remains...
            runner.Execute(f);
            Assert.AreEqual(1, runner.Errors.Count);
        }
Пример #3
0
        public void CanGetChangedDuplicateVerticesPolygonWithSameStartPoint()
        {
            // the source polyline visits the same points several times by going back and forth
            ISpatialReference lv95 =
                SpatialReferenceUtils.CreateSpatialReference(WellKnownHorizontalCS.LV95);

            var fc = new FeatureClassMock(1, "Fc",
                                          esriGeometryType.esriGeometryPolygon,
                                          esriFeatureType.esriFTSimple,
                                          lv95);

            IPolyline polyline = GeometryFactory.CreatePolyline(
                lv95,
                GeometryFactory.CreatePoint(0, 0),
                GeometryFactory.CreatePoint(10, 0),
                GeometryFactory.CreatePoint(20, 0),
                GeometryFactory.CreatePoint(10, 0),
                GeometryFactory.CreatePoint(20, 0),
                GeometryFactory.CreatePoint(30, 10));

            IPolygon sourcePolygon = GeometryFactory.CreatePolygon(polyline);

            IFeature f = fc.CreateFeature(sourcePolygon);

            var test   = new QaSimpleGeometry(fc, false);
            var runner = new QaTestRunner(test)
            {
                KeepGeometry = true
            };

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

            Assert.AreEqual(2, ((IPointCollection)runner.ErrorGeometries[0]).PointCount);

            GeometryUtils.Simplify(sourcePolygon);

            runner = new QaTestRunner(test);

            runner.Execute(f);
            Assert.AreEqual(0, runner.Errors.Count);
        }