Пример #1
0
        /// <summary>
        /// 判断一条Polyline是否完全位于矩形盒内
        /// </summary>
        /// <param name="polyline"></param>
        /// <param name="box"></param>
        /// <returns></returns>
        public static bool IsPolylineCompleteInBox(MyMultiPolyline polyline, MyRectangle box)
        {
            int sPointCount = polyline.PointCount;

            for (int i = 0; i < sPointCount; i++)
            {
                MyPoint pointXY = ETCProjection.LngLat2XY(polyline.Points[i]);  //投影坐标系下的坐标
                if (IsPointInBox(pointXY, box) == false)
                {
                    return(false);
                }
            }
            return(true);
        }
Пример #2
0
        /// <summary>
        /// 返回一个副本
        /// </summary>
        /// <returns></returns>
        public MyMultiPolyline Clone()
        {
            MyMultiPolyline copy = new MyMultiPolyline();

            copy.polylineCount = this.polylineCount;
            copy.selected      = this.selected;
            for (int i = 0; i < this.points.Count; i++)
            {
                copy.points.Add(new MyPoint(this.points[i].X, this.points[i].Y));
            }
            copy.firstIndex = new int[this.firstIndex.Length];
            for (int i = 0; i < this.firstIndex.Length; i++)
            {
                copy.firstIndex[i] = this.firstIndex[i];
            }
            return(copy);
        }
Пример #3
0
        /// <summary>
        /// 添加折线
        /// </summary>
        /// <param name="geo">指定空间对象</param>
        /// <returns>是否成功添加</returns>
        internal override bool AddGeoObj(object geo)
        {
            try
            {
                MyMultiPolyline l = (MyMultiPolyline)geo;
                if (polylines.Count == 0)
                {
                    l.FID = 0;
                }
                else
                {
                    l.FID = polylines[polylines.Count - 1].FID + 1;
                }
                polylines.Add(l);

                //调整minx,maxx,miny,maxy
                if (l.MaxX > this.maxX)
                {
                    this.maxX = l.MaxX;
                }
                if (l.MinX < this.minX)
                {
                    this.minX = l.MinX;
                }
                if (l.MaxY > this.maxY)
                {
                    this.maxY = l.MaxY;
                }
                if (l.MinY < this.minY)
                {
                    this.minY = l.MinY;
                }
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }