/// <summary> /// Tests whether any component of the test Geometry intersects the interior of the target geometry. /// </summary> /// <remarks>Handles test geometries with both linear and point components.</remarks> /// <param name="testGeom">A geometry to test</param> /// <returns>true if any component of the argument intersects the prepared area geometry interior</returns> protected bool IsAnyTestComponentInTargetInterior(Geometry testGeom) { var coords = ComponentCoordinateExtracter.GetCoordinates(testGeom); foreach (var p in coords) { var loc = _targetPointLocator.Locate(p); if (loc == Location.Interior) { return(true); } } return(false); }
///<summary> /// Tests whether any component of the test Geometry intersects the area of the target geometry. ///</summary> /// <remarks>Handles test geometries with both linear and point components.</remarks> /// <param name="testGeom">A geometry to test</param> /// <returns>true if any component of the argument intersects the prepared area geometry</returns> protected bool IsAnyTestComponentInTarget(IGeometry testGeom) { IList <Coordinate> coords = ComponentCoordinateExtracter.GetCoordinates(testGeom); foreach (Coordinate p in coords) { Location loc = _targetPointLocator.Locate(p); if (loc != Location.Exterior) { 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. */ var locator = new PointLocator(); var coords = ComponentCoordinateExtracter.GetCoordinates(testGeom); foreach (var p in coords) { if (locator.Intersects(p, prepLine.Geometry)) { return(true); } } return(false); }
private readonly List <Coordinate> _representativePts; // List<Coordinate> public BasicPreparedGeometry(Geometry geom) { _baseGeom = geom; _representativePts = ComponentCoordinateExtracter.GetCoordinates(geom); }