zoukankan      html  css  js  c++  java
  • 地图平移等地图操作功能

    //前一视图

    private void Redo(IActiveView activeView)
      {
      activeView.ExtentStack.Redo();
      activeView.Refresh();
      }
    //后一视图
    private void Undo(IActiveView activeView)
      {
      activeView.ExtentStack.Undo();
      activeView.Refresh();
      }

    调用AE的ControlsMapZoomToLastExtentBackCommand就OK了 在你的那个工具的click事件下写入如下代码
          //上一视图
         ControlsMapZoomToLastExtentBackCommand LastExtent = new  ControlsMapZoomToLastExtentBackCommand();
         LastExtent.OnCreate(MapConMain.Object);
         LastExtent.OnClick();

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

       1:    /// <summary>
       2:      ///  地图漫游工具http://www.cnblogs.com/liuyh208/archive/2009/09/08/1562823.html
       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:      }
  • 相关阅读:
    Oracle select for update and for update nowait
    Oracle DML , DDL , DCL
    Shell变量的作用域:Shell全局变量、环境变量和局部变量
    Shell脚本的调试方法
    openlayers6地图全图以及框选截图导出功能(附源码下载)
    Markdown基本语法
    sql 四大排名函数---(ROW_NUMBER、RANK、DENSE_RANK、NTILE)简介
    Newtonsoft.Json 去掉
    辽宁软考报名地址
    burp suite professional安装及使用教程
  • 原文地址:https://www.cnblogs.com/wangzihao/p/1836186.html
Copyright © 2011-2022 走看看