Silverlight 结合ArcGis 在地图上画线

原文 http://www.dotblogs.com.tw/justforgood/archive/2012/05/10/72085.aspx

先来看看完成后的画面,我从桃园画到高雄,再由高雄画到香港

Silverlight 结合ArcGis 在地图上画线_第1张图片

 

Silverlight这边如下

 

我们在画面上新增一个线型的Symbol

Silverlight 结合ArcGis 在地图上画线_第2张图片

 

程式码内如下

 

01 'Create by maggiore 2012/5/10 for dotblog
02     Public Sub New()
03  
04         InitializeComponent()
05  
06         Dim g_graphic_airport As GraphicsLayer '宣告一个图层物件变数
07  
08         '将画面上的图层丢给图层物件
09         g_graphic_airport = TryCast(MyMap.Layers( "graphic_airport" ), GraphicsLayer)
10  
11         Dim pGraphic As Graphic = New Graphic() 'Imports ESRI.ArcGIS.Client
12  
13         Dim Point As New MapPoint 'Imports ESRI.ArcGIS.Client.Geometry
14  
15         '桃园机场经纬度
16         Point.X = 121.23 '经度
17         Point.Y = 25.08 '纬度
18  
19         Dim Point2 As New MapPoint 'Imports ESRI.ArcGIS.Client.Geometry
20  
21         '高雄经纬度
22         Point2.X = 120.35 '经度
23         Point2.Y = 22.58 '纬度
24         
25         Dim Point3 As New MapPoint 'Imports ESRI.ArcGIS.Client.Geometry
26  
27         '香港经纬度
28         Point3.X = 113.92 '经度
29         Point3.Y = 22.31 '纬度
30  
31  
32         Dim pPolyline1 As ESRI.ArcGIS.Client.Geometry.Polyline = New ESRI.ArcGIS.Client.Geometry.Polyline()
33  
34         Dim pPointCollection1 As ESRI.ArcGIS.Client.Geometry.PointCollection = New ESRI.ArcGIS.Client.Geometry.PointCollection()
35  
36         pPointCollection1.Add(Point)
37         pPointCollection1.Add(Point2)
38         pPointCollection1.Add(Point3)
39  
40         pPolyline1.Paths.Add(pPointCollection1)
41  
42         pGraphic.Geometry = pPolyline1
43  
44         pGraphic.Symbol = Line_black
45  
46         g_graphic_airport.Graphics.Add(pGra​​phic)
47  
48     End Sub

 

上述三个地点,小马在专案中是用for 回圈去捞资料库的资料,上面是为了让读者清楚简单了解,

才一个点一个点的示范喔!。

到这,读者应该可以明白之前小马是怎么耍白痴学食神在画面画个"赢"字了吧!(点或线皆可)

你可能感兴趣的:(silverlight)