public bool Init(string strRootdir, Hashtable htMapId) { m_strRootDir = strRootdir; string strMapName; int nMapId; foreach (DictionaryEntry de in htMapId) { strMapName = de.Value.ToString(); nMapId = (int)de.Key; m_htMapId[strMapName] = nMapId; m_htMapName[nMapId] = strMapName; } string strLogicalFilePath; foreach (string mapname in m_htMapName.Values) { strLogicalFilePath = string.Format("{0}/data/source/maps/{1}/{1}.Map.Logical", m_strRootDir, mapname); MapInfo4Quest mapInfo = new MapInfo4Quest(strLogicalFilePath); if (mapInfo.Init()) { m_htMapInfo4Quest[mapname] = mapInfo; } } return true; }
public bool Init(string strRootdir, Hashtable htMapId) { m_strRootDir = strRootdir; string strMapName; int nMapId; foreach (DictionaryEntry de in htMapId) { strMapName = de.Value.ToString(); nMapId = (int)de.Key; m_htMapId[strMapName] = nMapId; m_htMapName[nMapId] = strMapName; } string strLogicalFilePath; foreach (string mapname in m_htMapName.Values) { strLogicalFilePath = string.Format("{0}/data/source/maps/{1}/{1}.Map.Logical", m_strRootDir, mapname); MapInfo4Quest mapInfo = new MapInfo4Quest(strLogicalFilePath); if (mapInfo.Init()) { m_htMapInfo4Quest[mapname] = mapInfo; } } return(true); }
/// <summary> /// 获取一个id在logical文件里的最终坐标 /// </summary> /// <param name="mapName">所属地图名称</param> /// <param name="templateId">模块id</param> /// <param name="templatetype">模块类型</param> /// <returns></returns> private Point3d GetFinalPoint(int templateId, TemplateType templatetype, bool needRefence, Point3d pointRefence) { Point3d pointRet; MapInfo4Quest mapInfo; pointRet.nX = -1; pointRet.nY = -1; pointRet.nZ = -1; if (m_htMapInfo4Quest.ContainsKey(m_strCurrentMapName)) { mapInfo = (MapInfo4Quest)m_htMapInfo4Quest[m_strCurrentMapName]; } else { string strLogicalFilePath = string.Format("{0}/data/source/maps/{1}/{1}.Map.Logical", m_strRootDir, m_strCurrentMapName); mapInfo = new MapInfo4Quest(strLogicalFilePath); if (mapInfo.Init()) { m_htMapInfo4Quest[m_strCurrentMapName] = mapInfo; } } if (mapInfo.IsAvailabel) { pointRet = mapInfo.GetFinalPoint(templateId, templatetype, needRefence, pointRefence); } return(pointRet); }
/// <summary> /// 获取一个id在logical文件里的最终坐标 /// </summary> /// <param name="mapName">所属地图名称</param> /// <param name="templateId">模块id</param> /// <param name="templatetype">模块类型</param> /// <returns></returns> private Point3d GetFinalPoint(int templateId, TemplateType templatetype, bool needRefence, Point3d pointRefence) { Point3d pointRet; MapInfo4Quest mapInfo; pointRet.nX = -1; pointRet.nY = -1; pointRet.nZ = -1; if (m_htMapInfo4Quest.ContainsKey(m_strCurrentMapName)) { mapInfo = (MapInfo4Quest)m_htMapInfo4Quest[m_strCurrentMapName]; } else { string strLogicalFilePath = string.Format("{0}/data/source/maps/{1}/{1}.Map.Logical", m_strRootDir, m_strCurrentMapName); mapInfo = new MapInfo4Quest(strLogicalFilePath); if (mapInfo.Init()) { m_htMapInfo4Quest[m_strCurrentMapName] = mapInfo; } } if (mapInfo.IsAvailabel) { pointRet = mapInfo.GetFinalPoint(templateId, templatetype, needRefence, pointRefence); } return pointRet; }