/// <summary> /// 拷贝构造函数。 /// </summary> /// <param name="transferSolutions">TransferSolutions对象。</param> public TransferSolutions(TransferSolutions transferSolutions) { if (transferSolutions == null || transferSolutions.SolutionItems == null) { throw new ArgumentNullException(); } this.DefaultGuide = new TransferGuide(transferSolutions.DefaultGuide); this.SolutionItems = new TransferSolution[transferSolutions.SolutionItems.Length]; for (int i = 0; i < transferSolutions.SolutionItems.Length; i++) { this.SolutionItems[i] = new TransferSolution(transferSolutions.SolutionItems[i]); } }
/// <summary> /// 公交换乘分析 /// Bus Transfer Analysis /// </summary> /// <param name="tactic"></param> public void Analyst(Int32 tacticIndex) { try { if (m_isLoad) { // 实例化一个公交分析参数设置对象,并设置相关参数 // Initialize a TransferAnalystParameter, and set it TransferAnalystParameter parameter = new TransferAnalystParameter(); parameter.SearchMode = TransferSearchMode.ID; parameter.StartStopID = m_startStopID; parameter.EndStopID = m_endStopID; parameter.Tactic = GetTactic(tacticIndex); parameter.WalkingRatio = 10; parameter.SolutionCount = 5; // 进行公交换乘分析 // Traffic transfer analysis m_solutions = m_transferAnalyst.FindTransferSolutions(parameter); // 解析换乘分析结果 // Result if (m_solutions != null) { // 将换乘方案的概要信息添加到m_comboGuide中 // Store the result to m_comboGuide FillComboBox(); // 在地图和DataGridView中显示换乘导引 // Display the transfer guide on the map and the DataGridView ShowReslut(); } else { if (SuperMap.Data.Environment.CurrentCulture != "zh-CN") { MessageBox.Show("Sorry! There is no proper transfer line!"); } else { MessageBox.Show("抱歉!没有寻找到合适的换乘方案!"); } } } } catch (Exception ex) { Trace.WriteLine(ex.Message); } }
/// <summary> /// 清空跟踪图层及分析结果 /// Clear /// </summary> public void ClearResult() { try { m_solutions = null; m_startStopID = -1; m_trackingLayer.Clear(); m_mapControl.Map.RefreshTrackingLayer(); m_comboGuide.Items.Clear(); m_comboGuide.Text = ""; m_dataGridView.Rows.Clear(); m_layerStop.Selection.Clear(); m_mapControl.Map.Refresh(); } catch (Exception ex) { Trace.WriteLine(ex.Message); } }
/// <summary> /// 初始化TransferAnalystSolutionEventArgs类的新实例。 /// </summary> /// <param name="solutions">FindTransferSolutions方法的返回结果。</param> public TransferAnalystSolutionEventArgs(TransferSolutions solutions) { this._solutions = solutions; }