silverlight   发布时间:2022-05-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了silverlight调用Geometry服务实现缓冲区大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

Geometry服务发布: 前端代码: <UserControl x:Class="SilverlightApplication5.MainPage" xmlns="http://scheR_661_11845@as.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://scheR_661_11845@as.microsoft.com/winfx/2006/x
@H_772_14@
@H_772_14@

Geometry服务发布:

silverlight调用Geometry服务实现缓冲区

前端代码

<UserControl x:Class="SilverlightApplication5.MainPage"
    xmlns="http://scheR_661_11845@as.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://scheR_661_11845@as.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://scheR_661_11845@as.microsoft.com/expression/blend/2008"
                 xmlns:esri="http://scheR_661_11845@as.esri.com/arcgis/client/2009"
    xmlns:mc="http://scheR_661_11845@as.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" BACkground="White">

        <Grid.resources>
            <esri:PictuREMARKerSymbol x:Key="DefaultClickSymbol" OffsetX="11" OffsetY="39" source="/car-red-16x16.png" />
            <esri:SimpleFillSymbol x:Key="DefaultBufferSymbol" Fill="#660000FF" BorderBrush="Blue" BorderThickness="2"  />
        </Grid.resources>

        <esri:Map Name="Mymap" MouseClick="Buffer_MouseClick"  Extent="-122.5009,37.741,-122.3721,37.8089">
            <esri:ArcGISTiledMapserviceLayer ID="ESRIMap" Url="http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/>
            <esri:GraphicsLayer ID="MyGraphicsLayer">
                
            </esri:GraphicsLayer>
        </esri:Map>

        <Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,10,0" >
            <Rectangle Fill="#77919191" stroke="Gray"  RadiusX="10" RadiusY="10" Margin="0,5" >
                <Rectangle.Effect>
                    <DropShadowEffect/>
                </Rectangle.Effect>
            </Rectangle>
            <Rectangle Fill="#FFFFFFFF" stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="10,15" />
            <TextBlock x:Name="InformationtextBlock" Text="Click on map to set a LOCATIOn. A buffer of 5 miles will be displayed."
                        Width="200" TextAlignment="Left" Margin="30,20,25,30" textwrapping="Wrap" />
        </Grid>
    </Grid>
</UserControl>


 

后台代码

private void ArcGISDynamicMapserviceLayer_InitializationFailed(object sender,EventArgs E)
        {
            Layer layer = sender as Layer;
            messageBox.Show(layer.InitializationFailure.messagE);
        }

        private void Buffer_MouseClick(object sender,Map.MouseEventArgs E)
        {
            GraphicsLayer graphicsLayer = Mymap.Layers["MyGraphicsLayer"] as GraphicsLayer;
            graphicsLayer.ClearGraphics();

            e.MapPoint.SpatialReference = Mymap.SpatialReference;
            Graphic graphic = new Graphic()
            {
                Geometry = e.MapPoint,Symbol = LayoutRoot.resources["DefaultClickSymbol"] as Symbol
            };
            graphic.SetZIndex(1);
            graphicsLayer.Graphics.Add(graphic);

            Geometryservice geometryservice = new Geometryservice("http://localhost/arcgis/rest/services/Geometry/GeometryServer");
            geometryservice.bufferCompleted += new EventHandler<GraphicsEventArgs>(geometryservice_BufferCompleted);
            geometryservice.Failed += new EventHandler<TaskFailedEventArgs>(geometryservice_Failed);

            BufferParameters bufferParams = new BufferParameters() { 
                Unit=LinearUnit.StatuteMile,BufferSpatialReference=new ESRI.ArcGIs.CLIENt.Geometry.SpatialReference(4326),OutSpatialReference=Mymap.SpatialReference
            };
            bufferParams.Features.Add(graphic);
            bufferParams.Distances.Add(1);

            geometryservice.bufferAsync(bufferParams);
        }

        void geometryservice_Failed(object sender,TaskFailedEventArgs E)
        {
            messageBox.Show("Geometry serviceException error:"+e.Error);
        }

        void geometryservice_BufferCompleted(object sender,GraphicsEventArgs E)
        {
            IList<Graphic> result = e.Results;
            GraphicsLayer graphicsLayer = Mymap.Layers["MyGraphicsLayer"] as GraphicsLayer;
            foreach (Graphic graphic in result)
            {
                graphic.Symbol = LayoutRoot.resources["DefaultBufferSymbol"] as Symbol;
                graphicsLayer.Graphics.Add(graphic);
            }
        }


 

结果:

silverlight调用Geometry服务实现缓冲区

@H_772_14@

大佬总结

以上是大佬教程为你收集整理的silverlight调用Geometry服务实现缓冲区全部内容,希望文章能够帮你解决silverlight调用Geometry服务实现缓冲区所遇到的程序开发问题。

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

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:geometrysilverlight实现服务缓冲区调用
猜你在找的silverlight相关文章
其他相关热搜词更多
phpJavaPython程序员load如何string使用参数jquery开发安装listlinuxiosandroid工具javascriptcap