1、CommandUIs部分

这部分主要是定义承载Command和Tool的具体UI。如下图所示。

以CommandUI结尾的这几个类都是继承了Framework.Engine里面的ICommandUI接口,这样我们定义的Command和Tool就可以和这些UI绑定到一起了。

其中BarButtonItemCommandUI是DEV库中普通的按钮,BarCheckItemCommandUI是DEV库中由选中状态的按钮,MenuItemCommandUI是菜单按钮,一般右键菜单项会用这个UI,ToolStripMenuItemCommandUI是Winform下右键菜单项,在TocControl图层树中的右键菜单会采用这个按钮项。

2、Controls部分

主要定义了常用的UI。如下图所示。

3、常用命令和工具

我们看下最常用的地图放大工具的定义。

public class MapZoomInTool : MapTool
{
private readonly ESRI.ArcGIS.SystemUI.ITool _EsriTool = null;
public MapZoomInTool(MapApplication pMapApplication)
: base(pMapApplication)
{
this._EsriTool = new ControlsMapZoomInToolClass();
this.SetIcon(CommandIconSize.IconSize16, "MapTools/Res/MapZoomIn16.png");
} /// <summary>
/// 激活执行的函数
/// </summary>
public override void OnActive()
{
base.OnActive();
(this._EsriTool as ESRI.ArcGIS.SystemUI.ICommand).OnCreate(this.MapApplication.ActiveControl);
this.MapApplication.ActiveControl.CurrentTool = this._EsriTool;
} /// <summary>
/// 工具失活执行的函数
/// </summary>
public override void OnDeActivate()
{
base.OnDeActivate();
this.MapApplication.ActiveControl.CurrentTool = null;
} /// <summary>
/// 鼠标按下执行的函数
/// </summary>
/// <param name="button"></param>
/// <param name="shift"></param>
/// <param name="x"></param>
/// <param name="y"></param>
public override void OnMouseDown(int button, int shift, int x, int y)
{
if (button == 4)
{
this.MapApplication.AxControlPan();
}
base.OnMouseDown(button, shift, x, y);
}
}

这就意味着,只要继承实现了MapApplication这个类,就可以直接使用该工具。例如我们的系统首页,定义了一个MapApplication实例,那么可以在此基础上初始化地图放大工具。

我们系统里面其他功能也要用这个工具的时候,也可以初始化一个MapApplication,或者实现一个继承MapApplication的类。例如系统中的出图模板设计功能。

这个功能里面,我们继承MapApplication,定义了LayoutDesignApplication。如下图所示。

public class LayoutDesignApplication : MapApplication
{
/// <summary>
/// 版式设计主程序类
/// </summary>
/// <param name="pAxMapControl"></param>
/// <param name="pAxPageLayoutControl"></param>
public LayoutDesignApplication(AxMapControl pAxMapControl, AxPageLayoutControl pAxPageLayoutControl)
: base(pAxMapControl, pAxPageLayoutControl)
{
this.LayoutDesign = new LayoutDesign();
} /// <summary>
/// 当前打开的 模板文件路径
/// </summary>
public string ShmFilePath { get; set; } = ""; /// <summary>
/// 版式设计对象
/// </summary>
public LayoutDesign LayoutDesign { get; private set; } = null; /// <summary>
/// 当前打开地图的元数据
/// </summary>
public GeoChemMetaData GeoChemMetaData { get; private set; } /// <summary>
/// 得到页面布局对象
/// </summary>
public IPageLayout PageLayout
{
get
{
return this.PageLayoutControl.PageLayout;
}
}
/// <summary>
/// 加载属性面板的UI
/// </summary>
public Border PropertyBorder { get; set; } = null;
}

添加工具的代码如下。

this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new OpenMxdCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new OpenShmCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new AddDataCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new SaveShmCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new SaveAsShmCommand(this._LayoutDesignAplication))); this.UI_Tool_Bar.Items.Add(new BarItemLinkSeparator());
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new MapFrameCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new MapGridCommand(this._LayoutDesignAplication))); this.UI_Tool_Bar.Items.Add(new BarItemLinkSeparator());
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new ResTableCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new ClassTableCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new ClassHistogramCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new HistogramMapCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new NorthArrowCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new ScaleBarCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new LegendCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new TitleCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new PointTextTool(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new PictureCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new NeatlineItemCommand(this._LayoutDesignAplication))); this.UI_Tool_Bar.Items.Add(new BarItemLinkSeparator());
SelectTool myPLDSelectTool = new SelectTool(this._LayoutDesignAplication);
this.UI_Tool_Bar.Items.Add(new BarCheckItemCommandUI(myPLDSelectTool));
this._LayoutDesignAplication.SelectTool = myPLDSelectTool; this.UI_Tool_Bar.Items.Add(new BarCheckItemCommandUI(new PageZoomInTool(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarCheckItemCommandUI(new PageZoomOutTool(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarCheckItemCommandUI(new PagePanTool(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new PageZoomInFixedCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new PageZoomOutFixedCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new PageZoomWholePageCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new PageZoom100PercentCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new PageZoomBackCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new PageZoomForwardCommand(this._LayoutDesignAplication)));
this.UI_Tool_Bar.Items.Add(new BarItemLinkSeparator());
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new ViewExportPicCommand(this._LayoutDesignAplication)));

再例如,布点的这个模块。

我们继承MapApplication定义了DeployApplication,如下图所示。

public class DeployApplication : MapApplication
{
private Project _Project = null;
private object _SelectObjectOnProjectTree = null;
private IFeature _SelectPointFeature = null; /// <summary>
/// 采样点布置主App
/// </summary>
/// <param name="pAxMapControl"></param>
/// <param name="pAxPageLayoutControl"></param>
public DeployApplication(AxMapControl pAxMapControl, AxPageLayoutControl pAxPageLayoutControl)
: base(pAxMapControl, pAxPageLayoutControl)
{
this.EngineEditor = new EngineEditorClass();
} /// <summary>
/// ArcEngine编辑类
/// </summary>
public EngineEditorClass EngineEditor { get; private set; } /// <summary>
/// 当前工程对象
/// </summary>
public Project Project
{
get
{
return this._Project;
}
set
{
this._Project = value;
this.OnProjectChanged?.Invoke(this, new EventArgs());
}
} /// <summary>
/// 得到或设置树上选择的对象
/// </summary>
public object SelectObjectOnWorkZoneTree
{
get { return this._SelectObjectOnProjectTree; }
set
{
this._SelectObjectOnProjectTree = value;
this.OnSelectObjectOnProjectTreeChanged?.Invoke(this, new EventArgs());
}
} /// <summary>
/// 得到或设置当前选中的采样点要素
/// </summary>
public IFeature SelectPointFeature
{
get
{
return this._SelectPointFeature;
}
set
{
this._SelectPointFeature = value;
this.OnSelectPointFeatureChanged?.Invoke(this, new EventArgs());
}
} /// <summary>
/// 触发Map25Sheet信息变化事件
/// </summary>
public void FireMap25SheetInfoChangedEvent()
{
this.OnMap25SheetInfoChanged?.Invoke(this, new EventArgs());
} /// <summary>
/// 当工程发生变化触发的事件
/// </summary>
public event EventHandler<EventArgs> OnProjectChanged; /// <summary>
/// 当在树上选中的对象发生变化触发的事件
/// </summary>
public event EventHandler<EventArgs> OnSelectObjectOnProjectTreeChanged; /// <summary>
/// 当选择的采样点元素发生变化触发的事件
/// </summary>
public event EventHandler<EventArgs> OnSelectPointFeatureChanged; /// <summary>
/// 当Map25Sheet的信息发生变化后触发的函数
/// </summary>
public event EventHandler<EventArgs> OnMap25SheetInfoChanged;
}

添加工具如下。

//初始化Application
this._DeployApplication = new DeployApplication(myAxMapControl, myAxPageLayoutControl);
this._DeployApplication.MainWindow = this;
this._DeployApplication.OnProjectChanged += Application_OnWorkZoneChanged;
this._DeployApplication.OnSelectObjectOnProjectTreeChanged += _Application_OnSelectObjectOnWorkZoneTreeChanged;
this._DeployApplication.OnSelectPointFeatureChanged += Application_OnSelectPointFeatureChanged;
this._DeployApplication.OnMap25SheetInfoChanged += Application_OnMap25SheetInfoChanged; this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new ProjectNewCommand(this._DeployApplication)));
ProjectOpenCommand myWorkZoneOpenCommand = new ProjectOpenCommand(this._DeployApplication);
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(myWorkZoneOpenCommand));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new FrameworkUI.Files.AddDataCommand(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarItemLinkSeparator());
this.UI_Tool_Bar.Items.Add(new BarCheckItemCommandUI(new FrameworkUI.MapTools.MapZoomInTool(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarCheckItemCommandUI(new FrameworkUI.MapTools.MapZoomOutTool(this._DeployApplication)));
FrameworkUI.MapTools.MapPanTool myMapPanTool = new FrameworkUI.MapTools.MapPanTool(this._DeployApplication);
this.UI_Tool_Bar.Items.Add(new BarCheckItemCommandUI(myMapPanTool));
this._DeployApplication.CrruteTool = myMapPanTool;
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new FrameworkUI.MapTools.MapZoomInFixedCommand(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new FrameworkUI.MapTools.MapZoomOutFixedCommand(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new FrameworkUI.MapTools.MapFullExtentCommand(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new FrameworkUI.MapTools.MapZoomBackCommand(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new FrameworkUI.MapTools.MapZoomForwardCommand(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarItemLinkSeparator());
this.UI_Tool_Bar.Items.Add(new BarCheckItemCommandUI(new FrameworkUI.MapTools.MeasureTool(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarItemLinkSeparator());
this.UI_Tool_Bar.Items.Add(new BarCheckItemCommandUI(new Map5SheetSelectTool(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarCheckItemCommandUI(new FrameworkUI.MapTools.FeaturesClearSelectCommand(this._DeployApplication) { Caption = "Clear Select" }));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new MapSheetLabelCommand(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new SamplePointLabelCommand(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new Map5TerrainViewCommand(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarItemLinkSeparator());
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new Map25AutoPointCommand(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new Map25ClearPointCommand(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarItemLinkSeparator());
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new EditorStartCommand(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarCheckItemCommandUI(new EditorEditTool(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarCheckItemCommandUI(new EditorNewPointTool(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new EditorSaveCommand(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new EditorStopCommand(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarItemLinkSeparator());
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new Map25LoadUnitCommand(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new Map25EncodeCommand(this._DeployApplication)));
this.UI_Tool_Bar.Items.Add(new BarButtonItemCommandUI(new Map25ExportCommand(this._DeployApplication)));

ArcObjects SDK开发 022 开发框架搭建-FrameWorkUI包设计的更多相关文章

  1. TortoiseSVN安装以及淘宝 TAE SDK 开发环境的搭建

    一.TortoiseSVN 的下载和安装 1.进入TortoiseSVN 官网下载地址http://tortoisesvn.net/downloads.html,根据自己的操作系统位数下载相应最新版本 ...

  2. esp8266 SDK开发之环境搭建

    最近在弄这个WiFi模块,发现网上SDK开发方面的资料很少,发现了一套视频教程,不过主讲人的讲课方式实在受不了.对基于SDK开发感兴趣的同学可以通过本帖在Ubuntu系统上通过Eclipes搭建开发环 ...

  3. Spring MVC 学习笔记12 —— SpringMVC+Hibernate开发(1)依赖包搭建

    Spring MVC 学习笔记12 -- SpringMVC+Hibernate开发(1)依赖包搭建 用Hibernate帮助建立SpringMVC与数据库之间的联系,通过配置DAO层,Service ...

  4. C# 快速开发框架搭建—开发工具介绍

    C# 快速开发框架搭建—开发工具介绍 一.VS2013,SQL SERVER R22008 以上两种工具如有不会者自行百度学习下. 二.动软代码生成器 对于经典的三层架构框架来说,使用动软代码生成器会 ...

  5. Linux学习心得之 Linux下命令行Android开发环境的搭建

    作者:枫雪庭 出处:http://www.cnblogs.com/FengXueTing-px/ 欢迎转载 Linux学习心得之 Linux下命令行Android开发环境的搭建 1. 前言2. Jav ...

  6. Java开发环境的搭建以及使用eclipse从头一步步创建java项目

    一.java 开发环境的搭建 这里主要说的是在windows 环境下怎么配置环境. 1.首先安装JDK java的sdk简称JDK ,去其官方网站下载最近的JDK即可..http://www.orac ...

  7. Linux环境下Android开发环境的搭建

    本文主要介绍在Ubuntu下Android开发环境的搭建,所使用的IDE为Eclipse(Android Studio同理,且可省去配置SDK以及安装adt插件的步骤). 1.安装JDK (1)JDK ...

  8. Cordova开发环境的搭建

    Cordova开发环境的搭建 原文地址:http://imziv.com/blog/article/read.htm?id=66 Cordova为目前做混合式开发中比较受欢迎的一个解决方案了,并且拥有 ...

  9. windows Android开发环境快速搭建和部署

    windows安装Android的开发环境相对来说比较简单,本文写给第一次想在自己Windows上建立Android开发环境的朋友们,为了确保大家能顺利完成开发环境的搭建,文章写的尽量详细,希望对初级 ...

  10. 【Android自学之旅】 Android开发环境的搭建

    [Android自学之旅] Android开发环境的搭建 搭建参考教程: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-do ...

随机推荐

  1. OpenDataV低代码平台增加自定义属性编辑

    上一篇我们讲到了怎么在OpenDataV中添加自己的组件,为了让大家更快的上手我们的平台,这一次针对自定义属性编辑,我们再来加一篇说明.我们先来看一下OpenDataV中的属性编辑功能. 当我们拖动一 ...

  2. python中类与对象的命名空间(静态属性的陷阱)、__dict__ 和 dir() 在继承中使用说明

    1. 面向对象的概念 1)类是一类抽象的事物,对象是一个具体的事物:用类创建对象的过程,称为实例化. 2)类就是一个模子,只知道在这个模子里有什么属性.什么方法,但是不知道这些属性.方法具体是什么: ...

  3. cf1082 A. Vasya and Book

    中文题意: 思路:我们先看看能不能直接从x翻到y,abs(y-x)%d==0,可以就直接输出abs(y-x)/d咯,不行的话之后有2种操作 1.先翻回到第一页,从第一页看看能不能范到y,不能的话翻到最 ...

  4. 学习ASP.NET Core Blazor编程系列六——初始化数据

    学习ASP.NET Core Blazor编程系列一--综述 学习ASP.NET Core Blazor编程系列二--第一个Blazor应用程序(上) 学习ASP.NET Core Blazor编程系 ...

  5. CRT & EXCRT 学习笔记

    这玩意解决的是把同余方程组合并的问题. CRT的核心思想和拉格朗日插值差不多,就是构造一组\(R_i\)使得$\forall i,j(i \neq j) $ \[R_im_i = 1, R_im_j ...

  6. WiresShark

    WireShark 分析数据包技巧 确定WireShark的位置[是否在公网上] 选择捕获接口,一般都是internet网络接口 使用捕获过滤器 使用显示过滤器[捕获后的数据包还是很复杂,用显示过滤器 ...

  7. flutter系列之:builder为构造器而生

    目录 简介 Builder StatefulBuilder LayoutBuilder 总结 简介 flutter中有很多种Builder,虽然所有的builder都是构造器,但是不同的builder ...

  8. 【Firefox浏览器】关闭触摸板双指滑动进行前进后退的功能

    痛点 本以为只是Chrome浏览器存在这一奇葩功能,没成想Firefox也沦陷了!有好一阵子在使用Firefox的时候,并未发现其存在这个功能.直到有一天,打开自己的博客,翻阅上篇< [Chro ...

  9. SpringBoot内置工具类,告别瞎写工具类了

    不知大家有没有注意到,接手的项目中存在多个重复的工具类,发现其中很多功能,Spring 自带的都有.于是整理了本文,希望能够帮助到大家! 一.断言 断言是一个逻辑判断,用于检查不应该发生的情况 Ass ...

  10. LcdTools如何导出内置画面为bmp图片

    运行LcdTools,先设置好图片所需分辨率参数,点击"画面设置"栏,修改下图所示参数 点击"画面设置"栏,在"画面资源"栏找到需要导出的画 ...