微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ArcGIS API for Silverlight 在地图上画圆

        //Silverlight前台添加 Graphicslayer 图层
        <esri:Graphicslayer ID="MyGraphicslayer"  Opacity="0.5"/> 
        /// <summary>
        /// ArcGIS API for Silverlight 画圆
        /// </summary>
        /// <param name="radius">圆的半径</param>
        /// <param name="centerP">圆心的点</param>
        /// <param name="graphicslayer">Graphicslayer图层</param>
        public void GetEllipseGraphic(double radius,MapPoint centerP,Graphicslayer graphicslayer)
        {
            Graphic result = new Graphic();
            List<MapPoint> points = new List<MapPoint>();
            for (double i = 0; i <= 360; i++)
            {
                points.Add(new MapPoint((centerP.X - Math.Cos(Math.PI * i / 180.0) * radius),(centerP.Y - Math.Sin(Math.PI * i / 180.0) * radius)));
            }
            ESRI.ArcGIS.Client.Geometry.PointCollection pCollection = new ESRI.ArcGIS.Client.Geometry.PointCollection(points);
            ESRI.ArcGIS.Client.Geometry.polygon g = new ESRI.ArcGIS.Client.Geometry.polygon();
            g.Rings.Add(pCollection);
            result.Geometry = g;
            SimpleFillSymbol sfs = new SimpleFillSymbol();
            sfs.BorderBrush = new SolidColorBrush(Colors.Red);
            sfs.BorderThickness = 2;
            sfs.Fill = new SolidColorBrush(Colors.DarkGray);
            result.Symbol = sfs;
            graphicslayer.Graphics.Add(result);
        }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐