public static bool AreInIntersectionExtentVsExtent(IPolygonExtent a, IExtent b) { ICompositeExtent composite = b as ICompositeExtent; if (null != composite) { return(a.Intersects(composite)); } composite = a as ICompositeExtent; if (null != composite) { return(b.Intersects(composite)); } ICircularExtent circle = b as ICircularExtent; if (null != circle) { _tempCircleB.Reset(b); return(circle.Intersects(_tempCircleB)); } IPolygonExtent polygon = b as IPolygonExtent; if (null != polygon) { return(a.Intersects(polygon)); } throw new InvalidOperationException("Extent must be a circle or polygon"); }
/// <summary> /// 是否相交 /// </summary> /// <param name="extent"></param> /// <param name="env"></param> /// <returns></returns> public static bool Intersects(this IExtent extent, Envelope env) { if (Equals(env, null)) { throw new ArgumentNullException(nameof(env)); } return(extent.Intersects(env.MinX, env.MaxX, env.MinY, env.MaxY)); }