///<summary> /// Tests whether any representative of the target geometry intersects the test geometry. /// This is useful in A/A, A/L, A/P, L/P, and P/P cases. ///</summary> /// <param name="testGeom">The test geometry</param> /// <returns>true if any component intersects the areal test geometry</returns> public bool IsAnyTargetComponentInTest(IGeometry testGeom) { var locator = new PointLocator(); foreach (Coordinate representativePoint in RepresentativePoints) { if (locator.Intersects(representativePoint, testGeom)) return true; } return false; }
///<summary> /// Tests whether any representative point of the test Geometry intersects /// the target geometry. ///</summary> /// <remarks> /// Only handles test geometries which are Puntal (dimension 0) /// </remarks> /// <param name="testGeom">A Puntal geometry to test</param> /// <returns>true if any point of the argument intersects the prepared geometry</returns> protected bool IsAnyTestPointInTarget(IGeometry testGeom) { /* * This could be optimized by using the segment index on the lineal target. * However, it seems like the L/P case would be pretty rare in practice. */ PointLocator locator = new PointLocator(); IList<Coordinate> coords = ComponentCoordinateExtracter.GetCoordinates(testGeom); foreach (Coordinate p in coords) { if (locator.Intersects(p, prepLine.Geometry)) return true; } return false; }