ArcGIS API for Silverlight动态标绘的实现

ArcGIS API for Silverlight动态标绘的实现,第1张

概述1、下载2个dll文件,分别是: ArcGISPlotSilverlightAPI.dll 和 Matrix.dll 其下载地址为:http://download.csdn.net/detail/taomanman/9212163 2、在Silverlight项目中添加上面2个dll引用,如下图所示: 3、核心及调用代码如下所示: <UserControl x:Class="SLPlotMap.M


1、下载2个dll文件,分别是:

ArcGISPlotSilverlightAPI.dll 和 Matrix.dll

其下载地址为:http://download.csdn.net/detail/taomanman/9212163


2、在Silverlight项目中添加上面2个dll引用,如下图所示:



3、核心及调用代码如下所示:

<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/2008"     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">            <esri:Map.Layers>                <esri:LayerCollection>                    <esri:ArcGISTiledMapServiceLayer Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />                </esri:LayerCollection>            </esri:Map.Layers>        </esri:Map>        <GrID>            <GrID.RowDeFinitions>                <RowDeFinition Height="40" />            </GrID.RowDeFinitions>            <StackPanel OrIEntation="Horizontal" margin="2">                <button Click="simpleArrow_Click">                    简单箭头                </button>                <button Click="TailedArrow_Click">                    尾箭头                </button>                <button Click="StraightArrow_Click">                    直箭头                </button>                <button Click="CustomArrow_Click">                    自定义箭头                </button>                <button Click="CustomTailedArrow_Click">                    自定义尾箭头                </button>                <button Click="DoubleArrow_Click">                    双箭头                </button>                <button Click="AssemblyArea_Click">                    装配区                </button>                <button Click="CurveFlag_Click">                    曲线旗                </button>                <button Click="RectFlag_Click">                    矩形旗                </button>                <button Click="TriangleFlag_Click">                    三角旗                </button>                <button Click="Circle_Click">                    圆                </button>                <button Click="Finish_Click">                    结束                </button>                <button Click="StartEdit_Click">                    开始编辑                </button>                <button Click="StopEdit_Click">                    停止编辑                </button>            </StackPanel>        </GrID>    </GrID></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))            };            Graphic item = new Graphic            {                Geometry = polygon,Symbol = symbol            };            this._gGraphicslayer1.Graphics.Add(item);            Message el = new Message            {                To = "lei@192.168.200.117",Type = MessageType.chat,Body = polygon.ToString()            };            this._xmppClIEnt.Send(el);        }        private voID _xmppClIEnt_OnRosterEnd(object sender,EventArgs e)        {        }        private voID AssemblyArea_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 office");            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.setPlotDrawMode(PlotDrawMode.CustomTailedArrow);        }        private voID DoubleArrow_Click(object sender,RoutedEventArgs e)        {            this._plotDraw.setPlotDrawMode(PlotDrawMode.DoubleArrow);        }        private voID Finish_Click(object sender,RoutedEventArgs e)        {            this._plotDraw.setPlotDrawMode(PlotDrawMode.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.setPlotDrawMode(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.setPlotDrawMode(PlotDrawMode.StraightArrow);        }        private voID TailedArrow_Click(object sender,RoutedEventArgs e)        {            this._plotDraw.setPlotDrawMode(PlotDrawMode.TailedArrow);        }        private voID TriangleFlag_Click(object sender,RoutedEventArgs e)        {            this._plotDraw.setPlotDrawMode(PlotDrawMode.TriangleFlag);        }    }}
总结

以上是内存溢出为你收集整理的ArcGIS API for Silverlight动态标绘的实现全部内容,希望文章能够帮你解决ArcGIS API for Silverlight动态标绘的实现所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1009912.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存