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

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. postman小结

    1.get和post请求,get有限制2k,post没有限制post安全 在选择的时候别把get post选错然后,run 2.data 选成txt文件  utf-8 ip ip,result12.1 ...

  2. 1091 N-自守数 (15 分)

    // 建一个判断函数,接受两个整形的变量,再通过循环按位判断相等与否,主体函数中调用被调函数,建立一个判断变量.#include <iostream> using namespace st ...

  3. follow up2-20190426

    406. Minimum Size Subarray 同向双指针 https://www.lintcode.com/problem/minimum-size-subarray-sum/descript ...

  4. Android事件分发和消费机制(转载)

    原文链接:http://www.cnblogs.com/sunzn/archive/2013/05/10/3064129.html Android 中与 Touch 事件相关的方法包括:dispatc ...

  5. 【编程技术-Shell】AWK使用大全

    1.  AWK中输出特殊字符 输出单引号 涉及到转义字符,但是在使用普通的方法进行转义时,会遇到下面的问题 正确的方法:'\'',使用单引号将转义字符括起来,然后后面加上单引号 输出其他特殊字符 输出 ...

  6. redis 持久化之 rdb 快照持久化

    解释1: 虽然redis是单进程,但是它有一个单独的子进程进行rdb操作,为了保证的数据的一致性,当进行rdb操作失败的时候,主进程就停止写入 所以才有了stop-write-on-bgsave-er ...

  7. 【数组】Unique Paths

    题目: A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). ...

  8. 解决UnicodeDecodeError: 'ascii' code can't decode byte 0xef in position

    今天在使用python的pip安装的时候出现了这个错误 UnicodeDecodeError: 'ascii' code can't decode byte 0xef in position 7: o ...

  9. C#判断字符串中是否包含一个子字符串是可以直接使用Contains()方法

    1. 以前判断一个字符串中是否包含另一个子字符串时,习惯使用 IndexOf(); string str = "ABC@QQ"; if(str.IndexOf("@&qu ...

  10. 使用minikube在本机测试kubernetes

    目录 简介 安装 Docker CE 安装 kubectl 安装 minikube 启动 minikube 启动 dashboard 启动一个服务 删除服务 参考 本文主要讲解 minikube(ku ...