public void CanRegisterTestedFeature() { var overlaps = new OverlappingFeatures(); var fc = new FeatureClassMock(1, "", esriGeometryType.esriGeometryPolyline); IFeature feature = fc.CreateFeature(new Pt(0, 0), new Pt(9.95, 9.95)); var cachedRow = new CachedRow(feature); overlaps.RegisterTestedFeature(cachedRow, null); }
public void CheckWasAlreadyTested() { var overlaps = new OverlappingFeatures(); var fc = new FeatureClassMock(1, "", esriGeometryType.esriGeometryPolyline); IFeature f1 = fc.CreateFeature(new Pt(100, 0), new Pt(109.95, 9.95)); IFeature f2 = fc.CreateFeature(new Pt(100, 0), new Pt(109.8, 9.8)); IFeature fx = fc.CreateFeature(new Pt(100, 0), new Pt(109.95, 9.8)); IFeature fy = fc.CreateFeature(new Pt(100, 0), new Pt(109.8, 9.95)); var c1 = new CachedRow(f1); var test = new VerifyingContainerTest(fc); var t2 = new VerifyingContainerTest(fc); var t3 = new VerifyingContainerTest(fc); overlaps.RegisterTestedFeature(c1, new ContainerTest[] { test }); Assert.IsTrue(overlaps.WasAlreadyTested(f1, test)); Assert.IsFalse(overlaps.WasAlreadyTested(f2, test)); overlaps.RegisterTestedFeature(new CachedRow(f2), new ContainerTest[] { test }); Assert.IsTrue(overlaps.WasAlreadyTested(f2, test)); overlaps.RegisterTestedFeature(new CachedRow(f2), new ContainerTest[] { test, t2 }); Assert.IsTrue(overlaps.WasAlreadyTested(f2, test)); Assert.IsTrue(overlaps.WasAlreadyTested(f2, t2)); Assert.IsFalse(overlaps.WasAlreadyTested(f2, t3)); overlaps.RegisterTestedFeature(new CachedRow(fx), new ContainerTest[] { test }); overlaps.RegisterTestedFeature(new CachedRow(fy), new ContainerTest[] { test }); overlaps.SetCurrentTile(CreateBox(100, 0, 105, 5)); Assert.IsTrue(overlaps.WasAlreadyTested(f1, test)); Assert.IsTrue(overlaps.WasAlreadyTested(f2, test)); Assert.IsTrue(overlaps.WasAlreadyTested(fx, test)); Assert.IsTrue(overlaps.WasAlreadyTested(fy, test)); overlaps.AdaptSearchTolerance(fc, 0.1); overlaps.SetCurrentTile(CreateBox(110, 0, 120, 10)); Assert.IsTrue(overlaps.WasAlreadyTested(f1, test)); Assert.IsFalse(overlaps.WasAlreadyTested(f2, test)); Assert.IsTrue(overlaps.WasAlreadyTested(fx, test)); Assert.IsTrue(overlaps.WasAlreadyTested(fy, test)); overlaps.SetCurrentTile(CreateBox(100, 10, 110, 20)); Assert.IsTrue(overlaps.WasAlreadyTested(f1, test)); Assert.IsFalse(overlaps.WasAlreadyTested(f2, test)); Assert.IsFalse(overlaps.WasAlreadyTested(fx, test)); Assert.IsTrue(overlaps.WasAlreadyTested(fy, test)); overlaps.SetCurrentTile(CreateBox(110, 10, 120, 20)); Assert.IsTrue(overlaps.WasAlreadyTested(f1, test)); Assert.IsFalse(overlaps.WasAlreadyTested(f2, test)); Assert.IsFalse(overlaps.WasAlreadyTested(fx, test)); Assert.IsFalse(overlaps.WasAlreadyTested(fy, test)); overlaps.SetCurrentTile(CreateBox(110.1, 10, 120, 20)); Assert.IsFalse(overlaps.WasAlreadyTested(f1, test)); Assert.IsFalse(overlaps.WasAlreadyTested(f2, test)); Assert.IsFalse(overlaps.WasAlreadyTested(fx, test)); Assert.IsFalse(overlaps.WasAlreadyTested(fy, test)); }