这两天有个需求,在地图上做标绘箭头,效果如下图。

Arcgis for WPF 10.2.5.0版本,然而官方文档中没有这种API,自己去写一个呢,又感觉无从下手。无奈去网上搜索了一下,发现一篇好文:
即ArcGISPlotSilverlightAPI.dll。虽然很适合我要的结果,但是下载dll后,发现并不适用WPF版本。
 
使用IL反编译以后,发现该dll引用ESRI.ArcGIS.Client.dll,但是版本号比较低,而且可能是silverlight版的:
考虑替换为适合我用的WPF版本的ESRI.ArcGIS.Client.dll,然后把这些代码全部复制出来,重新编译一个动态链接库,为我所用。
 
打开VS,添加类库项目,命名还是ArcGISPlotSilverlightAPI,然后添加引用WPF版本的ESRI.ArcGIS.Client.dll,
新建各种类,复制代码。。。完成后编译,出现一些编译错误,排除后,编译成功!
 
至于另外一个DLL文件:Matrix.dll呢,完全没有用到,就先不用管它了。。
 
在ArcGIS for WPF的项目中,引用刚才编译出来的dll文件:
 
 
public partial class MainWindow : Window
{
private EditGeometry _editGeometry;
private GraphicsLayer _gGraphicsLayer1;
private bool _isEdit;
private bool _isFinish;
private PlotDraw _plotDraw;
private long _pointCount;
private TailedArrow _tArraw;
private Graphic selectedPointGraphic; public MainWindow()
{
InitializeComponent();
Init();
} public void Init()
{
this._pointCount = 0L;
this._gGraphicsLayer1 = new GraphicsLayer();
this._isFinish = true;
this._plotDraw = new PlotDraw(mainMap);
EditGeometry geometry = new EditGeometry { Map=this.mainMap,IsEnabled=true,EditVerticesEnabled=false};
this._editGeometry = geometry;
this.mainMap.Layers.Add(this._gGraphicsLayer1);
this._gGraphicsLayer1.MouseLeftButtonDown += _gGraphicsLayer1_MouseLeftButtonDown;
this._isEdit = true;
this._plotDraw.DrawEnd += _plotDraw_DrawEnd;
this._plotDraw.setPlotDrawMode(PlotDrawMode.TailedArrow);
} void _gGraphicsLayer1_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)
{
//throw new NotImplementedException();
if (this._isEdit)
{
e.Handled = true;
if (e.Graphic.Geometry is MapPoint)
{
e.Graphic.Selected = true;
this.selectedPointGraphic = e.Graphic;
}
else
{
this._editGeometry.StartEdit(e.Graphic);
}
}
} void _plotDraw_DrawEnd(ESRI.ArcGIS.Client.Geometry.Polygon polygon)
{
//throw new NotImplementedException();
Symbol symbol = App.Current.Resources["DrawFillSymbol"] as Symbol;
Graphic item = new Graphic
{
Geometry = polygon,
Symbol = symbol
}; this._gGraphicsLayer1.Graphics.Add(item );
}
}
 
 
运行,可以用鼠标在地图上做标绘了!
 
下面是连接:http://pan.baidu.com/s/1o8vlKWM

ArcGISPlotSilverlightAPI For WPF的更多相关文章

  1. 在WPF中使用依赖注入的方式创建视图

    在WPF中使用依赖注入的方式创建视图 0x00 问题的产生 互联网时代桌面开发真是越来越少了,很多应用都转到了浏览器端和移动智能终端,相应的软件开发上的新技术应用到桌面开发的文章也很少.我之前主要做W ...

  2. MVVM框架从WPF移植到UWP遇到的问题和解决方法

    MVVM框架从WPF移植到UWP遇到的问题和解决方法 0x00 起因 这几天开始学习UWP了,之前有WPF经验,所以总体感觉还可以,看了一些基础概念和主题,写了几个测试程序,突然想起来了前一段时间在W ...

  3. MVVM模式解析和在WPF中的实现(六) 用依赖注入的方式配置ViewModel并注册消息

    MVVM模式解析和在WPF中的实现(六) 用依赖注入的方式配置ViewModel并注册消息 系列目录: MVVM模式解析和在WPF中的实现(一)MVVM模式简介 MVVM模式解析和在WPF中的实现(二 ...

  4. MVVM模式解析和在WPF中的实现(五)View和ViewModel的通信

    MVVM模式解析和在WPF中的实现(五) View和ViewModel的通信 系列目录: MVVM模式解析和在WPF中的实现(一)MVVM模式简介 MVVM模式解析和在WPF中的实现(二)数据绑定 M ...

  5. MVVM设计模式和WPF中的实现(四)事件绑定

    MVVM设计模式和在WPF中的实现(四) 事件绑定 系列目录: MVVM模式解析和在WPF中的实现(一)MVVM模式简介 MVVM模式解析和在WPF中的实现(二)数据绑定 MVVM模式解析和在WPF中 ...

  6. MVVM模式解析和在WPF中的实现(三)命令绑定

    MVVM模式解析和在WPF中的实现(三) 命令绑定 系列目录: MVVM模式解析和在WPF中的实现(一)MVVM模式简介 MVVM模式解析和在WPF中的实现(二)数据绑定 MVVM模式解析和在WPF中 ...

  7. MVVM模式和在WPF中的实现(二)数据绑定

    MVVM模式解析和在WPF中的实现(二) 数据绑定 系列目录: MVVM模式解析和在WPF中的实现(一)MVVM模式简介 MVVM模式解析和在WPF中的实现(二)数据绑定 MVVM模式解析和在WPF中 ...

  8. MVVM模式和在WPF中的实现(一)MVVM模式简介

    MVVM模式解析和在WPF中的实现(一) MVVM模式简介 系列目录: MVVM模式解析和在WPF中的实现(一)MVVM模式简介 MVVM模式解析和在WPF中的实现(二)数据绑定 MVVM模式解析和在 ...

  9. 逆天通用水印支持Winform,WPF,Web,WP,Win10。支持位置选择(9个位置 ==》[X])

    常用技能:http://www.cnblogs.com/dunitian/p/4822808.html#skill 逆天博客:http://dnt.dkil.net 逆天通用水印扩展篇~新增剪贴板系列 ...

随机推荐

  1. 阿里云 下载的 apache 证书 转换为 pcks8 证书

    第一步: 百度 搜索  rsa 转 pcks8 将 .key 文件 转换成 pcks8.key . 第二部: 将 chain.crt 的 内容 复制到 public.crt 下方.. 新的 publi ...

  2. net 反编译神器

    文章地址:https://www.cnblogs.com/sheng-jie/p/10168411.html dnSpy官网下载  分享链接 .net core源码导航 https://www.cnb ...

  3. 【性能测试】:关于测试F5负载均衡的问题

    在压测过程中,前置分发机的请求分发策略有多种,轮询,随机,DNS均衡,最小连接数等 问题出现的前提:因测试的一个系统对用户安全性校验较强,例如做交易之前,需要验证用户安全信息等 问题出现的现象:当lo ...

  4. (转)zabbix3.4使用percona-monitoring-plugins监控mysql

    原文:https://blog.csdn.net/yanggd1987/article/details/79656771 简介 之前主要使用nagios监控mysql,本文主要介绍使用percona- ...

  5. JavaScript设计模式(三) - 策略模式

    什么是策略模式? 策略模式支持在运行时由使用者选择合适的算法,对于使用者而言不用关心背后的具体实现,由使用者自动根据当前程序执行的上下文和配置,从已有的算法列列表中选择出合适的算法来处理当前任务.   ...

  6. linux 和 windows 安装composer

    在 Linux 和 Mac OS X 中可以运行如下命令: curl -sS https://getcomposer.org/installer | phpmv composer.phar /usr/ ...

  7. Struts dispatchAction

    在Struts中定义动态Action,不用定义多个Action,可以实现一个action,多个跳转. 在定义时,继承DispatchAction,并定义parameter的名字 在jsp页面选择act ...

  8. jdbc oracle clob

    import java.io.BufferedReader; import java.io.Reader; import java.io.Writer; import java.sql.Callabl ...

  9. Flex4 outerDocument

    <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="ht ...

  10. nginx 反向代理https

    nginx 反向代理https   原来我用vertx创建了一个https apiserver,想着用nginx反向代理一下.证书是阿里云上免费一年的. 后来发现nginx要反向代理https自己也必 ...