${iServer2_FindTSPathParameters_Title}
${iServer2_FindTSPathParameters_Description}
/// <summary>${iServer2_FindTSPPathService_method_ProcessAsync_D}</summary> /// <param name="parameters">${iServer2_FindTSPPathService_method_ProcessAsync_param_parameters}</param> /// <param name="state">${iServer2_FindTSPPathService_method_ProcessAsync_param_state}</param> public void ProcessAsync(FindTSPPathParameters parameters, object state) { if (parameters == null) { //TODO:资源 //throw new ArgumentNullException("NetworkAnalystParameters is Null"); throw new ArgumentNullException(SuperMap.Web.iServerJava2.Resources.ExceptionStrings.ArgumentIsNull); } if (string.IsNullOrEmpty(this.Url)) { //TODO:资源 // throw new InvalidOperationException("Url is not set"); throw new InvalidOperationException(SuperMap.Web.iServerJava2.Resources.ExceptionStrings.InvalidUrl); } if (!base.Url.EndsWith("/")) { base.Url += '/'; } base.SubmitRequest(base.Url + "commonhandler?", GetParameters(parameters), new EventHandler<RequestEventArgs>(request_Completed), state, false); }
private System.Collections.Generic.Dictionary<string, string> GetParameters(FindTSPPathParameters parameters) { Dictionary<string, string> dictionary = new Dictionary<string, string>(); string method = "FindTSPPath"; dictionary.Add("method", method); dictionary.Add("mapName", parameters.MapName); Dictionary<string, string> dict = new Dictionary<string, string>(); dict.Add("mapName", parameters.MapName); dict.Add("networkSetting", NetworkModelSetting.ToJson(parameters.NetworkSetting)); dict.Add("tspPathParam", TSPPathParam.ToJson(parameters.TSPPathParam)); dictionary.Add("params", Bridge.CreateParams(method, dict)); return dictionary; }
/// <summary>${iServer2_FindTSPPathService_method_ProcessAsync_D}</summary> /// <overloads>${iServer2_FindTSPPathService_method_ProcessAsync_overloads_D}</overloads> public void ProcessAsync(FindTSPPathParameters parameters) { ProcessAsync(parameters, null); }
private void PathAnalyst_Click(object sender, RoutedEventArgs e) { TSPPathParam pathParam = new TSPPathParam(); //设置权重字段列表 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 = 300, NodeIDField = "SMNODEID", EdgeIDField = "SmID", WeightFieldInfos = list, TNodeIDField = "SMTNODE", FNodeIDField = "SMFNODE", }; //设置网络分析参数 NetworkAnalystParam networkAnalystParam = new NetworkAnalystParam { Point2Ds = points, IsPathsReturn = true, WeightName = "length", }; //设置旅行商参数,判断是否指定终点 if (terminal.IsChecked == true) { pathParam = new TSPPathParam { NetworkAnalystParam = networkAnalystParam, IsEndNodeAssigned = true }; } else { pathParam = new TSPPathParam { NetworkAnalystParam = networkAnalystParam, }; } //设置旅行商分析参数 FindTSPPathParameters parameters = new FindTSPPathParameters { MapName = "Changchun", NetworkSetting = networkModelSetting, TSPPathParam = pathParam }; //与服务器交换 FindTSPPathService service = new FindTSPPathService("http://localhost:7080/demo"); service.ProcessAsync(parameters); service.Failed += new EventHandler<ServiceFailedEventArgs>(service_Failed); service.ProcessCompleted += new EventHandler<NetworkAnalystEventArgs>(service_ProcessCompleted); }