您的位置:首页 > 移动开发

ArcGIS Web Mapping for Silverlight开发入门之9:属性查询、定位、标注

2010-12-09 13:19 609 查看
该文是博文http://blog.csdn.net/FlexMapServer/archive/2010/12/09/6064900.aspx
,的系列之二,本文是查询POI兴趣点为Point,点击定位,并用图标表示,如下:



查询医院后,点击datagrid中的某行,即某个医院,则定位到地图中,并显示该医院的名称。

托管C#代码如下:

private void QueryDetailsDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
//MessageBox.Show(QueryDetailsDataGrid.SelectedIndex.ToString());
QueryResultData result = QueryDetailsDataGrid.SelectedItem as QueryResultData;
MessageBox.Show(result.SHAPE);
string[] xyPoint = result.SHAPE.Split(new Char[] { ',' });
double x = Convert.ToDouble(xyPoint[0]);
double y = Convert.ToDouble(xyPoint[1]);
ESRI.ArcGIS.Client.Geometry.MapPoint point = new ESRI.ArcGIS.Client.Geometry.MapPoint(x, y);
MyMap.PanTo(point);
GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;

//string[] gpsNMEASentence = gpsNMEASentenceArray[i].Split(',');
Graphic graphic = new Graphic()
{
Geometry = point,
Symbol = GlobePictureSymbol
};
graphicsLayer.Graphics.Add(graphic);
ESRI.ArcGIS.Client.Symbols.TextSymbol textSymbol = new ESRI.ArcGIS.Client.Symbols.TextSymbol()
{
FontFamily = new System.Windows.Media.FontFamily("Arial"),
Foreground = new System.Windows.Media.SolidColorBrush(Colors.Purple),
FontSize = 12,
Text = result.CN_NAME
};
Graphic graphicText = new Graphic()
{
Geometry =point,
Symbol = textSymbol
};
graphicsLayer.Graphics.Add(graphicText);

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