${IS6_RouteEventArgs_Title}
${IS6_RouteEventArgs_Description}
private void OnProcessCompleted(RouteEventArgs args) { if (ProcessCompleted != null) { Application.Current.RootVisual.Dispatcher.BeginInvoke(ProcessCompleted, new object[] { this, args }); } }
private void request_Completed(object sender, RequestEventArgs e) { JsonObject jsonObject = (JsonObject)JsonObject.Parse(e.Result); RouteResult result = RouteResult.FromJson(jsonObject); LastResult = result; RouteEventArgs args = new RouteEventArgs(result, e.Result, e.UserState); OnProcessCompleted(args); }
private void service_ProcessCompleted(object sender, RouteEventArgs e) { //预定义线样式 PredefinedLineStyle style = new PredefinedLineStyle { Stroke = new SolidColorBrush(Colors.Red), StrokeThickness = 3 }; //对结果进行判断,增强程序健壮性 if (e.Result == null) { MessageBox.Show("查询无结果"); return; } if (e.Result.NodePositions == null) { MessageBox.Show("查询无结果"); return; } if (e.Result.NodePositions.Count == 0) { MessageBox.Show("查询无结果"); return; } GeoLine line = new GeoLine(); line.Parts.Add(e.Result.NodePositions); //将feature 添加到图层中 Feature feature = new Feature { Geometry = line, Style = style }; featuresLayer.AddFeature(feature); }