原文:ArcGIS API for Silverlight动态标绘的实现

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, 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动态标绘的实现的更多相关文章

  1. 基于ArcGIS Flex API实现动态标绘(1.1)

    动态标绘API 1.1版本号.相较前一版本号1.0(点击进入).该版本号提供标绘符号的编辑功能. 编辑功能包含两种编辑状态:编辑控制点.对标绘符号进行旋转.八方向拉伸.平移. 编辑控制点例如以下图所看 ...

  2. 基于ArcGIS Flex API实现动态标绘(1.2)

    动态标绘API 1.2,相较前一版本号(点击进入),该版本号新增对基本标绘符号的支持,包含: 单点.多点.折线.手绘线.多边形.手绘多边形.矩形,并提供对应的编辑功能. 例如以下图所看到的,对多点的编 ...

  3. 使用Visifire+ArcGIS API for Silverlight实现Graphic信息的动态图表显示

    原文:使用Visifire+ArcGIS API for Silverlight实现Graphic信息的动态图表显示 首先来看一看实现的效果: PS:原始的程序中更新曲线数据时添加了过渡的效果,具体可 ...

  4. arcgis api for silverlight开发系列之二:缓存图层与动态图层及图层总结 .

    本文摘自:http://blog.csdn.net/leesmn/article/details/6916458(很优秀的博客)   作为ESRI的平台的一份子arcgis api for silve ...

  5. 动态标绘演示系统1.4.3(for ArcGIS Flex)

    标绘有API文档啦! 在线浏览 ------------------------------------------------------------------------------------ ...

  6. ArcGIS API for Silverlight 绘制降雨路径动画

    原文:ArcGIS API for Silverlight 绘制降雨路径动画 #region 降雨动画演示 2014-04-16 List<Graphic> graphics = new ...

  7. ArcGIS API for Silverlight之配准JPG图片地图文字倾斜解决方案

    原文:ArcGIS API for Silverlight之配准JPG图片地图文字倾斜解决方案 根据实际JPG图片进行配准后,发布的地图,利用ArcGIS API for Silverlight在网页 ...

  8. ArcGIS API for Silverlight 之ElementLayer使用及TextSymbol的模板使用

    原文:ArcGIS API for Silverlight 之ElementLayer使用及TextSymbol的模板使用 在开发中动态在地图上添加文字信息,可以使用TextSymbol添加文字 // ...

  9. ArcGIS API for Silverlight 调用GP服务加载等值线图层

    原文:ArcGIS API for Silverlight 调用GP服务加载等值线图层 第二篇.Silverlight客户端调用GP服务 利用ArcGIS API for Silverlight实现G ...

随机推荐

  1. BZOJ2725 : [Violet 6]故乡的梦

    如果S==T,那么答案为0. 如果S与T不连通,那么答案为inf. 否则,S到T的最短路径上至少有一条边. 求出以S为源点的最短路图,是个DAG,随便抓一条S到T的最短路,记为P. 设dpS[x]表示 ...

  2. Codeforces Round #199 (Div. 2) A Xenia and Divisors

    注意题目的数字最大是7 而能整除的只有 1,2,3,4,6,故构成的组合只能是1,2,4 或1,2,6或1,3,6,故分别统计1,2,3,4,6的个数,然后再分配 #include <iostr ...

  3. 【BZOJ】1934: [Shoi2007]Vote 善意的投票(网络流/-二分图匹配)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1934 一开始我想到了这是求最小割,但是我认为这题二分图可做,将1的放在左边,0的放在右边,然后朋友连 ...

  4. Redis错误配置详解

    在使用Redis做缓存时,应用往往能得到非常高的性能.然而,如果配置不当,你将遇到很多令人头疼的问题,比如复制缓冲区限制.复制超时等. Redis提供了许多提高和维护高效内存数据库使用的工具.在无需额 ...

  5. [文字雲產生器] Tagxedo 把文字串成雲、變成畫,印在 T-Shirt、馬克杯、詩袋….

    http://www.tagxedo.com/app.html 有種東西叫「Word Clouds」,就是把一堆文字依照不同的大小.顏色.角度與位置拼湊在一起,讓他變成像一朵雲一般.組合成各種不同的形 ...

  6. 关于java文件扩展名认识

    ☆ 写在前面 一名新手在历经千辛万苦写好Java程序,怀揣激动的心情去编译和执行java程序时,结果出现错误,什么找不到文件,什么不存在,找不到main方法等等.我在这里就文件后扩展名,也叫文件后缀名 ...

  7. x86_64编译JPEG遇到Invalid configuration `x86_64-unknown-linux-gnu'

    把 /usr/share/libtool/config/config.guess 覆盖到相关软件自带的config.guess   把 /usr/share/libtool/config/config ...

  8. 【转】MySQL数据库原理

    原文地址:http://www.cnblogs.com/qiuyi116/p/4349233.html 我们知道,数据是信息的载体——一种我们约定了如何解释的符号.在计算机系统中,最常见的应该是文本数 ...

  9. hdu1874 最短路模板题

    之所以做了第二道模板题还要写是因为发现了一些自己的问题 用的是dij 最简单的松弛 需要注意的地方是松弛的时候 判断dis[i]<dis[w]+tance[w][i]时 还要再判断 vis[i] ...

  10. [读书笔记]项目管理实战:Microsoft Project精髓与方法

    <项目管理实战:Microsoft Project精髓与方法>是Bonnie Biafore 写的一本书.Bonnie Biafore 作为项目管理师(PMP),她有20余年为大中小型客户 ...