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 ...
随机推荐
- golang,liteide设置 windows7(64)
1.安转go的环境,exe安装包 2.下载liteide27.2.1 3.打开liteide开始开发,在里面添加gopath,无法读取windows里面的gopath设置,不知道什么原因,以管理员运行 ...
- gzip压缩及测试方法【转载】
Nginx开启Gzip压缩大幅提高页面加载速度 http://www.veryhuo.com/a/view/51706.html 刚刚给博客加了一个500px相册插件,lightbox引入了很多js文 ...
- Ansible Tower
# Generated by iptables-save v1.4.7 on Tue Aug 23 04:58:34 2016 *filter :INPUT ACCEPT [0:0] :FORWARD ...
- 【转】excel 末尾是0 恢复数据方法
今天从数据库里面查了点数据,用plsql导出为csv数据后用excel打开后就出问题了,显示的问题,excel中会遇到一列中因为数字太长,结果变成了用科学计数法来表示,而这种损失不可逆的,及时改变其格 ...
- Nginx快速入门菜鸟笔记
Nginx快速入门-菜鸟笔记 1.编译安装nginx 编译安装nginx 必须先安装pcre库. (1)uname -a 确定环境 Linux localhost.localdomain 2.6. ...
- iOS10 权限配置
升到iOS10之后,需要设置权限的有: 麦克风权限:Privacy - Microphone Usage Description 是否允许此App使用你的麦克风? 相机权限: Privacy - Ca ...
- float、定位、inline-block、兼容性需注意的特性总结
inline-block 特性: 1.块在一排显示 2.内联支持宽高 3.默认内容撑开宽度 4.标签之间的换行间隙被解析(问题)[相当字体大小的一半] 5.ie6 ie7不支持块属性标签的inline ...
- modelsim操作流程
1.File->Change Directory2.File->New->Library 在弹出的对话框中选择 a new library and a logical mapping ...
- Linux的一些常用快捷键和基本命令
*******1.在Linux中,只有/能够当盘符,/首先要分配给系统盘所在分区*******2.swap交换分区,相当于Windows下的虚拟内存,用来模拟内存,当内存不够用时,就会使用交换分区.其 ...
- NHibernate Demo 和 效率测试
本文关于NHibernate的Demo和效率测试,希望对大家有用. 1.先去官网下载Nhibernate 2.放入到项目中并建立Helper类 private static ISession _Ses ...