zoukankan      html  css  js  c++  java
  • 一起学习ArcEngine(4)平移

    地图平移,可以说是最重要的功能之一,许多地图的默认工具就是平移。AE实现平移,比较简单,代码如下

       1:    /// <summary>
       2:      ///  地图漫游工具
       3:      /// </summary>
       4:      public class Pan : GISTools.Base.ToolBase
       5:      {
       6:         
       7:          private bool m_PanOperation;
       8:   
       9:          public Pan()
      10:              : base("Pan")
      11:          { }
      12:   
      13:          public Pan(AxMapControl mapCtl) 
      14:              : base(mapCtl, "Pan") 
      15:          {
      16:              if (m_cursor == null) m_cursor = getCursor(esriSystemMouseCursor.esriSystemMouseCursorPan);
      17:          }
      18:   
      19:          public Pan(AxPageLayoutControl plCtl)
      20:              : base(plCtl, "Pan")
      21:          {
      22:              if (m_cursor == null) m_cursor = getCursor(esriSystemMouseCursor.esriSystemMouseCursorPan);
      23:          }
      24:   
      25:          public override void OnMouseDown(int Button, int Shift, int X, int Y)
      26:          {
      27:              if (Button != 1) return;
      28:             IPoint point =m_pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
      29:             m_pActiveView.ScreenDisplay.PanStart(point);
      30:              m_PanOperation = true;
      31:          }
      32:   
      33:          public override void OnMouseMove(int Button, int Shift, int X, int Y)
      34:          {
      35:              if (Button != 1) return;
      36:   
      37:              if (!m_PanOperation) return;
      38:   
      39:              IPoint point = m_pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
      40:              m_pActiveView.ScreenDisplay.PanMoveTo(point);
      41:          }
      42:   
      43:          public override void OnMouseUp(int Button, int Shift, int X, int Y)
      44:          {
      45:              if (Button != 1) return;
      46:   
      47:              if (!m_PanOperation) return;
      48:   
      49:              IEnvelope extent = m_pActiveView.ScreenDisplay.PanStop();
      50:   
      51:              if (extent != null)
      52:              {
      53:                  m_pActiveView.ScreenDisplay.DisplayTransformation.VisibleBounds = extent;
      54:                  m_pActiveView.ScreenDisplay.Invalidate(null, true, (short)esriScreenCache.esriAllScreenCaches);
      55:              }
      56:              m_PanOperation = false;
      57:          }
      58:      }
  • 相关阅读:
    core 3.7.1 报错 SDK.InvalidRegionId : Can not find endpoint to access.
    定时30分钟清除缓存,重置
    文件的分割与合并
    mybatis <collection property="GoodsList" column="orderId" javaType="java.util.List" ofType="ui.model.vo.GoodsList" select="selectOrderDetail" fetchType="eager"/>
    hashMap 源码注释分析(二)
    hashMap 源码注释分析(一)
    ElasticSearch 入门
    Java 三高 ,高并发 ,高可用 。高性能
    使用MyBatis返回map对象,字段值为null时不返回或返回null,目标返回自定义的默认值...
    idea html 中文乱码,控制台中文乱码,工程文件中文乱码
  • 原文地址:https://www.cnblogs.com/liuyh208/p/1562823.html
Copyright © 2011-2022 走看看