您的位置:首页 > 其它

如何给等值线做标注Arcgis for sl

2013-08-15 17:30 495 查看
这里只给出标注部分的代码:

 

foreach (ShapeFileRecord record in shapeFileReader.Records)

                {

                    Graphic graphic = record.ToGraphic();

                    if (graphic != null)

                    {

                        int index = 0;

                        for (int i = 0; i < Config.level.Split(',').Length; i++)

                        {

                            if (graphic.Attributes["mark"].ToString() == Config.level.Split(',')[i])

                            {

                                index = i;

                                break;

                            }

                        }

                        graphic.Symbol = new SimpleLineSymbol()

                        {

                            Color = new SolidColorBrush(colors[0]),

                            Style = SimpleLineSymbol.LineStyle.Solid,

                            Width = 2

                        };

                        #region 等值线添加标注

                        ESRI.ArcGIS.Client.Geometry.Polyline pLine = graphic.Geometry as ESRI.ArcGIS.Client.Geometry.Polyline;

                        ESRI.ArcGIS.Client.Geometry.PointCollection pCollection = pLine.Paths[0];

                        //添加文字信息  

                        TextSymbol textSymbol = new TextSymbol()

                        {

                            FontFamily = new System.Windows.Media.FontFamily("Microsoft YaHei"),

                            Foreground = new System.Windows.Media.SolidColorBrush(Color.FromArgb(255, 0, 0, 255)),

                            FontSize = 12,

                            Text = Config.level.Split(',')[index]

                        };

                        ESRI.ArcGIS.Client.Geometry.MapPoint mpStart = pCollection[0];

                        Graphic graphicTextStart = new Graphic()

                        {

                            Geometry = mpStart,

                            Symbol = textSymbol

                        };

                        DZXMBiaoZhuLayer.Graphics.Add(graphicTextStart);

                        ESRI.ArcGIS.Client.Geometry.MapPoint mpEnd = pCollection[pCollection.Count - 1];

                        Graphic graphicTextEnd = new Graphic()

                        {

                            Geometry = mpEnd,

                            Symbol = textSymbol

                        };

                        DZXMBiaoZhuLayer.Graphics.Add(graphicTextEnd);

                        #endregion

                    }

                    DZXMLayer.Graphics.Add(graphic);

                }

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐