我正在使用Gmap.Net.WindowsForm
,但是GMapRoute
为null,并且没有进行图形布线,GMapRoute
给出了NullReference错误。
GMapOverlay routeshow = new GMapOverlay("yeni rotasyon");
end = new PointLatLng(37.790658, 28.014990);
first = new PointLatLng(37.790658, 29.014990);
//Rotasyon Belirleme
GDirections direction;
var route = GMapProviders.GoogleMap.GetDirections(out direction, first, end, false, false, false, false, false);
GMapRoute routes = new GMapRoute(direction.Route, "routes"); // error happens here
routeshow.Routes.Add(routes);
gMapControl1.Overlays.Add(routeshow);
gMapControl1.Zoom = gMapControl1.Zoom + 1;
gMapControl1.Zoom = gMapControl1.Zoom - 1;
答案 0 :(得分:0)
行0
需要指向其路线的点,这些点的类型为tank + 1
。解决该问题将起作用。
GMapRoute routes = new GMapRoute(points, "routes")
每个代码都是这样的。
PointLatLng