Implementation of the ArcGIS API for Silverlight dynamic plotting

Source: Internet
Author: User
Tags silverlight

Original: ArcGIS API for Silverlight dynamic plotting implementation


1. Download 2 DLL files, respectively:

ArcGISPlotSilverlightAPI.dll and the Matrix.dll

It is: http://download.csdn.net/detail/taomanman/9212163


2. Add the above 2 DLL references in the Silverlight project, as shown in:



3. The core and the calling code are as follows:

<usercontrol x:class= "Slplotmap.mainpage" xmlns= "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x= "Http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d= "http://schemas.microsoft.com/expression/blend/ "Xmlns:mc=" http://schemas.openxmlformats.org/markup-compatibility/2006 "mc:ignorable=" D "xmlns:layer=" CLR -namespace:mapclient.commonclass "xmlns:esri=" http://schemas.esri.com/arcgis/client/2009 "> <grid x:name=" LayoutRoot "background=" white "> <esri:map background=" White "name=" MyMap "wraparound=" True "> &L t;esri:map.layers> <esri:LayerCollection> <esri:arcgistiledmapservicelayer U Rl= "Http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/> </esri:layer collection> </esri:Map.Layers> </esri:Map> <Grid> <grid.rowdef Initions> <rowdefinitiOn height= "/> </Grid.RowDefinitions> <stackpanel orientation=" Horizontal "margin=" 2 "                > <button click= "Simplearrow_click" > Simple arrows </Button> <button click= "Tailedarrow_click" > Tail arrows </Button> &lt ; Button click= "Straightarrow_click" > Straight arrow </Button> <button Cli ck= "Customarrow_click" > Custom arrows </Button> <button click= "Custom Tailedarrow_click "> Custom tail arrows </Button> <button click=" Doublearr Ow_click "> Double arrow </Button> <button click=" Assemblyarea_click "&G                    T            Assembly Area </Button> <button click= "Curveflag_click" > Curve flag    </Button> <button click= "Rectflag_click" > Rectangle flag </button                > <button click= "Triangleflag_click" > Triangle flag </Button>  <button click= "Circle_click" > Round </Button> <button click= "Finish_click" > End </Button> <button click= "Startedit_                    Click > Start Editing </Button> <button click= "Stopedit_click" > Stop editing </Button> </StackPanel> </Grid> &LT;/GRID&GT;&L T;/usercontrol>

Using system;using system.collections.generic;using system.net;using system.windows;using System.Windows.Controls; Using system.windows.documents;using system.windows.input;using system.windows.media;using System.windows.media.animation;using system.windows.shapes;using ESRI. Arcgis.client;using arcgisplotsilverlightapi;using matrix.xmpp.client;using ESRI. Arcgis.client.geometry;using ESRI. Arcgis.client.symbols;using ESRI. Arcgis.client.geometry;using ESRI. Arcgis.client.symbols;using matrix.xmpp;using matrix.net;using mapclient.commonclass;using System.windows.media.imaging;using system.io;using slplotmap.commonclass;namespace SLPlotMap{public partial class        Mainpage:usercontrol {private Assemblyarea _aarrow;        Private Simplearrow _arraw;        Private Customarrow _carrow;        Private Curveflag _cflag;        Private Circle _circle;        Private Customtailedarrow _ctarrow;        Private Doublearrow _darrow;        Private Editgeometry _editgeometry; PrivaTe Graphicslayer _ggraphicslayer1;        private bool _isedit;        private bool _isfinish;        Private Plotdraw _plotdraw;        Private long _pointcount;        Private Rectflag _rflag;        Private Straightarrow _sarrow;        Private Tailedarrow _tarraw;        Private Triangleflag _tflag;        Private Xmppclient _xmppclient;        Private Graphic selectedpointgraphic;            Public MainPage () {InitializeComponent (); This.        Init ();            private void _ggraphicslayer_mouseleftbuttondown (object sender, Graphicmousebuttoneventargs e) {                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); }            }        }        private void _plotdraw_drawend (ESRI.                ArcGIS.Client.Geometry.Polygon Polygon) {simplefillsymbol symbol = new Simplefillsymbol {            Fill = new SolidColorBrush (Color.FromArgb (0x9b, 0xff, 0, 0)};            Graphic item = new Graphic {Geometry = polygon, symbol = symbol};            This._ggraphicslayer1.graphics.add (item); Message el = New Message {to = "[email protected]", Type = Messagetype.chat , Body = polygon.            ToString ()};        This._xmppclient.send (EL); private void _xmppclient_onrosterend (object sender, EventArgs e) {} private void Assemblyar        Ea_click (object sender, RoutedEventArgs e) {this._plotdraw.setplotdrawmode (Plotdrawmode.assemblyarea);        private void Circle_click (object sender, RoutedEventArgs e){This._plotdraw.setplotdrawmode (plotdrawmode.circle); } private void CloseSession () {this._xmppclient.sendunavailablepresence ("Gone home from the Offi            Ce ");        This._xmppclient.close ();            } private void Connect () {this._xmppclient.setusername ("ZBC");            This._xmppclient.setxmppdomain ("192.168.200.117");            This._xmppclient.password = "ZBC";            This._xmppclient.onrosterend + = new eventhandler<matrix.eventargs> (this._xmppclient_onrosterend);            This._xmppclient.port = 0x1466;            This._xmppclient.transport = Transport.bosh;        This._xmppclient.uri = new Uri ("http://192.168.200.117:8080/http-bind/"); private void Curveflag_click (object sender, RoutedEventArgs e) {This._plotdraw.setplotdrawmode        (Plotdrawmode.curveflag); private void Customarrow_click (object sender, RoutedEventArgs e) {thiS._plotdraw.setplotdrawmode (Plotdrawmode.customarrow); private void Customtailedarrow_click (object sender, RoutedEventArgs e) {This._plotdraw.setplot        DrawMode (Plotdrawmode.customtailedarrow); private void Doublearrow_click (object sender, RoutedEventArgs e) {THIS._PLOTDRAW.SETPLOTDRAWMO        De (Plotdrawmode.doublearrow); } private void Finish_click (object sender, RoutedEventArgs e) {This._plotdraw.setplotdrawmode (Pl        Otdrawmode.none);            } public void Init () {this._pointcount = 0L;            This._ggraphicslayer1 = new Graphicslayer ();            This._isfinish = true;            This._xmppclient = new Xmppclient (); This.            Connect ();            This._plotdraw = new Plotdraw (THIS.MYMAP);            This._plotdraw.drawend + = new Plotdraw.drawendeventhandler (this._plotdraw_drawend);            Editgeometry geometry = new Editgeometry {    Map = This.mymap, IsEnabled = True, editverticesenabled = false};            This._editgeometry = geometry;            THIS.MYMAP.LAYERS.ADD (This._ggraphicslayer1); This._ggraphicslayer1.mouseleftbuttondown + = new Graphicslayer.mousebuttoneventhandler (this._gGraphicsLayer_            MouseLeftButtonDown);        This._isedit = false; private void Rectflag_click (object sender, RoutedEventArgs e) {This._plotdraw.setplotdrawmode (        Plotdrawmode.rectflag); private void Simplearrow_click (object sender, RoutedEventArgs e) {THIS._PLOTDRAW.SETPLOTDRAWMO        De (Plotdrawmode.simplearrow);            } private void Startedit_click (object sender, RoutedEventArgs e) {this._isedit = true;        This._plotdraw.setplotdrawmode (Plotdrawmode.none);  } private void Stopedit_click (object sender, RoutedEventArgs e) {this._isedit = false;      private void Straightarrow_click (object sender, RoutedEventArgs e) {THIS._PLOTDRAW.SETPL        Otdrawmode (Plotdrawmode.straightarrow); private void Tailedarrow_click (object sender, RoutedEventArgs e) {THIS._PLOTDRAW.SETPLOTDRAWMO        De (Plotdrawmode.tailedarrow); private void Triangleflag_click (object sender, RoutedEventArgs e) {This._plotdraw.setplotdrawm        Ode (Plotdrawmode.triangleflag); }    }}


===========================================================================

If you find it helpful, scan for support:


ArcGIS API for Silverlight dynamic plotting implementation

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.