SuperMap.WindowsPhone.Core.Rectangle2D.IntersectsWith C# (CSharp) Method

IntersectsWith() public method

${WP_core_Rectangle2D_method_intersectsWith_D}
public IntersectsWith ( Rectangle2D rect ) : bool
rect Rectangle2D ${WP_core_Rectangle2D_method_intersectsWith_param_rect}
return bool
        public bool IntersectsWith(Rectangle2D rect)
        {
            if ((this._width < 0.0) || (rect.Width < 0.0))
            {
                return false;
            }

            return (rect.Left <= this.Right) && (rect.Right >= this.Left) && (rect.Bottom <= this.Top) && (rect.Top >= this.Bottom);
        }

Usage Example

 //比较计算后bounds和每个bounds的相交
 private bool computeIntersectWithAll(Rectangle2D bounds)
 {
     var boundsCollection = (Layer as ElementsLayer).BoundsCollection.Values;
     foreach (Rectangle2D rect in boundsCollection)
     {
         if (rect != null)
         {
             if (bounds.IntersectsWith(rect))
             {
                 return true;
             }
         }
     }
     foreach (Rectangle2D rect in orignalBounds)
     {
         if (rect != null)
         {
             if (bounds.IntersectsWith(rect))
             {
                 return true;
             }
         }
     }
     return false;
 }
All Usage Examples Of SuperMap.WindowsPhone.Core.Rectangle2D::IntersectsWith