博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
地图平移等地图操作功能
阅读量:4320 次
发布时间:2019-06-06

本文共 2645 字,大约阅读时间需要 8 分钟。

//前一视图

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:    /// 
2:      ///  地图漫游工具
3:      /// 
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:      }

 

 

 

转载于:https://www.cnblogs.com/wangzihao/archive/2010/09/26/1836186.html

你可能感兴趣的文章
sessionStorage
查看>>
代码示例_进程
查看>>
Java中关键词之this,super的使用
查看>>
学习进度
查看>>
“此人不存在”
查看>>
github.com加速节点
查看>>
解密zend-PHP凤凰源码程序
查看>>
python3 序列分片记录
查看>>
Atitit.git的存储结构and 追踪
查看>>
atitit 读书与获取知识资料的attilax的总结.docx
查看>>
B站 React教程笔记day2(3)React-Redux
查看>>
找了一个api管理工具
查看>>
Part 2 - Fundamentals(4-10)
查看>>
使用Postmark测试后端存储性能
查看>>
NSTextView 文字链接的定制化
查看>>
第五天站立会议内容
查看>>
ATMEGA16 IOport相关汇总
查看>>
JAVA基础-多线程
查看>>
面试题5:字符串替换空格
查看>>
[Codevs] 线段树练习5
查看>>