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); }
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); }
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 CanTestPolygons() { var featureClassMock = new FeatureClassMock(1, "mock", esriGeometryType.esriGeometryPolygon); CurveConstruction construction = CurveConstruction .StartPoly(5, 4, 10).LineTo(-5, 4, 10.1) .LineTo(-5, -3, 10.05) .LineTo(5, -7, 10); IFeature row1 = featureClassMock.CreateFeature(construction.ClosePolygon()); GeometryUtils.EnsureSpatialReference(row1.Shape, featureClassMock); var test = new QaHorizontalSegments(featureClassMock, 5, 0); var runner = new QaTestRunner(test); runner.KeepGeometry = true; runner.Execute(row1); Assert.AreEqual(1, runner.Errors.Count); Assert.IsTrue(runner.ErrorGeometries[0].Envelope.ZMin > 5); }