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

📄 map.cs

📁 实现A*算法的C#源代码
💻 CS
字号:
/*
    作者:Tom Xu(tsing_feng@163.com)
    创建时间:2006-11-03 13:40
    内容描述:生成邻接矩阵的所需要的数据结构
*/

using System;
using System.Collections ;
using System.Collections.Generic;
namespace Iaspec.GIS.Common
{
	
	public class Map
	{
        

        private double[,] Mapdata;
        /// <summary>
        /// 邻接矩阵
        /// </summary>
        public double[,] Matrics
        {
            get { return Mapdata; }
            set { Mapdata = value; }
        }
        //static int[,] Mapdata = 
        //{
        //    {0,20,45,-1,26},
        //    {17,0,1,67,90},
        //    {30,10,0,-1,50},
        //    {-1,20,1,0,20},
        //    {90,-1,-1,40,0}
        //};


		public double GetMap(int x,int y)
		{
			int yMax =Mapdata.GetUpperBound (0);
			int xMax =Mapdata.GetUpperBound (1);
			if (x<0 ||  x>xMax)
				return -1;
			else if (y<0 || y>yMax)
				return -1;
			else
				return Mapdata[y,x];
		}
	}
}

⌨️ 快捷键说明

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