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

RotateDisplay地图旋转实现                IPoint point = new PointClass();
RotateDisplay地图旋转实现                
//Set the coordinates of current mouse location
RotateDisplay地图旋转实现
                point.PutCoords(e.mapX, e.mapY);
RotateDisplay地图旋转实现                
//旋转中心点
RotateDisplay地图旋转实现
                m_Point.X = axMapControl1.Extent.XMin + (axMapControl1.Extent.Width / 2);
RotateDisplay地图旋转实现                m_Point.Y 
= axMapControl1.Extent.YMin + (axMapControl1.Extent.Height / 2);
RotateDisplay地图旋转实现
RotateDisplay地图旋转实现                
//Start rotating the display
RotateDisplay地图旋转实现
                axMapControl1.ActiveView.ScreenDisplay.RotateStart(point, m_Point);

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

RotateDisplay地图旋转实现            IPoint point = new PointClass();
RotateDisplay地图旋转实现            
//Set the coordinates of current mouse location
RotateDisplay地图旋转实现
            point.PutCoords(e.mapX, e.mapY);
RotateDisplay地图旋转实现
RotateDisplay地图旋转实现            
//Rotate the display based upon the current mouse location
RotateDisplay地图旋转实现
            axMapControl1.ActiveView.ScreenDisplay.RotateMoveTo(point);
RotateDisplay地图旋转实现            axMapControl1.ActiveView.ScreenDisplay.RotateTimer();

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

RotateDisplay地图旋转实现            //Get rotation angle
RotateDisplay地图旋转实现
            double dRotationAngle = axMapControl1.ActiveView.ScreenDisplay.RotateStop();
RotateDisplay地图旋转实现
RotateDisplay地图旋转实现            
//Rotate the MapControl's display
RotateDisplay地图旋转实现
            axMapControl1.Rotation = dRotationAngle;
RotateDisplay地图旋转实现            
//Refresh the display
RotateDisplay地图旋转实现
            axMapControl1.Refresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeography, Type.Missing, Type.Missing);



 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-22
猜你喜欢
  • 2021-05-04
  • 2021-11-10
  • 2022-02-15
  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案