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

📄 evacuationobjects.cs

📁 AE+vb来实现的最短路径的实现功能!gis
💻 CS
字号:
using System;
using System.Collections;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.esriSystem;
//Ismael Chivite
//ESRI Redlands
//March 2005
namespace EvacuationRoutes
{
	public interface IAgent
	{
		string Name
		{
			get;
			set;
		}
		string Type
		{
			get;
			set;
		}
		string Status
		{
			get;
			set;
		}
		long CurrentPositionId
		{
			get;
		}
		NetworkPosition CurrentPosition
		{
			get;
		}
		long NextPositionId
		{
			get;
		}
		long RemainingPositions
		{
			get;
		}
		bool Arrived
		{
			get;
		}
		long TargetFacility
		{
			get;
			set;
		}
		bool GoesThrough(long position);

		void MoveForward();
		void LoadPositionIds(long[] positions);
		void LoadPositionIds(ArrayList  positions);
		void LoadPositionIds(string  positions);
		void LoadPositions(Hashtable pNetworkPositions);

		long[] GetPositions();
	}

	public class NetworkPosition
	{		
		private long m_UniqueID = -1;
		private int m_Capacity = -1;
		private int m_AgentsInPosition = 0;
		private double m_Rotation = -1;
		private IPoint[] m_Locations = null;
		private int m_LastPositionReturned = 0;

		private int m_OneTimeDelay = 0;

		public NetworkPosition()
		{

		}
		public long UniqueID
		{
			get
			{
				return m_UniqueID;
			}
			set
			{
				m_UniqueID = value;
			}
		}
		public double Rotation
		{
			get
			{
				return m_Rotation;
			}
			set
			{
				m_Rotation = value;
			}
		}
		public IPoint Location
		{
			get
			{
				if (m_AgentsInPosition < 2  )
				{
					m_LastPositionReturned = 0;
					return m_Locations[0];
				}
				else
				{
					if (m_Capacity == m_LastPositionReturned + 1)
					{
						m_LastPositionReturned = 0;
						return m_Locations [m_LastPositionReturned];
					}
					else
					{
						m_LastPositionReturned++;
						return m_Locations[m_LastPositionReturned];
					}
				}
			}
		}
		public void SetLocation(int i,IPoint pPoint)
		{
			if (i > m_Capacity) throw new Exception("Maximum capacity is " + m_Capacity.ToString() + " Cannot set location. Note: Location index is zero based");
			IZAware pZAware =  pPoint as IZAware;
			pZAware.ZAware = true;
			m_Locations[i] = pPoint;
		}
		public int Capacity
		{
			get
			{
				return m_Capacity;
			}
			set
			{
				m_Capacity = value;
				m_Locations = new PointClass[m_Capacity];
			}
		}
		public int AgentsInPosition
		{
			get
			{
				return m_AgentsInPosition;
			}
		}
		public bool AddAgent(bool force)
		{
			if (force)
			{
				m_AgentsInPosition++;
				return true;
			}
			else
			{
				if (m_OneTimeDelay>0)m_OneTimeDelay--;
				if (m_AgentsInPosition>=m_Capacity || m_OneTimeDelay>0 )
				{
					return false;
				}
				else
				{
					if (m_AgentsInPosition>=m_Capacity ) return false;
					m_AgentsInPosition++;
					return true;
				}
			}
		}
		public void RemoveAgent()
		{
			if (m_AgentsInPosition==0) throw new Exception("Cannot remove more agenta from position " + this.UniqueID.ToString());
			m_AgentsInPosition--;
		}
		public int OneTimeDelay
		{
			get
			{
				return m_OneTimeDelay;
			}
			set
			{
				m_OneTimeDelay = value;
			}
		}
	}
}

⌨️ 快捷键说明

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