/// <summary>
        /// 判断复合多边形是否部分或者完全位于矩形盒内
        /// </summary>
        /// <returns></returns>
        public static bool IsMultiPolygonPartiallyWithinBox(WEMultiPolygon multiPolygon, WERectangle box)
        {
            WERectangle multipolygonBox = multiPolygon.MBR;         //矩形盒不相交

            if (!IsTwoBoxesIntersect(multipolygonBox, box))
            {
                return(false);
            }
            int sPolygonCount = multiPolygon.Polygons.Count();

            for (int j = 0; j < sPolygonCount; j++)    //遍历每个简单多边形判断是否有顶点位于矩形盒内
            {
                WEPolygon thisPolygon = (WEPolygon)multiPolygon.GetPolygon(j);
                int       sPointCount = thisPolygon.PointCount;
                for (int i = 0; i < sPointCount; i++)
                {
                    if (IsPointInBox(thisPolygon.Points[i], box))
                    {
                        return(true);
                    }
                }
            }
            WEPoint LeftTop     = new WEPoint(box.MinX, box.MaxY);
            WEPoint LeftBottom  = new WEPoint(box.MinX, box.MinY);
            WEPoint RightTop    = new WEPoint(box.MaxX, box.MaxY);
            WEPoint RightBottom = new WEPoint(box.MaxX, box.MinY);

            //判断矩形盒是否有顶点位于复合多边形内
            if (IsPointInMultiPolygon(LeftTop, multiPolygon) || IsPointInMultiPolygon(LeftBottom, multiPolygon) ||
                IsPointInMultiPolygon(RightBottom, multiPolygon) || IsPointInMultiPolygon(RightTop, multiPolygon))
            {
                return(true);
            }
            for (int j = 0; j < sPolygonCount; j++)    //遍历每个简单多边形判断是否有边与矩形盒相交
            {
                WEPolygon thisPolygon = (WEPolygon)multiPolygon.GetPolygon(j);
                int       sPointCount = thisPolygon.PointCount;
                WEPoint   startPoint, endPoint;
                for (int i = 0; i < sPointCount - 1; i++)
                {
                    startPoint = thisPolygon.Points[i];
                    endPoint   = thisPolygon.Points[i + 1];
                    if (IsSegmentIntersectsBox(startPoint, endPoint, box))
                    {
                        return(true);
                    }
                }
                startPoint = thisPolygon.Points[sPointCount - 1];
                endPoint   = thisPolygon.Points[0];
                if (IsSegmentIntersectsBox(startPoint, endPoint, box))
                {
                    return(true);
                }
            }
            return(false);
        }
        /// <summary>
        /// 判断点是否在复合多边形内
        /// </summary>
        /// <param name="point"></param>
        /// <param name="multiPolygon"></param>
        /// <returns></returns>
        public static bool IsPointInMultiPolygon(WEPoint point, WEMultiPolygon multiPolygon)
        {
            WERectangle box = multiPolygon.MBR;

            if (!IsPointInBox(point, box))
            {
                return(false);
            }
            int sPolygonCount      = multiPolygon.Polygons.Count();
            int sIntersectionCount = 0;             //射线与边的交点数

            for (int j = 0; j < sPolygonCount; j++) //遍历每个简单多边形求射线交点个数
            {
                WEPolygon thisPolygon = (WEPolygon)multiPolygon.GetPolygon(j);
                if (thisPolygon.PointCount < 3)
                {
                    continue;
                }
                int     sPointCount = thisPolygon.PointCount;
                WEPoint startPoint, endPoint;       //线段起点、终点
                for (int i = 0; i < sPointCount - 1; i++)
                {
                    startPoint = thisPolygon.Points[i];
                    endPoint   = thisPolygon.Points[i + 1];
                    if (IsRayIntersectsSegment(point, startPoint, endPoint))
                    {
                        sIntersectionCount++;
                    }
                }
                startPoint = thisPolygon.Points[sPointCount - 1];
                endPoint   = thisPolygon.Points[0];
                if (IsRayIntersectsSegment(point, startPoint, endPoint))     //最后一条边
                {
                    sIntersectionCount++;
                }
            }
            if (sIntersectionCount % 2 == 1)        //奇数个交点
            {
                return(true);
            }
            return(false);
        }