public static bool ExecuteBoolean(IPolygon poly1, IPolygon poly2) { foreach (IPoint point in poly1.GetCoordinates().First()) { if (PointInPolygon.Execute(point, poly2)) { return(true); } } foreach (IPoint point in poly2.GetCoordinates().First()) { if (PointInPolygon.Execute(point, poly1)) { return(true); } } IEnumerable <IPoint> intersections = LineIntersect.Execute(PolygonToLine.Execute(poly1), PolygonToLine.Execute(poly2)); if (intersections != null && intersections.Count() > 0) { return(true); } return(false); }
public static IEnumerable <IPoint> Execute(IPolygon poly1, IPolygon poly2) { foreach (IPoint point in poly1.GetCoordinates().First()) { if (PointInPolygon.Execute(point, poly2)) { yield return(point); } } foreach (IPoint point in poly2.GetCoordinates().First()) { if (PointInPolygon.Execute(point, poly1)) { yield return(point); } } IEnumerable <IPoint> intersections = LineIntersect.Execute(PolygonToLine.Execute(poly1), PolygonToLine.Execute(poly2)); if (intersections != null && intersections.Count() > 0) { foreach (IPoint point in intersections) { yield return(point); } } }
public static IEnumerable <IPoint> Execute(IEnumerable <IPoint> line, IPolygon poly) { IPoint previous = null; IGeometry polygonLine = PolygonToLine.Execute(poly); foreach (IPoint point in line) { if (PointInPolygon.Execute(point, poly)) { yield return(point); } if (previous != null) { IEnumerable <IPoint> intersections = LineIntersect.Execute(LineString.Create(previous, point), polygonLine); if (intersections != null) { foreach (IPoint intersection in intersections) { yield return(intersection); } } } previous = point; } }
private static bool pointsInPolygon(IMultiPoint points, IPolygon poly) { foreach (IPoint point in points.Points) { if (PointInPolygon.Execute(point, poly)) { return(true); } } return(false); }
public static bool ExecuteBoolean(IEnumerable <IPoint> line, IPolygon poly) { foreach (IPoint point in line) { if (PointInPolygon.Execute(point, poly)) { return(true); } } IEnumerable <IPoint> intersections = LineIntersect.Execute(LineString.Create(line.ToArray()), PolygonToLine.Execute(poly)); if (intersections != null && intersections.Count() > 0) { return(true); } return(false); }
public static bool Execute(IGeometry feature1, IGeometry feature2) { if (feature1 is IPoint) { if (feature2 is IPoint) { return(!BoolCompareCoordinates.Execute((IPoint)feature1, (IPoint)feature2)); } else if (feature2 is IMultiPoint) { return(!BoolCompareCoordinates.Execute((IPoint)feature1, (IMultiPoint)feature2)); } else if (feature2 is IMultiLine) { return(!PointOnLine.ExecuteBoolean((IPoint)feature1, feature2)); } else if (feature2 is IPolygon) { return(!PointInPolygon.Execute((IPoint)feature1, (IPolygon)feature2)); } } else if (feature1 is IMultiPoint) { if (feature2 is IPoint) { return(!BoolCompareCoordinates.Execute((IPoint)feature2, (IMultiPoint)feature1)); } else if (feature2 is IMultiPoint) { return(!BoolCompareCoordinates.Execute((IMultiPoint)feature1, (IMultiPoint)feature2)); } else if (feature2 is IMultiLine) { return(!PointOnLine.ExecuteBoolean((IMultiPoint)feature1, feature2)); } else if (feature2 is IPolygon) { return(!pointsInPolygon((IMultiPoint)feature1, (IPolygon)feature2)); } } else if (feature1 is IMultiLine) { if (feature2 is IPoint) { return(!PointOnLine.ExecuteBoolean((IPoint)feature2, (IMultiLine)feature1)); } else if (feature2 is IMultiPoint) { return(!PointOnLine.ExecuteBoolean((IMultiPoint)feature2, feature1)); } else if (feature2 is IMultiLine) { return(!LineOnLine.ExecuteBoolean((IMultiLine)feature1, (IMultiLine)feature2)); } else if (feature2 is IPolygon) { return(!LineInPolygon.ExecuteBoolean((IMultiLine)feature1, (IPolygon)feature2)); } } else if (feature1 is IPolygon) { if (feature2 is IPoint) { return(!PointInPolygon.Execute((IPoint)feature2, (IPolygon)feature1)); } else if (feature2 is IMultiPoint) { return(!pointsInPolygon((IMultiPoint)feature2, (IPolygon)feature1)); } else if (feature2 is IMultiLine) { return(!LineInPolygon.ExecuteBoolean((IMultiLine)feature2, (IPolygon)feature1)); } else if (feature2 is IPolygon) { return(!PolygonInPolygon.ExecuteBoolean((IPolygon)feature1, (IPolygon)feature2)); } } return(false); }