ArcGISPlotSilverlightAPI For WPF, arcgisapiforwpf

Source: Internet
Author: User

ArcGISPlotSilverlightAPI For WPF, arcgisapiforwpf

There is a need for the past two days. You can draw arrows on the map to see the effect.

Arcgis for WPF version 10.2.5.0, but this API is not found in the official documentation. You can write it yourself, and you can't start with it. Instead, I searched the internet and found a good article: Workshop. Although it is very suitable for the results I want, after downloading the dll, it is not applicable to the WPF version. After using the IL decompilation, we found that this dll references ESRI. arcGIS. client. dll, but the version number is relatively low, and may be silverlight: consider replacing it with the ESRI of the WPF version suitable for me. arcGIS. client. dll, then copy all the code, and recompile a dynamic link library for my use. Open VS, add a class library project, name ArcGISPlotSilverlightAPI, add ESRI. ArcGIS. Client. dll that references the WPF version, create various types, and copy the code... After compilation, some compilation errors occur. After elimination, the compilation is successful! As for another DLL file: Matrix. dll, it is completely useless, so you don't need to worry about it .. In the ArcGIS for WPF project, reference the compiled dll file:
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 );         }}

 

Run. You can draw the map with the mouse! Below is the connection: http://pan.baidu.com/s/1o8vlKWM

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.