zoukankan      html  css  js  c++  java
  • Map3D中获取地图中心及Zoom到新的中心点

    如题,不更改当前比例尺,把指定点Zoom到地图中心。

            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            [CommandMethod("ZoomCenter")]
            public void ZoomCenter()
            {
                AcMapMap map = AcMapMap.GetCurrentMap();
                MgEnvelope mapExtent = map.GetMapExtent();

                double centerX = mapExtent.LowerLeftCoordinate.X + mapExtent.Width / 2;
                double centerY = mapExtent.LowerLeftCoordinate.Y + mapExtent.Height / 2;

                ed.WriteMessage("center:"+centerX.ToString()+","+centerY.ToString()+"\n");

                Point3d centerPt;
                PromptPointOptions ppo = new PromptPointOptions("Click on map to zoom center:");
                PromptPointResult ppr = ed.GetPoint(ppo);
                if (ppr.Status == PromptStatus.OK)
                {
                    centerPt = ppr.Value;

                    MgEnvelope newExtent = new MgEnvelope(centerPt.X - mapExtent.Width / 2,
                                                                        centerPt.Y - mapExtent.Height / 2,
                                                                        centerPt.X + mapExtent.Width / 2,
                                                                        centerPt.Y + mapExtent.Height / 2);

                    map.ZoomToExtent(newExtent);
                }

            }
    作者:峻祁连
    邮箱:junqilian@163.com
    出处:http://junqilian.cnblogs.com
    转载请保留此信息。
  • 相关阅读:
    Nginx配置文件nginx.conf详解
    Nginx的内部(进程)模型
    Nginx特点
    Nginx的事件处理机制
    8 个实用的 Bootstrap 3 案例教程
    超高速前端开发工具——Emmet
    3ds MaxVRay全套家装效果图制作典型实例第2版
    Word Excel PPT 2016完全自学教程
    Unity 5.X 3D游戏开发技术详解与典型案例
    C#从入门到精通(第2版)
  • 原文地址:https://www.cnblogs.com/junqilian/p/2208849.html
Copyright © 2011-2022 走看看