-1

我想在地图上绘制折线。我找不到任何示例或文档。有人可以帮忙吗?

// Initialize map:
gMap.MapProvider = GMap.NET.MapProviders.OpenStreetMapProvider.Instance;
GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerAndCache;
gMap.Position = new PointLatLng(53.44827,14.49152);

//somepoints
//point1 = new PointLatLng(53.44827,14.49152);
//point2 = new PointLatLng(53.44827,14.49152);
//point3 = new PointLatLng(53.44827,14.49152);

//draw polyline
4

1 回答 1

0

1)Create two lat,long points i.e. startLat,startLong & endLat,endLong

2)then use following code

Dim polygonPoints1 As List(Of PointLatLng) = New List(Of PointLatLng)
polygonPoints1.Add(New PointLatLng(startLat, startLong ))
polygonPoints1.Add(New PointLatLng(endLat, endLong))

r = New GMap.NET.WindowsForms.GMapRoute(polygonPoints1, "MyRoute")

r.Stroke.DashStyle = Drawing2D.DashStyle.Dash
Dim routesOverlay As GMapOverlay = New GMapOverlay("routes")
routesOverlay.Routes.Add(r)
Me.myMap.Overlays.Add(routesOverlay)

Hope this resolves your issue.

于 2015-07-17T10:10:07.253 回答