ElementLayer是ArcGIS API for Silverlight/WPF中的一种图层类型,主要用来承载Silverlight/WPF中的UIElement对象(UIElement),使用ElementLayer有一个主要的优点就是:ElementLayer中的元素会随着地图的变化而变化(缩放/平移)(PS:在元素控件没有固定size的情况下),而不用自己去处理这些UIElement的地理坐标。所以可以选择使用ElementLayer来放置我们想要的Windows控件元素。

比如,当点击GraphicsLayer上的某一点时,弹出一个信息展示界面等功能时就可以用到ElementLayer。

可以先看一下官方ArcGIS API for Silverlight中对ElementLayer用法的介绍:http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ElementLayer

主要是通过XAML代码来实现的:

<UserControl x:Class="ArcGISSilverlightSDK.ElementLayer"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:esri="http://schemas.esri.com/arcgis/client/2009">
    <Grid x:Name="LayoutRoot" Background="White">

        <esri:Map x:Name="MyMap">
            <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer" 
                    

Url="http://services.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer"/>

            <esri:ElementLayer>
                <esri:ElementLayer.Children>
                    <!--Clickable button-->
                    <Button x:Name="RedlandsButton" Width="20" Height="20" Content="X" 
                        esri:ElementLayer.Envelope="-117,34,-117,34"
                        VerticalAlignment="Center" 

HorizontalAlignment="Center"
                        Click="RedlandsButton_Click" />

                    <!--Arrow pointing at Copenhagen from the right-->
                    <TextBlock Text="&lt;=" HorizontalAlignment="Right" 
                           FontSize="15" Foreground="Blue" 

FontWeight="Bold"
                           

esri:ElementLayer.Envelope="12.5698,55.6765,12.5698,55.6765" />
                    <!--Arrow pointing at Copenhagen from the left-->
                    <TextBlock Text="=&gt;" HorizontalAlignment="Left" 
                           FontSize="15" Foreground="Blue" 

FontWeight="Bold"
                           

esri:ElementLayer.Envelope="12.5698,55.6765,12.5698,55.6765" />

                    <!-- Red box - No size specified. Envelope guides the size -->
                    <Rectangle Fill="Red" esri:ElementLayer.Envelope="0,0,10,10" />

                    <!--Editable textbox-->
                    <TextBox Width="100" Height="20" esri:ElementLayer.Envelope="40,0,40,0"
                         Text="Editable text" 

HorizontalAlignment="Right" VerticalAlignment="Bottom" />
                </esri:ElementLayer.Children>
            </esri:ElementLayer>

        </esri:Map>

    </Grid>
</UserControl>
View Code

相关文章:

  • 2021-10-18
  • 2022-12-23
  • 2022-12-23
  • 2021-11-08
  • 2021-12-02
猜你喜欢
  • 2022-12-23
  • 2021-06-23
  • 2021-08-11
  • 2021-04-07
  • 2022-12-23
  • 2021-08-02
  • 2021-10-26
相关资源
相似解决方案