Exemple #1
0
        private void MapControl_MouseDown(object sender, MouseEventArgs e)
        {
            switch (mMapOpstyle)
            {
            case 0:
                break;

            case 1:      //放大
                if (e.Button == MouseButtons.Left)
                {
                    PointD sMouseLocPoi = new PointD(e.Location.X, e.Location.Y);
                    PointD sPoint       = ToMapPoint(sMouseLocPoi);
                    ZoomByCenter(sPoint, mcZoomRatio);
                    Refresh();
                }
                break;

            case 2:       //缩小
                if (e.Button == MouseButtons.Left)
                {
                    PointD sMouseLocPoi = new PointD(e.Location.X, e.Location.Y);
                    PointD sPoint       = ToMapPoint(sMouseLocPoi);
                    ZoomByCenter(sPoint, 1 / mcZoomRatio);
                    Refresh();
                }
                break;

            case 3:       //漫游
                if (e.Button == MouseButtons.Left)
                {
                    mMouseLocation.X = e.Location.X;
                    mMouseLocation.Y = e.Location.Y;
                }
                Refresh();
                break;

            case 4:        //输入多边形
                if (e.Button == MouseButtons.Left && e.Clicks == 1)
                {
                    PointD sScreenPoint = new PointD(e.Location.X, e.Location.Y);
                    PointD sMapPoint    = ToMapPoint(sScreenPoint);
                    mTrackingPolygon.AddPoint(sMapPoint);
                    Refresh();    //刷新
                }


                break;

            case 5:       //选择
                if (e.Button == MouseButtons.Left && e.Clicks == 1)
                {
                    mStartPoint = e.Location;
                }



                break;
            }
        }
Exemple #2
0
        /// <summary>
        /// 复制
        /// </summary>

        public Polygon Clone()
        {
            Polygon sPolygon      = new Polygon();  //新建多边形对象
            int     sPolygonCount = _Points.Count;  //顶点数目

            for (int i = 0; i < sPolygonCount; i++) //复制所有顶点
            {
                PointD sPoint = new PointD(_Points[i].X, _Points[i].Y);
                sPolygon.AddPoint(sPoint);
            }
            return(sPolygon);      //返回新建的多边形
        }