转自原文 Engine自定义控件实现toolbar功能

Engine提供的工具条能够轻易实现各种操作,非常方便,可是不好的地方就是太死板了,toolbar的图标都不能改。因此需要自己做按钮做控件去实现这些功能。

比如说放大和全景

//放大
       
private void ZoomIn_Click(object sender, RoutedEventArgs e)
       
{
           
ControlsMapZoomInTool zoomintool = new
ControlsMapZoomInTool();
           
zoomintool.OnCreate(mapControl.Object);
           
mapControl.CurrentTool =
(ESRI.ArcGIS.SystemUI.ITool)zoomintool;
       
}

//全景
       
private void zoomentire_Click(object sender, RoutedEventArgs
e)
       
{
           
ControlsMapFullExtentCommand fullview = new
ControlsMapFullExtentCommand();
           
fullview.OnCreate(mapControl.Object);
           
fullview.OnClick();
       
}

分别是调用了CurrentTool 和OnClick的方式。

ArcGIS MapControl 中常用命令

下面列举更多的一些命令。

功能类 事件
放大 ControlsMapZoomInTool 设置
CurrentTool
缩小ControlsMapZoomOutTool 设置
CurrentTool
打开文件ControlsOpenDocCommand OnClick()
添加数据ControlsAddDataCommand OnClick()
全图ControlsMapFullExtentCommand OnClick()
查找ControlsMapFindCommand OnClick()
属性工具ControlsMapIdentifyTool 设置
CurrentTool
选择Feature ControlsSelectFeaturesTool 设置
CurrentTool
清除选择ControlsClearSelectionCommand OnClick()
开始编辑ControlsEditingStartCommand OnClick()
保存编辑ControlsEditingSaveCommand OnClick()
停止编辑ControlsEditingStopCommand OnClick()
编辑工具ControlsEditingEditTool 设置
CurrentTool
属性编辑命

ControlsEditingAttributeCommand OnClick()
测量工具ControlsMapMeasureTool 设置
CurrentTool
创建路径(网
络分析)
ControlsNetworkAnalystRouteCommand OnClick()
创建路径点ControlsNetworkAnalystCreateLocationTool 设 置
CurrentTool
最短路径查

ControlsNetworkAnalystSolveCommand OnClick()
Scene缩小ControlsSceneExpandFOVCommand OnClick()
当然,还有很多很多其他的命令。从上面的列表比较我们也可以看出,一般
来说,如果类的后缀是Command,则用OnClick方法;如果是Tool,则设置Map
的CurrentTool属性为该工具。

ArcSence中的命令使用示例

以下是scenecontrol的一些:

private void btn_zoomin_Click(object sender, EventArgs e)
       
{
           
ICommand command = new
ControlsSceneZoomInTool();//ControlsSceneZoomInToolClass();
           
command.OnCreate(this.axSceneControl1.Object);
           
this.axSceneControl1.CurrentTool = command as
ESRI.ArcGIS.SystemUI.ITool;
       
}

private void btnzoomout_Click(object sender, EventArgs e)
       
{
           
ICommand command = new ControlsSceneZoomOutTool();
           
command.OnCreate(this.axSceneControl1.Object);
           
this.axSceneControl1.CurrentTool = command as
ESRI.ArcGIS.SystemUI.ITool;
       
}

//飞行模式。。
       
private void btntoolfly_Click(object sender, EventArgs e)
       
{
           
ICommand command = new
ControlsSceneFlyToolClass();//ControlsSceneZoomInToolClass();
           
command.OnCreate(this.axSceneControl1.Object);
           
this.axSceneControl1.CurrentTool = command as
ESRI.ArcGIS.SystemUI.ITool;
       
}

//选择模式..
       
private void btnSelect_Click(object sender, EventArgs e)
       
{
           
ICommand command = new
ControlsSceneSelectFeaturesToolClass();//ControlsSceneZoomInToolClass();

command.OnCreate(this.axSceneControl1.Object);
           
this.axSceneControl1.CurrentTool = command as
ESRI.ArcGIS.SystemUI.ITool;
       
}

//放大至目标区域
       
private void btntargetzoom_Click(object sender, EventArgs e)
       
{
           
ICommand command = new
ControlsSceneTargetZoomToolClass();//ControlsSceneZoomInToolClass();

command.OnCreate(this.axSceneControl1.Object);
           
this.axSceneControl1.CurrentTool = command as
ESRI.ArcGIS.SystemUI.ITool;
       
}

//全景
       
private void btnFullExtern_Click(object sender, EventArgs e)
       
{
           
ICommand command = new ControlsSceneFullExtentCommandClass();
           
command.OnCreate(this.axSceneControl1.Object);
           
command.OnClick();
       
}

private void btnpan_Click(object sender, EventArgs e)
       
{
           
ICommand command = new ControlsScenePanTool();
           
command.OnCreate(this.axSceneControl1.Object);
           
this.axSceneControl1.CurrentTool = command as
ESRI.ArcGIS.SystemUI.ITool;
       
}

private void button1_Click(object sender, EventArgs e)
       
{
           
ICommand command = new ControlsSceneNavigateTool();
           
command.OnCreate(this.axSceneControl1.Object);
           
this.axSceneControl1.CurrentTool = command as
ESRI.ArcGIS.SystemUI.ITool;
       
}

Engine工具栏按钮的使用详解的更多相关文章

  1. 第15.15节 PyQt(Python+Qt)入门学习:Designer的menu菜单、toolBar工具栏和Action动作详解

    老猿Python博文目录 老猿Python博客地址 一.引言 Qt Designer中的部件栏并没有菜单.toolBar以及Action相关的部件,仅在MainWindow类型窗口提供了menu.to ...

  2. VC++ WIN32 sdk实现按钮自绘详解.

    网上找了很多,可只是给出代码,没有详细解释,不便初学者理解.我就抄回冷饭.把这个再拿出来说说. 实例图片:    首先建立一个标准的Win32 Application 工程.选择a simple Wi ...

  3. VC++ WIN32 sdk实现按钮自绘详解 之二(关键是BS_OWNERDRAW和WM_DRAWITEM)

    网上找了很多,可只是给出代码,没有详细解释,不便初学者理解.我就抄回冷饭.把这个再拿出来说说. 实例图片:    首先建立一个标准的Win32 Application 工程.选择a simple Wi ...

  4. VC++ WIN32 sdk实现按钮自绘详解 之二.

    网上找了很多,可只是给出代码,没有详细解释,不便初学者理解.我就抄回冷饭.把这个再拿出来说说. 实例图片:    首先建立一个标准的Win32 Application 工程.选择a simple Wi ...

  5. Python连载60-Tkinter布局、按钮以及属性详解

    一.Tkinter​ 1.组件的大致使用步骤 (1)创建总面板 (2)创建面板上的各种组件: i.指定组件的父组件,即依附关系:ii.利用相应的属性对组件进行设置:iii.给组件安排布局. (3)同步 ...

  6. 第十三章、Designer中的按钮Buttons组件详解

    老猿Python博文目录 专栏:使用PyQt开发图形界面Python应用 老猿Python博客地址 一.引言 Qt Designer中的Buttons部件包括Push Button(常规按钮.一般称按 ...

  7. Arcgis Engine(ae)接口详解(8):临时元素(element)

    //主地图的地图(map)对象 IMap map = null; IActiveView activeView = null; //IGraphicsContainer用于操作临时元素,可以通过map ...

  8. Arcgis Engine(ae)接口详解(7):地图(map)操作

    IMap map = null; //跟map同一层次的activeView对象,他们都是“地图”的对象,map管理地图内容,activeView管理显示内容 IActiveView activeVi ...

  9. Arcgis Engine(ae)接口详解(5):IGeometry几何高级操作

    IPoint point = new PointClass(); point.PutCoords(, ); //ITopologicalOperator接口用于几何对象的几何操作 ITopologic ...

随机推荐

  1. last---显示用户最近登录信息

    last命令用于显示用户最近登录信息.单独执行last命令,它会读取/var/log/wtmp的文件,并把该给文件的内容记录的登入系统的用户名单全部显示出来. 语法 last(选项)(参数) 选项 - ...

  2. reboot---重启Linux系统

    reboot命令用来重新启动正在运行的Linux操作系统. 语法 reboot(选项) 选项 -d:重新开机时不把数据写入记录文件/var/tmp/wtmp.本参数具有“-n”参数效果: -f:强制重 ...

  3. Gym - 100548C The Problem Needs 3D Arrays

    Problem C.   The Problem Needs 3D Arrays Time Limit: 6000MS Memory Limit: 262144KB 64bit IO Format: ...

  4. CodeForce 424C Magic Formulas

    这个题就是求出给的公式的结果. 仅仅要知道异或运算满足交换律跟结合律即可了.之后就是化简公式. #include<map> #include<string> #include& ...

  5. 用 runcloud.io 免费部署、优化管理你的多个VPS( 目前支持 Ubuntu 16.04 )

    使用RunCloud.io轻松实现Web部署 使用VPS.云服务器,通常会安装基本的操作系统,之后必须自己安装Apache,MySQL,PHP,尤其是服务器的性能优化,这对大多数人来说可能是非常具有挑 ...

  6. js配合My97datepicker给日期添加天数

    <input name="ctl00$ContentPlaceHolder1$txtTimeStart" type="text" value=" ...

  7. 3.SOAP和WSDL的一些必要知识

    转自:https://www.cnblogs.com/JeffreySun/archive/2009/12/14/1623766.html SOAP和WSDL对Web Service.WCF进行深入了 ...

  8. Day3下午解题报告

    预计分数:20+40+30=90 实际分数:40+90+60=190 再次人品爆发&&手感爆发&&智商爆发 谁能告诉我为什么T1数据这么水.. 谁能告诉我为什么T2数据 ...

  9. Linux下搭建JSP环境

    Linux下搭建JSP环境     作为一名Java EE系统架构工程师,经常需要搭配和建立JSP(Java Server Pages)的开发环境和运行环境,所以本人在平时的工作中积累了一些在Linu ...

  10. Android之Socket的基于UDP传输

    接收方创建步骤: 1.  创建一个DatagramSocket对象,并指定监听的端口号 DatagramSocket socket = new  DatagramSocket (4567); 2. 创 ...