⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmbusresult.cs

📁 公布ilrbuivbiu复合带搜ifd回复地鸥鸟个能否地偶女男的
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace MainSystem
{
	/// <summary>
	/// Summary description for frmBusResult.
	/// </summary>
	public class frmBusResult : System.Windows.Forms.Form
	{
		private ArrayList	_arrayResult = null;
		private frmMain		_frmMain = null;

		private System.Windows.Forms.Label _label;
		private System.Windows.Forms.ListBox _listBox;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmBusResult(frmMain frm,ArrayList result)
		{
			_arrayResult = result;
			_frmMain = frm;
			InitializeComponent();
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this._label = new System.Windows.Forms.Label();
			this._listBox = new System.Windows.Forms.ListBox();
			this.SuspendLayout();
			// 
			// _label
			// 
			this._label.Font = new System.Drawing.Font("SimSun", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this._label.Location = new System.Drawing.Point(8, 8);
			this._label.Name = "_label";
			this._label.Size = new System.Drawing.Size(224, 27);
			this._label.TabIndex = 3;
			this._label.Text = "label1";
			// 
			// _listBox
			// 
			this._listBox.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			this._listBox.Font = new System.Drawing.Font("SimSun", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this._listBox.Location = new System.Drawing.Point(8, 45);
			this._listBox.Name = "_listBox";
			this._listBox.Size = new System.Drawing.Size(304, 186);
			this._listBox.TabIndex = 2;
			this._listBox.DoubleClick += new System.EventHandler(this._listBox_DoubleClick);
			// 
			// frmBusResult
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.AutoScroll = true;
			this.ClientSize = new System.Drawing.Size(328, 256);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this._label,
																		  this._listBox});
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
			this.Name = "frmBusResult";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "乘车路线查询结果";
			this.Load += new System.EventHandler(this.frmBusResult_Load);
			this.ResumeLayout(false);

		}
		#endregion

		private void frmBusResult_Load(object sender, System.EventArgs e)
		{
			_label.Text = "总共查询到"+_arrayResult.Count.ToString() +"种方案";  
			LoadListBox();
		}

		private void LoadListBox()
		{
			_listBox.Items.Clear();  
			int index = 1; 
			for (int i = 0; i < _arrayResult.Count; i ++)
			{
				PathNode node = (PathNode)_arrayResult[i];
				string str;				
				str = "第" + index.ToString()  + "方案:";

				for (int j = 0; j < node.nSegNumber; j ++)
				{
					if (j > 0)
						str += ",转车,坐";
					else
						str +="坐";
					
					str += node.szRoutineName[j];
					str += "车,从";
					str += node.szFromStationName[j];
					str += "到";
					str += node.szToStationName[j]; 
				}		

				_listBox.Items.Add(str);
				index ++;
			}
		}

		private void _listBox_DoubleClick(object sender, System.EventArgs e)
		{
			if (_listBox.SelectedIndex < 0 )
				return;

			PathNode node = (PathNode)_arrayResult[_listBox.SelectedIndex];
			_frmMain._environment.m_drawLine = new MLine[node.nSegNumber]; 
			
			_frmMain._environment.m_buses = new Buses();
			int nCount = 0;
			bool bBus = true;

			for (int j = 0; j < node.nSegNumber; j ++)
			{
				MapObjects2.Line  moline = _frmMain._environment.GetLine( node.szRoutineName[j]);
				if (null == moline)
				{
					_frmMain._environment.m_drawLine = null;
					_frmMain._environment.m_buses = null;

					_frmMain._map.Extent = _frmMain._map.Extent; 
					return;
				}
				MapObjects2.Point pt;
				MPoint pt1 = new MPoint();
				MPoint pt2 = new MPoint();
 
				pt = _frmMain._environment.GetPoint(node.szFromStationName[j]);
				if (null == pt)
				{
					_frmMain._environment.m_drawLine = null;
					_frmMain._environment.m_buses = null;
					_frmMain._map.Extent = _frmMain._map.Extent; 
					return;
				}
				pt1.x = pt.X ;
				pt1.y = pt.Y ;

				pt = _frmMain._environment.GetPoint(node.szToStationName[j]);
				if (null == pt)
				{
					_frmMain._environment.m_drawLine = null;
					_frmMain._environment.m_buses = null;
					_frmMain._map.Extent = _frmMain._map.Extent; 
					return;
				}

				pt2.x = pt.X ;
				pt2.y = pt.Y ;

				MLine line = _frmMain._environment.CreateLine(moline);
				CBusLine busLine = new CBusLine();				
				_frmMain._environment.m_drawLine[j] = new MLine(); 
				busLine.CutLine(line,pt1,pt2,ref _frmMain._environment.m_drawLine[j]); 

				if (bBus)
					bBus = _frmMain._environment.GetStation(node,j,_frmMain._environment.m_buses,ref nCount); 				
			}	
	
			if (!bBus)
				_frmMain._environment.m_buses = null;
			else
				_frmMain._environment.m_buses.nNum = nCount;  

			_frmMain._map.CenterAt(_frmMain._environment.m_drawLine[0].pPoint[0].x ,_frmMain._environment.m_drawLine[0].pPoint[0].y);
			_frmMain._map.RefreshLayer(0,_frmMain._map.Extent);    
			_frmMain._mapEye.Extent=_frmMain._mapEye.Extent ; 
		}

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -