public void VerifyResolutionProblemsNotReported() { var fc = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryMultiPatch); double xyTolerance = GeometryUtils.GetXyTolerance((IFeatureClass)fc); const double slopeAngleDeg = 85; const double height = 10; const double x0 = 5; var construction = new MultiPatchConstruction(); construction.StartRing(x0, 4, 0).Add(x0, 8, 0).Add(x0 + xyTolerance * 0.5, 4, height); // less than xyTolerance IFeature f = fc.CreateFeature(construction.MultiPatch); var test = new QaMpVerticalFaces(fc, slopeAngleDeg, 0); var runner = new QaTestRunner(test); runner.Execute(f); Assert.AreEqual(0, runner.Errors.Count); construction = new MultiPatchConstruction(); construction.StartRing(x0, 4, 0).Add(x0, 8, 0).Add(x0 + xyTolerance * 1.5, 4, height); // more than xyTolerance f = fc.CreateFeature(construction.MultiPatch); test = new QaMpVerticalFaces(fc, slopeAngleDeg, 0); runner = new QaTestRunner(test); runner.Execute(f); Assert.AreEqual(1, runner.Errors.Count); }
public void VerifyHeightDiffsLargerNearHeightNotChecked() { var featureClassMock = new FeatureClassMock(1, "mock", esriGeometryType.esriGeometryMultiPatch); // make sure the table is known by the workspace const double nearHeight = 5; const double zNotChecked = nearHeight + 0.001; var construction = new MultiPatchConstruction(); construction.StartRing(0, 0, 0).Add(0, 10, 0).Add(0, 10, zNotChecked).Add(0, 0, zNotChecked); IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch); var test = new QaMpHorizontalHeights(featureClassMock, nearHeight, 0); var runner = new QaTestRunner(test); runner.Execute(row1); Assert.AreEqual(0, runner.Errors.Count); const double zChecked = nearHeight - 0.001; construction = new MultiPatchConstruction(); construction.StartRing(0, 0, 0).Add(0, 10, 0).Add(0, 10, zChecked).Add(0, 0, zChecked); row1 = featureClassMock.CreateFeature(construction.MultiPatch); test = new QaMpHorizontalHeights(featureClassMock, nearHeight, 0); runner = new QaTestRunner(test); runner.Execute(row1); Assert.AreEqual(1, runner.Errors.Count); }
public void CanTestMultiPatches() { var featureClassMock = new FeatureClassMock(1, "mock", esriGeometryType.esriGeometryMultiPatch); var construction = new MultiPatchConstruction(); construction.StartRing(0, 0, 0) .Add(5, 0, 0) .Add(5, 0, 1) .Add(0, 0, 1); IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch); var noErrorRunner = new QaTestRunner(new QaSliverPolygon(featureClassMock, 50, 1000)); noErrorRunner.Execute(row1); Assert.AreEqual(0, noErrorRunner.Errors.Count); var oneErrorRunner = new QaTestRunner(new QaSliverPolygon(featureClassMock, 20, 1000)); oneErrorRunner.Execute(row1); Assert.AreEqual(1, oneErrorRunner.Errors.Count); }
public void VerifyErrorTypes() { var featureClassMock = new FeatureClassMock(1, "mock", esriGeometryType.esriGeometryMultiPatch); var construction = new MultiPatchConstruction(); construction.StartRing(5, 4, 0) .Add(-5, 4, 0.1) .Add(-5, -3, 0.05) .Add(5, -7, -0.1) .Add(5, -8, -0.1) .Add(5, -11, 0.0); IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch); var test = new QaHorizontalSegments(featureClassMock, 5, 0); var runner = new QaTestRunner(test); runner.Execute(row1); Assert.AreEqual(2, runner.Errors.Count); Assert.AreNotEqual(runner.Errors[0].Description.Split()[1], runner.Errors[1].Description.Split()[1]); }
public void CanTestMultiPatch() { var fc = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryMultiPatch); var construction = new MultiPatchConstruction(); construction.StartRing(5, 4, 1) .Add(5, 8, 1) .Add(8, 8, 1) .Add(8, 4, 1); IFeature f = fc.CreateFeature(construction.MultiPatch); var test = new QaCoplanarRings(fc, 0, false); var runner = new QaTestRunner(test); runner.Execute(f); Assert.AreEqual(0, runner.Errors.Count); construction = new MultiPatchConstruction(); construction.StartRing(5, 4, 1) .Add(5, 8, 1) .Add(8, 8, 1) .Add(8, 4, 1.01); f = fc.CreateFeature(construction.MultiPatch); test = new QaCoplanarRings(fc, 0, false); runner = new QaTestRunner(test); runner.Execute(f); Assert.AreEqual(1, runner.Errors.Count); }
public void CanTestMultiPatchesSimple() { var featureClassMock = new FeatureClassMock(1, "mock", esriGeometryType.esriGeometryMultiPatch); var construction = new MultiPatchConstruction(); construction.StartRing(0, 0, 0) .Add(1, 0, 0) .Add(1, 0, 1) .Add(0, 0, 1); IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch); var errorRunner = new QaTestRunner(new QaMinMeanSegmentLength(featureClassMock, 1.5, false)); errorRunner.Execute(row1); Assert.AreEqual(1, errorRunner.Errors.Count); var noErrorRunner = new QaTestRunner(new QaMinMeanSegmentLength(featureClassMock, 0.9, false)); noErrorRunner.Execute(row1); Assert.AreEqual(0, noErrorRunner.Errors.Count); }
public void VerifySlopedPlaneNotChecked() { var fc = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryMultiPatch); const double slopeAngleDeg = 85; const double height = 10; const double x0 = 5; double dx = height * Math.Atan(MathUtils.ToRadians(90 - slopeAngleDeg)); var construction = new MultiPatchConstruction(); construction.StartRing(x0, 4, 0).Add(x0, 8, 0).Add(x0 + dx + 0.01, 4, height); // slight flatter than limit IFeature f = fc.CreateFeature(construction.MultiPatch); var test = new QaMpVerticalFaces(fc, slopeAngleDeg, 0); var runner = new QaTestRunner(test); runner.Execute(f); Assert.AreEqual(0, runner.Errors.Count); construction = new MultiPatchConstruction(); construction.StartRing(x0, 4, 0).Add(x0, 8, 0).Add(x0 + dx - 0.01, 4, height); // slight steeper than limit f = fc.CreateFeature(construction.MultiPatch); test = new QaMpVerticalFaces(fc, slopeAngleDeg, 0); runner = new QaTestRunner(test); runner.Execute(f); Assert.AreEqual(1, runner.Errors.Count); }
public void CanTestInvalidMultiPatches() { var featureClassMock = new FeatureClassMock(1, "mock", esriGeometryType.esriGeometryMultiPatch); var construction = new MultiPatchConstruction(); construction.StartRing(0, 0, 0) .Add(5, 0, 0); IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch); construction = new MultiPatchConstruction(); construction.StartFan(0, 0, 0) .Add(5, 0, 0); IFeature row2 = featureClassMock.CreateFeature(construction.MultiPatch); construction = new MultiPatchConstruction(); construction.StartStrip(0, 0, 0) .Add(5, 0, 0); IFeature row3 = featureClassMock.CreateFeature(construction.MultiPatch); construction = new MultiPatchConstruction(); construction.StartTris(0, 0, 0) .Add(5, 0, 0); IFeature row4 = featureClassMock.CreateFeature(construction.MultiPatch); var runner = new QaTestRunner(new QaSliverPolygon(featureClassMock, 50, 1000)); runner.Execute(row1); runner.Execute(row2); runner.Execute(row3); runner.Execute(row4); }
public void CanTestIgnoreInnerRings() { var featureClassMock = new FeatureClassMock(1, "mock", esriGeometryType.esriGeometryMultiPatch); var construction = new MultiPatchConstruction(); construction.StartOuterRing(5, 4, 0) .Add(5, 8, 0) .Add(8, 8, 0) .Add(8, 4, 0) .StartInnerRing(6, 5, 0) .Add(7, 5, 0) .Add(7, 7, 0) .Add(6, 7, 0); IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch); construction = new MultiPatchConstruction(); construction.StartRing(0, 0, 0) .Add(0, 1, 0) .Add(5, 1, 0) .Add(5, 0, 0) .StartRing(5, 1, 0) .Add(4, 1, 0) .Add(4, 5, 0) .Add(5, 5, 0) .StartRing(5, 5, 0) .Add(1, 5, 0) .Add(1, 6, 0) .Add(5, 6, 0) .StartRing(1, 6, 0) .Add(1, 1, 0) .Add(0, 1, 0) .Add(0, 6, 0); IFeature row2 = featureClassMock.CreateFeature(construction.MultiPatch); var test = new QaMpFootprintHoles(featureClassMock, InnerRingHandling.IgnoreInnerRings); var runner = new QaTestRunner(test); runner.Execute(row1); Assert.AreEqual(0, runner.Errors.Count); runner.Execute(row2); Assert.AreEqual(1, runner.Errors.Count); }
public void CanFindNonVerticalPlane() { var fc = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryMultiPatch); var construction = new MultiPatchConstruction(); construction.StartRing(5, 4, 0).Add(5, 8, 0).Add(5.01, 4, 10); IFeature f = fc.CreateFeature(construction.MultiPatch); var test = new QaMpVerticalFaces(fc, 85, 0); var runner = new QaTestRunner(test); runner.Execute(f); Assert.AreEqual(1, runner.Errors.Count); }
public void CanTestMultiPatchesPerPart() { var featureClassMock = new FeatureClassMock(1, "mock", esriGeometryType.esriGeometryMultiPatch); var construction = new MultiPatchConstruction(); construction.StartRing(0, 0, 0) .Add(1, 0, 0) .Add(1, 0, 1) .Add(0, 0, 1) .StartFan(2, 0, 0) .Add(2, 1, 0) .Add(3, 0, 0); IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch); var noErrorNoPartsRunner = new QaTestRunner(new QaMinMeanSegmentLength(featureClassMock, 0.9, false)); noErrorNoPartsRunner.Execute(row1); Assert.AreEqual(0, noErrorNoPartsRunner.Errors.Count); var oneErrorNoPartsRunner = new QaTestRunner(new QaMinMeanSegmentLength(featureClassMock, 1.5, false)); oneErrorNoPartsRunner.Execute(row1); Assert.AreEqual(1, oneErrorNoPartsRunner.Errors.Count); var noErrorPerPartsRunner = new QaTestRunner(new QaMinMeanSegmentLength(featureClassMock, 0.9, true)); noErrorPerPartsRunner.Execute(row1); Assert.AreEqual(0, noErrorPerPartsRunner.Errors.Count); var oneErrorRunner = new QaTestRunner(new QaMinMeanSegmentLength(featureClassMock, 1.1, true)); oneErrorRunner.Execute(row1); Assert.AreEqual(1, oneErrorRunner.Errors.Count); var twoErrorRunner = new QaTestRunner(new QaMinMeanSegmentLength(featureClassMock, 1.5, true)); twoErrorRunner.Execute(row1); Assert.AreEqual(2, twoErrorRunner.Errors.Count); }
public void CanTestMultiPatch1() { var fc = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryMultiPatch); var construction = new MultiPatchConstruction(); construction.StartRing(2579203.89625, 1079769.675, 2485.86625000001) .Add(2579201.77375, 1079771.97375, 2488.5175) .Add(2579198.27, 1079775.7675, 2484.82375); IFeature f = fc.CreateFeature(construction.MultiPatch); var test = new QaCoplanarRings(fc, 0, false); var runner = new QaTestRunner(test); runner.Execute(f); Assert.AreEqual(0, runner.Errors.Count); }
public void CanTestMultiPatches() { var featureClassMock = new FeatureClassMock(1, "mock", esriGeometryType.esriGeometryMultiPatch); var construction = new MultiPatchConstruction(); construction.StartRing(0, 0, 0).Add(5, 0, 0).Add(5, 0, 1).Add(0, 0, 1); IFeature row1 = featureClassMock.CreateFeature(construction.MultiPatch); var test = new QaMpHorizontalHeights(featureClassMock, 5, 0); var runner = new QaTestRunner(test); runner.Execute(row1); Assert.AreEqual(1, runner.Errors.Count); }
public void IsPlaneVerticalTest() { var construction = new MultiPatchConstruction(); construction.StartRing(0, 0, 0) .Add(5, 0, 0) .Add(5, 0, 5) .Add(0, 0, 5); IMultiPatch multiPatch = construction.MultiPatch; IIndexedMultiPatch indexedMultiPatch = QaGeometryUtils.CreateIndexedMultiPatch(multiPatch); Plane plane = QaGeometryUtils.CreatePlane(indexedMultiPatch.GetSegments()); WKSPointZ normal = plane.GetNormalVector(); Assert.AreEqual(0, normal.Z); }
public void VerticalPlaneIssue() { var fc = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryMultiPatch); var construction = new MultiPatchConstruction(); construction.StartRing(2646275.33625, 1249624.19375, 379.188750000001) .Add(2646269.675, 1249621.20625, 374.068750000006) .Add(2646280.9975, 1249627.18125, 374.068750000006); IFeature f = fc.CreateFeature(construction.MultiPatch); var test = new QaCoplanarRings(fc, 0, false); var runner = new QaTestRunner(test); runner.Execute(f); Assert.AreEqual(0, runner.Errors.Count); }
public void CanProjectToPlaneTest() { var construction = new MultiPatchConstruction(); construction.StartRing(0, 0, 0) .Add(5, 0, 0) .Add(5, 0, 5) .Add(0, 0, 5); IMultiPatch multiPatch = construction.MultiPatch; IIndexedMultiPatch indexedMultiPatch = QaGeometryUtils.CreateIndexedMultiPatch(multiPatch); IList <Pnt> points = QaGeometryUtils.GetPoints(indexedMultiPatch.GetSegments()); Plane plane = QaGeometryUtils.CreatePlane(points); IList <WKSPointZ> projected = QaGeometryUtils.ProjectToPlane(plane, points); ValidateForm(indexedMultiPatch, projected); }
public void VerifyNotHorizontalLinesIgnored() { var featureClassMock = new FeatureClassMock(1, "mock", esriGeometryType.esriGeometryMultiPatch); // make sure the table is known by the workspace const double horizontalToleranceDeg = 1; const double dy = 10; double zLimit = dy * Math.Tan(MathUtils.ToRadians(horizontalToleranceDeg)); double zNotTested = zLimit + 0.001; var construction = new MultiPatchConstruction(); construction.StartRing(0, 0, 0) .Add(0.01, dy, zNotTested) .Add(dy, 0, 0); IFeature feature = featureClassMock.CreateFeature(construction.MultiPatch); var test = new QaMpHorizontalPerpendicular(featureClassMock, 5, 0, horizontalToleranceDeg, false, 0); var runner = new QaTestRunner(test); runner.Execute(feature); Assert.AreEqual(0, runner.Errors.Count); double zTested = zLimit - 0.001; construction = new MultiPatchConstruction(); construction.StartRing(0, 0, 0) .Add(0.01, dy, zTested) .Add(dy, 0, 0); feature = featureClassMock.CreateFeature(construction.MultiPatch); test = new QaMpHorizontalPerpendicular(featureClassMock, 5, 0, horizontalToleranceDeg, false, 0); runner = new QaTestRunner(test); runner.Execute(feature); Assert.AreEqual(1, runner.Errors.Count); }
public void VerifyVerticalPlaneNotReported() { var fc = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryMultiPatch); const double toleranceAngleDeg = 0.5; const double height = 10; const double x0 = 5; double dx = height * Math.Atan(MathUtils.ToRadians(toleranceAngleDeg)); var construction = new MultiPatchConstruction(); construction.StartRing(x0, 4, 0).Add(x0, 8, 0).Add(x0, 4, height); // full vertical IFeature f = fc.CreateFeature(construction.MultiPatch); var test = new QaMpVerticalFaces(fc, 85, 0); var runner = new QaTestRunner(test); runner.Execute(f); Assert.AreEqual(0, runner.Errors.Count); construction = new MultiPatchConstruction(); construction.StartRing(x0, 4, 0).Add(x0, 8, 0).Add(x0 + dx - 0.01, 4, height); // slightly steeper than tolerance f = fc.CreateFeature(construction.MultiPatch); test = new QaMpVerticalFaces(fc, 85, toleranceAngleDeg); runner = new QaTestRunner(test); runner.Execute(f); Assert.AreEqual(0, runner.Errors.Count); construction = new MultiPatchConstruction(); construction.StartRing(x0, 4, 0).Add(x0, 8, 0).Add(x0 + dx + 0.01, 4, height); // slightly less steep than tolerance f = fc.CreateFeature(construction.MultiPatch); test = new QaMpVerticalFaces(fc, 85, toleranceAngleDeg); runner = new QaTestRunner(test); runner.Execute(f); Assert.AreEqual(1, runner.Errors.Count); }
public void VerifyNotConnectedIgnored() { var featureClassMock = new FeatureClassMock(1, "mock", esriGeometryType.esriGeometryMultiPatch); // make sure the table is known by the workspace const double connected = 0.1; double dx = connected * Math.Sqrt(0.5); var construction = new MultiPatchConstruction(); construction.StartRing(0, 0, 0) .Add(1.1 * dx, -dx, 0) .Add(10, -dx, 0) .Add(0.1, 10, 0); IFeature feature = featureClassMock.CreateFeature(construction.MultiPatch); var test = new QaMpHorizontalPerpendicular(featureClassMock, 5, 0, 0, true, connected); var runner = new QaTestRunner(test); runner.Execute(feature); Assert.AreEqual(0, runner.Errors.Count); construction = new MultiPatchConstruction(); construction.StartRing(0, 0, 0) .Add(0.9 * dx, -dx, 0) .Add(10, -dx, 0) .Add(0.1, 10, 0); feature = featureClassMock.CreateFeature(construction.MultiPatch); test = new QaMpHorizontalPerpendicular(featureClassMock, 5, 0, 0, true, connected); runner = new QaTestRunner(test); runner.Execute(feature); Assert.AreEqual(1, runner.Errors.Count); }
public void CanCreateIndexGeometryWithTriangles() { // TODO: Test umwandeln in CanGetMultiPatchProxyWithTriangles var construction = new MultiPatchConstruction(); construction.StartRing(5, 4, 0).Add(-5, 4, 0).Add(-5, -4, 0).Add(5, -4, 0) .StartFan(5, 4, 1).Add(-5, 4, 1).Add(-5, -4, 1).Add(5, -4, 1) .StartTris(5, 4, 2).Add(-5, 4, 2).Add(-5, -4, 2) .StartStrip(5, 4, 3).Add(-5, 4, 3).Add(-5, -4, 3).Add(5, -4, 3); IMultiPatch mp = construction.MultiPatch; ((IGeometry)mp).SpatialReference = SpatialReferenceUtils.CreateSpatialReference( (int)esriSRProjCS2Type.esriSRProjCS_CH1903Plus_LV95); var geom = new IndexedPolycurve((IPointCollection4)mp); foreach (SegmentProxy segment in geom.GetSegments()) { Assert.IsTrue(segment.IsLinear); } }
public void VerifyErrorInSrResolutionNotReported() { var fc = new FeatureClassMock(1, "Fc", esriGeometryType.esriGeometryMultiPatch); var geodataset = (IGeoDataset)fc; var srt = (ISpatialReferenceResolution)geodataset.SpatialReference; double xySrResolution = srt.XYResolution[false]; double zSrResolution = srt.ZResolution[false]; // zTolerance var construction = new MultiPatchConstruction(); construction.StartRing(5, 4, 1) .Add(5, 8, 1) .Add(8, 8, 1) .Add(8, 4, 1 + 5 * zSrResolution); // was: 4x (but end point now no longer repeated) IFeature f = fc.CreateFeature(construction.MultiPatch); var test = new QaCoplanarRings(fc, 0, false); var runner = new QaTestRunner(test); runner.Execute(f); Assert.AreEqual(1, runner.Errors.Count); // NOTE failed with Plane3D (0 errors) construction = new MultiPatchConstruction(); construction.StartRing(5, 4, 1) .Add(5, 8, 1) .Add(8, 8, 1) .Add(8, 4, 1 + 2 * zSrResolution); f = fc.CreateFeature(construction.MultiPatch); test = new QaCoplanarRings(fc, 0, false); runner = new QaTestRunner(test); runner.Execute(f); Assert.AreEqual(0, runner.Errors.Count); // xyTolerance construction = new MultiPatchConstruction(); construction.StartRing(0, 0, 1) .Add(5, 5, 1) .Add(5, 5, 8) .Add(0 + 3 * xySrResolution, 0 - 3 * xySrResolution, 8); // was: 2x (but end point now no longer repeated) f = fc.CreateFeature(construction.MultiPatch); test = new QaCoplanarRings(fc, 0, false); runner = new QaTestRunner(test); runner.Execute(f); Assert.AreEqual(1, runner.Errors.Count); // NOTE failed with Plane3D (0 errors) construction = new MultiPatchConstruction(); construction.StartRing(0, 0, 1) .Add(5, 5, 1) .Add(5, 5, 8) .Add(0 + xySrResolution, 0 - xySrResolution, 8); f = fc.CreateFeature(construction.MultiPatch); test = new QaCoplanarRings(fc, 0, false); runner = new QaTestRunner(test); runner.Execute(f); Assert.AreEqual(0, runner.Errors.Count); }