${iServer2_PathParam_Title}

${iServer2_PathParam_Description}

        internal static string ToJson(PathParam pathParam)
        {
            if (pathParam == null)
            {
                return null;
            }
            string json = "{";
            List<string> list = new List<string>();

            list.Add(string.Format("\"networkAnalystParam\":{0}", NetworkAnalystParam.ToJson(pathParam.NetworkAnalystParam)));
            list.Add(string.Format("\"hasLeastEdgeCount\":{0}", pathParam.HasLeastEdgeCount));

            json += string.Join(",", list.ToArray());
            json += "}";

            return json;
        }
        //最佳路径分析
        private void PathAnalyst_Click(object sender, RoutedEventArgs e)
        {
            //设置权重字段列表
            WeightFieldInfo weightFieldInfo = new WeightFieldInfo { Name = "length", TFWeightField = "SmLength", FTWeightField = "SmLength" };
            List<WeightFieldInfo> list = new List<WeightFieldInfo>();
            list.Add(weightFieldInfo);

            //设置网络分析模型
            NetworkModelSetting networkModelSetting = new NetworkModelSetting
            {
                NetworkDatasetName = "RoadNet",
                NetworkDataSourceName = "changchun",
                Tolerance = 30,
                NodeIDField = "SMNODEID",
                EdgeIDField = "SmID",
                WeightFieldInfos = list,
                TNodeIDField = "SMTNODE",
                FNodeIDField = "SMFNODE",
            };

            //设置网络分析参数
            NetworkAnalystParam networkAnalystParam = new NetworkAnalystParam
            {
                Point2Ds = points,
                IsPathsReturn = true,
                WeightName = "length",
            };

            //设置路径分析参数
            PathParam pathParam = new PathParam
            {
                NetworkAnalystParam = networkAnalystParam
            };

            //设置最佳路径分析参数
            FindPathParameters parameters = new FindPathParameters
            {
                MapName = "Changchun",
                NetworkSetting = networkModelSetting,
                PathParam = pathParam
            };

            //与服务器交换
            FindPathService service = new FindPathService("http://localhost:7080/demo");
            service.ProcessAsync(parameters);
            service.Failed += new EventHandler<ServiceFailedEventArgs>(service_Failed);
            service.ProcessCompleted += new EventHandler<NetworkAnalystEventArgs>(service_ProcessCompleted);
        }