/// <summary>
        /// 视口变化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dwg_ViewChanged(object sender, EventArgs e)
        {
            Document document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.CurrentDocument;

            using (document.LockDocument(DocumentLockMode.ProtectedAutoWrite, null, null, false))
            {
                Editor editor = document.Editor;
                //Size win_size = document.Window.GetSize();
                //Point location = document.Window.GetLocation();
                //editor.WriteMessage("\nwin_size:" + win_size.ToString() + "location:" + location.ToString());

                if (1 == _level || 0 == _level)
                {
                    return;
                }
                ViewTableRecord currentView       = editor.GetCurrentView();
                Point2d         view_center_point = currentView.CenterPoint;
                Size            view_size         = new Size((int)currentView.Width, (int)currentView.Height);
                //editor.WriteMessage("\ncenter_point:" + view_center_point.ToString() + "view_size:" + view_size.ToString());
                Point2d left_down = new Point2d(view_center_point.X - view_size.Width / 2.0, view_center_point.Y - view_size.Height / 2.0);
                Point2d right_up  = new Point2d(view_center_point.X + view_size.Width / 2.0, view_center_point.Y + view_size.Height / 2.0);

                //Point3d center_point3d = (Point3d)Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("VIEWCTR");
                //Point2d size_screen = (Point2d)Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("SCREENSIZE");
                //Size size = new Size((int)size_screen.X, (int)size_screen.Y);
                //Point2d center_point = new Point2d(center_point3d.X, center_point3d.Y);
                //MapTiles.webMercatorBounds(center_point, _level, size, ref left_down, ref right_up);

                //document.Editor.WriteMessage("\n CenterPoint:" + center_point.ToString() + "left_down:" + left_down.ToString() + "right_up:" + right_up.ToString() + "level:" + _level.ToString());
                //RectangleF view_image = new RectangleF();
                //bool is_contain = MapTiles.getIntersects(left_down, right_up, ref view_image);
                //if (!is_contain)
                //{
                //    return;
                //}
                //else
                //{
                //    left_down = new Point2d(view_image.X, view_image.Y-view_image.Height);
                //    right_up = new Point2d(view_image.X+view_image.Width, view_image.Y);
                //    MapTiles.darwBounds(left_down,right_up,Autodesk.AutoCAD.Colors.Color.FromRgb(0,255,0),20,20);

                //}
                int start_row = 0, end_row = 0, start_col = 0, end_col = 0;
                MapTiles.webMercatorTilesFromBound(left_down, right_up, _level, out start_row, out start_col, out end_row, out end_col);

                addImage(document, MapTiles.webMercatorResolution(_level), start_row, end_row, start_col, end_col);
            }
        }
        /// <summary>
        /// 加载 首级别的影像
        /// </summary>
        public void add0Level()
        {
            Document document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.CurrentDocument;

            using (document.LockDocument(DocumentLockMode.ProtectedAutoWrite, null, null, false))
            {
                _level = 1;
                addImage(document, MapTiles.webMercatorResolution(1), 0, 1, 0, 1);
            }
            //Point2d point_left_up = MapTiles.webMercatorTilesLeftUpLocation(0,0,1);
            //string url = String.Format("http://t3.tianditu.cn/img_c/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=c&TileMatrix={0}&TileRow={1}&TileCol={2}&style=default&format=tiles", 1, 0, 0);
            addImage(document, MapTiles.webMercatorResolution(1), 0, 1, 0, 1);
            //point_left_up = MapTiles.webMercatorTilesLeftUpLocation(1, 0, 1);
            //string url_01 = String.Format("http://t3.tianditu.cn/img_c/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=c&TileMatrix={0}&TileRow={1}&TileCol={2}&style=default&format=tiles", 1, 0, 1);
            //addImage(document, url_01, point_left_up,MapTiles.webMercatorResolution(1));
            ZoomExtents();
        }