Feature Service(二)Silverlight API在线编辑

Feature Service(二)Silverlight API在线编辑,第1张

概述通过FeatureService+Silverlight API实现在线编辑     上篇文章中已经介绍了Feature Service的一些特性和基本的发布方式,那么在这篇文章中重点介绍一下如何使用feature service去实现在线编辑。那么有两种方式访问Feature Service:      1、通过ArcGISDeskTop的方式。      2、通过ArcGISServer AP

通过FeatureService+Silverlight API实现在线编辑
   
上篇文章中已经介绍了Feature Service的一些特性和基本的发布方式,那么在这篇文章中重点介绍一下如何使用feature service去实现在线编辑。那么有两种方式访问Feature Service
     1
、通过ArcGISDesktop的方式。
     2
、通过ArcGISServer API的方式,现在已经有两种API可以访问Feature Service,它们是JavaScript. APISilverlight API,今天我重点介绍一下如何通过SilverlightAPI去访问和编辑FeatureService
如何实现:
    开发环境:
   
开发FeatureService需要ArcGISServer 10VisualStadio 2010英文版(目前中文版不支持Silverlight4Tools)、Silverlight Developer KitArcGIS Server API for Silverlight2.0_RC(正式版还没有发布)。
   
SilverlightAPI 2.0中,提供了EditWidget控件,如果对界面定制要求不高的话,可以直接使用该控件。
   
下面是实现的代码:
<UserControl x:Class=”Feature_Service.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:esri=”http://schemas.esri.com/arcgis/clIEnt/2009″>
    <GrID x:name=”LayoutRoot” >
        <!–
地图控件–>
        <esri:Map x:name=”MyMap”Extent=”-122.655,37.666,-122.181,37.897″>
<!–
比例尺控件–>
           <esri:Map.Template>
               <ControlTemplate>
                   <GrID Background=”{TemplateBinding Background}”>
                       <GrID x:name=”RootElement” WIDth=”auto” Height=”auto” />
                       <Rectangle x:name=”ZoomBox” Fill=”#55FFFFFF” stroke=”Green”strokeThickness=”2″ Visibility=”Collapsed” />
                       <StackPanel rIEntation=”Vertical” HorizontalAlignment=”left”VerticalAlignment=”Bottom”>
                           <esri:Scalebar x:name=”MyScalebar” margin=”5″ MapUnit=”Decimaldegrees”Foreground=”Black”
                                          displayUnit=”Miles” Map=”{Binding Elementname=MyMap}” />
                           <TextBlock Text=”{Binding Elementname=MyMap,Path=Layers.[0].copyrightText}”margin=”5″ />
                       </StackPanel>
                   </GrID>
               </ControlTemplate>
           </esri:Map.Template>
           <esri:ArcGISTiledMapServiceLayer ID=”MyLayer”
               Url=”http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer”/>
            <!–
点图层–>
           <esri:FeatureLayer ID=”Point”Url=”http://localhost/ArcGIS/rest/services/FeatureService/FeatureServer/0″autoSave=”False”  utFIElds=”*” Mode=”ondemand”></esri:FeatureLayer>
            <!–
线图层–>
           <esri:FeatureLayer ID=”line”Url=”http://localhost/ArcGIS/rest/services/FeatureService/FeatureServer/1″autoSave=”False”  utFIElds=”*” Mode=”ondemand”></esri:FeatureLayer>
            <!–
面图层–>
           <esri:FeatureLayer ID=”polygon”Url=”http://localhost/ArcGIS/rest/services/FeatureService/FeatureServer/2″autoSave=”False”  utFIElds=”*”Mode=”ondemand”></esri:FeatureLayer>
        </esri:Map> 
        <StackPanel x:name=”EditorToolStrip” margin=”0,5,0″ >
            <borderBackground=”#FF84AD62″ borderThickness=”1″ CornerRadius=”5″
                      HorizontalAlignment=”Right”  VerticalAlignment=”top”
                       padding=”5″borderBrush=”Black”>
               <border.Effect>
                   <DropShadowEffect color=”Black” Direction=”-45″ BlurRadius=”20″ pacity=”.75″/>
               </border.Effect>
               <StackPanel rIEntation=”Vertical” HorizontalAlignment=”Right”margin=”0,0″    VerticalAlignment=”top” >
                   <esri:EditorWidget Map=”{Binding Elementname=MyMap}”
                                     WIDth=”300″
                                     LayerIDs=”Point,line,polygon”
                                     autoSelect=”False”                                  GeometryServiceUrl=”http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer”
                                     ShowAttributesOnAdd=”True”  />
               </StackPanel>
           </border>
        </StackPanel>
    </GrID>
</UserControl>
   
其中的点、线、面图层是在本机发布的Feature Service
   
下面是运行后的结果:

下面用ArcMap打开这两个图层,看看数据是否已经被编辑了。

在后面的文章中,我会介绍如何定制 FeatureService 的开发。 总结

以上是内存溢出为你收集整理的Feature Service(二)Silverlight API在线编辑全部内容,希望文章能够帮你解决Feature Service(二)Silverlight API在线编辑所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/web/1016152.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存