RotateDisplay地图旋转实现

本文介绍如何使用ScreenDisplay对象实现地图的旋转功能。通过MouseDown事件确定旋转轴,MouseMove事件进行旋转操作,MouseUp事件完成旋转并刷新显示。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

地图旋转的实现主要利用了ScreenDisplay对象,旋转基本分三个步骤如下:
1.开始旋转(RotateStart),确定地图中心点(旋转轴)。MouseDown事件。

                IPoint point = new PointClass();
                
//Set the coordinates of current mouse location
                point.PutCoords(e.mapX, e.mapY);
                
//旋转中心点
                m_Point.X = axMapControl1.Extent.XMin + (axMapControl1.Extent.Width / 2);
                m_Point.Y 
= axMapControl1.Extent.YMin + (axMapControl1.Extent.Height / 2);

                
//Start rotating the display
                axMapControl1.ActiveView.ScreenDisplay.RotateStart(point, m_Point);

2.确定地图移动到何处(RotateMoveTo)。MouseMove事件。

            IPoint point = new PointClass();
            
//Set the coordinates of current mouse location
            point.PutCoords(e.mapX, e.mapY);

            
//Rotate the display based upon the current mouse location
            axMapControl1.ActiveView.ScreenDisplay.RotateMoveTo(point);
            axMapControl1.ActiveView.ScreenDisplay.RotateTimer();

3.旋转终止(RotateStop)。MouseUp事件

            //Get rotation angle
            double dRotationAngle = axMapControl1.ActiveView.ScreenDisplay.RotateStop();

            
//Rotate the MapControl's display
            axMapControl1.Rotation = dRotationAngle;
            
//Refresh the display
            axMapControl1.Refresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeography, Type.Missing, Type.Missing);



 

转载于:https://www.cnblogs.com/secenes/archive/2008/05/27/1208643.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值