ArcGIS api fo silverlight学习二(silverlight加载GraphicsLayer)
上一节学习了silverlight加载GeoServer发布的WMS地图,这一节学习一下加载GraphicsLayer
一、加载.png或jpg文件图标
1、在MainPage.xaml中添加资源配置
<Grid.Resources>
<esri:SimpleMarkerSymbol x:Key="RedMarkerSymbol" Color="Red" Size="12" Style="Circle" />
<esri:SimpleMarkerSymbol x:Key="BlackMarkerSymbol" Color="Black" Size="14" Style="Diamond" />
<esri:PictureMarkerSymbol x:Key="GlobePictureSymbol" OffsetX="8" OffsetY="8"
Source="images/ttt.png" />
<esri:SimpleLineSymbol x:Key="DefaultLineSymbol" Color="Green" Style="DashDot" Width="4" />
<esri:SimpleFillSymbol x:Key="DefaultFillSymbol" Fill="Green" BorderBrush="Blue"
BorderThickness="3" />
</Grid.Resources>
2、在cs文件中添加实现函数(以添加图片图标为例,添加其它请参考api官网)
private static ESRI.ArcGIS.Client.Projection.WebMercator mercator =
new ESRI.ArcGIS.Client.Projection.WebMercator();
private void AddPictureMarkerAndTextGraphics()
{
GraphicsLayer g = new ESRI.ArcGIS.Client.GraphicsLayer();
for (int i = 0; i < 2; i++)
{
Graphic graphic = new Graphic()
{
Geometry = mercator.FromGeographic(new MapPoint(107.2 + i, 38.1 + i)),
Symbol = LayoutRoot.Resources["GlobePictureSymbol"] as Symbol
};
g.Graphics.Add(graphic);
}
this.myMap.Layers.Add(g);
}
添加System.Runtime.Serialization引用
3、调用AddPictureMarkerAndTextGraphics()

二、加载Graphic点并高亮、闪烁显示
1、实现鼠标触发高亮显示
1.1 在MainPage.xaml中添加资源配置
<esri:MarkerSymbol x:Key="StrobeMarkerSymbol">
<esri:MarkerSymbol.ControlTemplate>
<ControlTemplate>
<Canvas>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="MouseOver">
<Storyboard RepeatBehavior="ForEver">
<DoubleAnimation BeginTime="0"
Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)"
From="1" To="10" Duration="00:00:01" />
<DoubleAnimation BeginTime="0"
Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)"
From="1" To="10" Duration="00:00:01" />
<DoubleAnimation BeginTime="0"
Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.Opacity)"
From="1" To="0" Duration="00:00:01" />
</Storyboard>
</VisualState>
<!--If normal state is not specified, the animation will
keep going until a mouse out. Keep it empty to transition back to original symbol. -->
<VisualState x:Name="Normal" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<!--Strobe ellipse-->
<!--Note that IsHitTestVisible="False" on the strobe symbol,
so only the static ellipse will trigger mouse over/mouse out-->
<Ellipse Height="10" Width="10" Canvas.Left="-5" Canvas.Top="-5"
RenderTransformOrigin="0.5,0.5" x:Name="ellipse"
IsHitTestVisible="False"
>
<Ellipse.RenderTransform>
<ScaleTransform />
</Ellipse.RenderTransform>
<Ellipse.Fill>
<RadialGradientBrush>
<GradientStop Color="#00FF0000" />
<GradientStop Color="#FFFF0000" Offset="0.25"/>
<GradientStop Color="#00FF0000" Offset="0.5"/>
<GradientStop Color="#FFFF0000" Offset="0.75"/>
<GradientStop Color="#00FF0000" Offset="1"/>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<!--Static symbol on top-->
<Ellipse Height="10" Width="10" Canvas.Left="-5" Canvas.Top="-5"
Fill="#FFFF0000" x:Name="ellipse1"/>
</Canvas>
</ControlTemplate>
</esri:MarkerSymbol.ControlTemplate>
</esri:MarkerSymbol>
1.2 后台代码
Graphic g = new Graphic()
{
Geometry = mercator.FromGeographic(new MapPoint(107.2 , 36.1)),
Symbol = LayoutRoot.Resources["StrobeMarkerSymbol"] as Symbol
};
GraphicsLayer glayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
glayer.Graphics.Add(g);
this.myMap.Layers.Add(g);
2、实现直接高亮、闪烁显示
2.1 修改<VisualState x:Name="MouseOver">为: <VisualState x:Name="Normal">
2.1注释<VisualState x:Name="Normal" />为<!--<VisualState x:Name="Normal" />-->
ArcGIS api fo silverlight学习二(silverlight加载GraphicsLayer)的更多相关文章
- ArcGIS API for JavaScript 4.4 版本加载谷歌地图
ArcGIS API for JavaScript 4.X 版本升级后,API发生了很大的变化. 其中就支持了WebEarth展示,主要是通过 esri/views/SceneView 实现的. 在新 ...
- ArcGIS api fo silverlight学习一(silverlight加载GeoServer发布的WMS地图)
最好的学习资料ArcGIS api fo silverlight官网:http://help.arcgis.com/en/webapi/silverlight/samples/start.htm 一. ...
- ArcGIS api fo silverlight学习三(利用ElementLayer实现鼠标悬浮弹出自定义窗体)
接着上一节继续学习,本节主要是利用ElementLayer实现鼠标悬浮弹出自定义窗体 参考博文:http://www.cnblogs.com/luxiaoxun/p/3322218.html 一.新建 ...
- ArcGIS API for Silverlight 调用GP服务加载等值线图层
原文:ArcGIS API for Silverlight 调用GP服务加载等值线图层 第二篇.Silverlight客户端调用GP服务 利用ArcGIS API for Silverlight实现G ...
- arcgis api for javascript 学习(七) 调用发布地图信息,并将地图属性信息输出到Excel表格---进阶版
我们在arcgis api for javascript 学习(三)已经学习到了关于调用地图信息进行属性输出的问题,不过通过代码我们实现后会发现还是有一些小瑕疵的,比如我们只能单个数据属性的输出,如果 ...
- 深入java虚拟机学习 -- 类的加载机制(续)
昨晚写 深入java虚拟机学习 -- 类的加载机制 都到1点半了,由于第二天还要工作,没有将上篇文章中的demo讲解写出来,今天抽时间补上昨晚的例子讲解. 这里我先把昨天的两份代码贴过来,重新看下: ...
- 轻松搞定 easyui datagrid 二次加载的问题(转)
对于使用url方式的初学者,经常碰到重复请求的问题,这个问题的根源是因为一旦设置了url参数,Datagrid组件在实例化的时候就会做请求,如何避免二次加载这样问题呢,个人觉得注意以下两点基本就可以防 ...
- 【Java Web开发学习】Spring加载外部properties配置文件
[Java Web开发学习]Spring加载外部properties配置文件 转载:https://www.cnblogs.com/yangchongxing/p/9136505.html 1.声明属 ...
- ArcGis API for JavaScript学习——加载地图
ArcGis API for JavaScript开发笔记——加载地图 在这个例子中使用的离线部署的API(请参见 http://note.youdao.com/noteshare?id=f42865 ...
随机推荐
- mybatis 中sql语句传递多个参数
Available parameters are [2, 1, 0, param1, param2, param3] <select id="loginByTeacher" ...
- C#调试心经(1)(转)
我们在做程序开发时,难免会遇到错误异常.如何快速地找到出错的地方.分析错误的原因以及找到解决问题的方案,是许多初级程序员困扰的问题,这也正是经验的宝贵之处.下面我将简单介绍在Visual Studio ...
- Oracle EM 的访问方式由HTTPS改为HTTP
打开命令提示符,依次运行以下命令: set ORACLE_HOSTNAME=%COMPUTERNAME% set ORACLE_UNQNAME=orcl rem 指向 dbhome_1\oc4j\j2 ...
- C# 读取和配置IniFile
自定义IniFile操作类 using System; using System.Collections.Generic; using System.Linq; using System.Text; ...
- SparkSQL(源码阅读三)
额,没忍住,想完全了解sparksql,毕竟一直在用嘛,想一次性搞清楚它,所以今天再多看点好了~ 曾几何时,有一个叫做shark的东西,它改了hive的源码...突然有一天,spark Sql突然出现 ...
- php 对象中连贯执行方法
连贯操作的重点是返回当前对象,以便可以继续执行 class Ceshi{ public $str = ''; public function f1($a){ $this->str .= $a; ...
- Linux添加主机路由
Linux添加主机路由:参考:http://zhidao.baidu.com/link?url=50qQ232ZiJqq1iftHvBdPzZh-JlQGi1DZ8wvF-j9dvQYsKiNgc-6 ...
- sql 中 left join 的使用
left join .是以左表为基础,查询右表的值.如果在右表中没用没有数据,则为NULL. 这里有三张表. 线路bs_line:id,name(id主键) 线路段bs_seg:id,l_id,nam ...
- 廖雪峰JavaScript学习摘录
一. 1.语法基础: (1)特别注意相等运算符==.JavaScript在设计时,有两种比较运算符: 第一种是==比较,它会自动转换数据类型再比较,很多时候,会得到非常诡异的结果: 第二种是===比较 ...
- Cacti监控Centos抓包unreachable - admin prohibited
:: 抓包发现总是有这个出现,而且是跟在GetRequest后面. 打开iptables配置: 最开始网上找的配置语句是这个, -A INPUT -p udp -m udp --sport -j AC ...