public void TestPoints()
        {
            IFeatureClass featureClass =
                TestWorkspaceUtils.CreateSimpleFeatureClass(
                    _testWs, "points",
                    null,
                    esriGeometryType.esriGeometryPoint,
                    esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95, 0d,
                    true);

            IFeature row1 = featureClass.CreateFeature();

            row1.Shape = GeometryFactory.CreatePoint(2000001, 1000000, 0);             //below
            row1.Store();
            IFeature row2 = featureClass.CreateFeature();

            row2.Shape = GeometryFactory.CreatePoint(2000002, 1000000, 100);             //border
            row2.Store();
            IFeature row3 = featureClass.CreateFeature();

            row3.Shape = GeometryFactory.CreatePoint(2000003, 1000000, 200);             //inside
            row3.Store();
            IFeature row4 = featureClass.CreateFeature();

            row4.Shape = GeometryFactory.CreatePoint(2000004, 1000000, 300);             //border
            row4.Store();
            IFeature row5 = featureClass.CreateFeature();

            row5.Shape = GeometryFactory.CreatePoint(2000005, 1000000, 400);             //above
            row5.Store();

            RunTest(featureClass, 100, 300, 2);
        }
Exemple #2
0
        public void TestMultipatch()
        {
            IFeatureClass featureClass =
                TestWorkspaceUtils.CreateSimpleFeatureClass(
                    _testWs, "TestMultipatch", null, esriGeometryType.esriGeometryMultiPatch,
                    esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95, 0.001, true);

            // make sure the table is known by the workspace
            ((IWorkspaceEdit)_testWs).StartEditing(false);
            ((IWorkspaceEdit)_testWs).StopEditing(true);

            {
                // Create error Feature
                IFeature     row = featureClass.CreateFeature();
                const double x   = 2600000;
                const double y   = 1200000;
                const double z   = 500;
                row.Shape = new MultiPatchConstruction().StartRing(x, y, z)
                            .Add(x + 0.3, y, z)
                            .Add(x + 0.3, y, z + 10)
                            .MultiPatch;

                row.Store();
            }

            var test = new QaSegmentLength(featureClass, 0.5);

            test.QaError += Test_QaFormatError;
            _errorCount   = 0;
            test.Execute();
            Assert.AreEqual(1, _errorCount);
        }
        private void TestPolycurve(IPolycurve errorPolycurve,
                                   ICollection <IPolyline> expectedErrorLines,
                                   double minZValue,
                                   double maxZValue)
        {
            var expectedErrorLinesCopy = new List <IPolyline>(expectedErrorLines);

            _featureClassNumber++;
            string featureClassName = string.Format("linetest_{0}", _featureClassNumber);

            IFeatureClass featureClass =
                TestWorkspaceUtils.CreateSimpleFeatureClass(
                    _testWs, featureClassName, null,
                    errorPolycurve.GeometryType,
                    esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95, 0d,
                    true);

            IFeature row = featureClass.CreateFeature();

            row.Shape = errorPolycurve;
            row.Store();

            IList <IGeometry> errorGeometries = RunTest(featureClass, minZValue, maxZValue,
                                                        expectedErrorLines.Count);

            Assert.AreEqual(expectedErrorLines.Count, errorGeometries.Count);

            foreach (IGeometry errorGeometry in errorGeometries)
            {
                foreach (IPolyline expectedErrorGeometry in expectedErrorLinesCopy)
                {
                    if (GeometryUtils.AreEqual(errorGeometry, expectedErrorGeometry))
                    {
                        expectedErrorLinesCopy.Remove(expectedErrorGeometry);
                        break;
                    }
                }
            }

            if (expectedErrorLinesCopy.Count != 0)
            {
                Console.WriteLine(@"Expected error lines not reported:");
                foreach (IPolyline polyline in expectedErrorLinesCopy)
                {
                    Console.WriteLine(@"Expected error line:");
                    Console.WriteLine(GeometryUtils.ToString(polyline));
                }

                Console.WriteLine(@"Reported error lines:");
                foreach (IGeometry errorGeometry in errorGeometries)
                {
                    Console.WriteLine(@"Reported error line:");
                    Console.WriteLine(GeometryUtils.ToString(errorGeometry));
                }
            }

            Assert.AreEqual(0, expectedErrorLinesCopy.Count);
        }
Exemple #4
0
        public void TestFormat()
        {
            CultureInfo origCulture = Thread.CurrentThread.CurrentCulture;

            try
            {
                Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

                IFeatureClass featureClass =
                    TestWorkspaceUtils.CreateSimpleFeatureClass(_testWs,
                                                                "TestFormat", null,
                                                                esriGeometryType
                                                                .esriGeometryPolyline,
                                                                esriSRProjCS2Type
                                                                .esriSRProjCS_CH1903Plus_LV95);

                // make sure the table is known by the workspace
                ((IWorkspaceEdit)_testWs).StartEditing(false);
                ((IWorkspaceEdit)_testWs).StopEditing(true);

                {
                    // Create error Feature
                    IFeature     row = featureClass.CreateFeature();
                    const double x   = 2600000;
                    const double y   = 1200000;
                    row.Shape =
                        GeometryFactory.CreateLine(
                            GeometryFactory.CreatePoint(x, y),
                            GeometryFactory.CreatePoint(x + 0.3, y));
                    row.Store();
                }

                var test = new QaSegmentLength(featureClass, 0.5, false);
                test.QaError += Test_QaFormatError;
                _errorCount   = 0;
                test.Execute();
                Assert.AreEqual(1, _errorCount);
            }
            finally
            {
                Thread.CurrentThread.CurrentCulture = origCulture;
            }
        }
        public void TestMultipoint()
        {
            IFeatureClass featureClass =
                TestWorkspaceUtils.CreateSimpleFeatureClass(
                    _testWs, "multipoints",
                    null,
                    esriGeometryType.esriGeometryMultipoint,
                    esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95, 0d,
                    true);

            var points = new List <IPoint>
            {
                GeometryFactory.CreatePoint(2000001, 1000000, 0),
                GeometryFactory.CreatePoint(2000002, 1000000, 100),
                GeometryFactory.CreatePoint(2000003, 1000000, 200),
                GeometryFactory.CreatePoint(2000004, 1000000, 300),
                GeometryFactory.CreatePoint(2000005, 1000000, 400)
            };

            IFeature row1 = featureClass.CreateFeature();

            row1.Shape = GeometryFactory.CreateMultipoint(points);
            row1.Store();

            IList <IGeometry> results = RunTest(featureClass, 100, 300, 2);

            var errors1 = (IMultipoint)results[0];

            Assert.AreEqual(((IPointCollection)errors1).PointCount, 1);

            var errors2 = (IMultipoint)results[1];

            Assert.AreEqual(((IPointCollection)errors2).PointCount, 1);

            IFeature row2 = featureClass.CreateFeature();

            row2.Shape = GeometryFactory.CreateMultipoint(points);
            row2.Store();

            RunTest(featureClass, 100, 300, 4);
        }