ArcGISPlotSilverlightAPI For WPF
这两天有个需求,在地图上做标绘箭头,效果如下图。
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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!