${iServerJava6R_FindPathEventArgs_Title}
${iServerJava6R_FindPathEventArgs_Description}
//服务器返回结果,将最佳路径显示在客户端 private void findPathService_ProcessCompleted(object sender, FindPathEventArgs e) { //路径样式 PredefinedLineStyle simpleLineStyle = new PredefinedLineStyle(); simpleLineStyle.Stroke = new SolidColorBrush(Colors.Blue); simpleLineStyle.StrokeThickness = 2; if (e.Result != null) { if (e.Result.PathList != null) { foreach (ServerPath p in e.Result.PathList) { //将要素添加到图层 featuresLayer.Features.Add(new Feature { Geometry = p.Route, Style = simpleLineStyle }); this.length.Text = "路线长度:" + p.Route.Length.ToString(System.Globalization.CultureInfo.InvariantCulture); this.cost.Text = "花费:" + p.Weight.ToString(System.Globalization.CultureInfo.InvariantCulture); } resultPanel.Visibility = Visibility.Visible; } else { MessageBox.Show("此设置下无可用路径"); } } }
void findPathService_ProcessCompleted(object sender, FindPathEventArgs e) { Feature f = e.Result.PathList[0].EdgeFeatures[0]; }