现在的位置: 首页 > 综合 > 正文

切换地图图层

2012年03月02日 ⁄ 综合 ⁄ 共 1562字 ⁄ 字号 评论关闭
View Code

 1 <esri:Map x:Name="MyMap" WrapAround="True" Loaded="MyMap_Loaded">
2 <esri:ArcGISTiledMapServiceLayer ID="AGOLayer" Visible="True"
3 Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
4 </esri:Map>
5
6 <Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="10" >
7 <Rectangle Fill="#77919191" Stroke="Gray" RadiusX="10" RadiusY="10" Margin="0" >
8 <Rectangle.Effect>
9 <DropShadowEffect/>
10 </Rectangle.Effect>
11 </Rectangle>
12 <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Background="Transparent" Margin="10">
13 <RadioButton x:Name="StreetsRadioButton"
14 Tag="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
15 IsChecked="true" Margin="5,0,0,0" Foreground="White"
16 GroupName="Layers" Content="Streets" Click="RadioButton_Click"/>
17 <RadioButton x:Name="TopoRadioButton"
18 Tag="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"
19 Margin="5,0,0,0" Foreground="White"
20 GroupName="Layers" Content="Topo" Click="RadioButton_Click"/>
21 <RadioButton x:Name="ImageryRadioButton"
22 Tag="http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"
23 Margin="5,0,0,0" Foreground="White"
24 GroupName="Layers" Content="Imagery" Click="RadioButton_Click"/>
25 </StackPanel>
26
27 </Grid>
28
29 private void RadioButton_Click(object sender, RoutedEventArgs e)
30 {
31 ArcGISTiledMapServiceLayer arcgisLayer = MyMap.Layers["AGOLayer"] as ArcGISTiledMapServiceLayer;
32 arcgisLayer.Url = ((RadioButton)sender).Tag as string;
33 }
34
35 private void MyMap_Loaded(object sender, RoutedEventArgs e)
36 {
37 MyMap.Focus();
38 }

抱歉!评论已关闭.