public string GetDistrics(Coordinate coordinate) { foreach (var item in Streets) { var pointLocator = new PointLocator(); if (pointLocator.Intersects(coordinate, item.BasicGeometry as IGeometry)) { return(item.DataRow["NAME"].ToString()); } } return(null); }
/// <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(Geometry testGeom) { var locator = new PointLocator(); foreach (var 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. */ var locator = new PointLocator(); var coords = ComponentCoordinateExtracter.GetCoordinates(testGeom); foreach (var p in coords) { if (locator.Intersects(p, prepLine.Geometry)) { return(true); } } return(false); }