/// <summary>
    /// 获取地图连接
    /// </summary>
    /// <returns></returns>
    public static IMap GetIMap()
    {
        string address = ConfigurationSettings.AppSettings["MapServer_Address"].ToString();
        int port = int.Parse(ConfigurationSettings.AppSettings["MapServer_Port"].ToString());
        string mapname = ConfigurationSettings.AppSettings["MapName"].ToString();
        //这里的Application["m_map"]不要随便改名字,它跟TcpMapHandler.ashx有关联
        IMap m_map = null;
        if (System.Web.HttpContext.Current.Application["m_map"] == null)
        {
            m_map = TcpMap.Create(address, port, new Hashtable());
            System.Web.HttpContext.Current.Application["m_map"] = m_map;
        }
        else
        {
            m_map = (IMap)System.Web.HttpContext.Current.Application["m_map"];
        }
        MapParam mp = new MapParam();
        mp.MapName = mapname;
        MapImage mimg = m_map.GetMapImage(mp);
        return m_map;
    }
posted on 2010-05-24 10:18  游子  阅读(523)  评论(0编辑  收藏  举报