RotateDisplay地图旋转实现

地图旋转的实现主要利用了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);



 

posted on 2008-05-27 19:36  duckweeds  阅读(1078)  评论(0编辑  收藏  举报

导航