private void changeCellMap(string oldName, CellTrafficMap newMap) { CellTrafficMap trafficMap = this.GetTrafficMap(oldName); trafficMap.CellServiceContextDict.Clear(); foreach (KeyValuePair<Transceiver, List<CellServiceContext>> pair in newMap.CellServiceContextDict) { trafficMap.CellServiceContextDict.Add(pair.Key, pair.Value); } trafficMap.ClutterDataDict.Clear(); foreach (KeyValuePair<short, ClutterData> pair2 in newMap.ClutterDataDict) { trafficMap.ClutterDataDict.Add(pair2.Key, pair2.Value); } trafficMap.MobilityDistributionDict.Clear(); foreach (KeyValuePair<Mobility, float> pair3 in newMap.MobilityDistributionDict) { trafficMap.MobilityDistributionDict.Add(pair3.Key, pair3.Value); } trafficMap.Name = newMap.Name; trafficMap.PredcitionResolution = newMap.PredcitionResolution; trafficMap.PredictionGroup = newMap.PredictionGroup; trafficMap.TerminalDistributionDict.Clear(); foreach (KeyValuePair<Terminal, float> pair4 in newMap.TerminalDistributionDict) { trafficMap.TerminalDistributionDict.Add(pair4.Key, pair4.Value); } this.m_MapDict.Remove(oldName); this.m_MapDict.Add(trafficMap.Name, trafficMap); }
public bool AddTrafficMap(CellTrafficMap map) { if (!this.checkNameIsNotExist(map.Name)) { this.ErrorMessage = this.m_ErrorMessageDic[TrafficMapResource.TRAFFICMAP_NAME_EXIST]; return false; } if (!this.checkTrafficMapProperty(map)) { return false; } this.m_MapDict.Add(map.Name, map); map.SerivceContext = this.m_ServiceContext; ProjectSingleton.CurrentProject.NeedPromptSave = true; return true; }
public bool ModifyCellTrafficMap(string cellMapName, CellTrafficMap cellMap) { this.BuildMapData(cellMap); if (!this.modelService.CellTrafficMapMgr.MoidfyCellTrafficMap(cellMapName, this.m_Map)) { return false; } this.inNode.Text = this.m_Map.Name; this.m_IsNodeAdded = true; return true; }
public CellMapPropertiesFrm(TreeNode node, IApplicationContext context, List<NetWorkType> netTypeList) { this.m_AllTerminal = new Dictionary<string, Terminal>(); this.m_AllMobility = new Dictionary<string, Mobility>(); this.m_CellNamesInLowercase = new List<string>(); this.m_ServiceContext = null; this.m_TrafficService = null; this.modelService = null; this.m_CellDataGridViewDict = new Dictionary<int, Dictionary<int, List<object>>>(); this.inNode = null; this.m_ServiceList = null; this.m_TerminalList = null; this.m_OldMapName = string.Empty; this.components = null; this.m_IsNodeAdded = true; this.inNode = node; string text = this.inNode.Text; this.Text = text + TrafficMapResource.TRAFFICMAP_PROPERTIES; this.m_ServiceContext = context; this.m_TrafficService = context.Lookup(typeof(ITrafficService).FullName) as ITrafficService; this.modelService = context.Lookup(typeof(ITrafficMapModelService).FullName) as ITrafficMapModelService; this.m_TrafficMapAutomation = context.Lookup(typeof(ITrafficMapFunction).FullName) as ITrafficMapFunction; this.m_netWorkTypeList = netTypeList; this.InitializeComponent(); this.m_Map = this.modelService.CellTrafficMapMgr.GetTrafficMap(text); this.m_TrafficForMap = this.m_ServiceContext.Lookup(typeof(ITrafficForMap).FullName) as ITrafficForMap; this.m_CellDict = new Dictionary<string, Transceiver>(); this.m_OldMapName = text; this.LoadCellMapProperty(); this.btnApply.Enabled = false; }
private void GenerateBlankUserPerService(short cellID, CellServiceContext ctx, int scalingFactor, CellTrafficMap map) { List<GeoXYRect> cellRects = this.GetCellRects(cellID); int userNumber = Convert.ToInt32((int) (ctx.UserCnt * scalingFactor)); List<User> users = this.CreateBlankUser(userNumber, cellRects, ctx); this.SetBlanUserProperties(users, map); this.m_UserCollection.UserList.AddRange(users); }
private void btnOk_Click(object sender, EventArgs e) { if (!(!this.m_IsNodeAdded || this.btnApply.Enabled)) { base.Close(); } else { ProjectSingleton.CurrentProject.NeedPromptSave = true; if (!this.m_IsNodeAdded) { this.m_Map = new CellTrafficMap(); } if (this.IsMapNameInvalid()) { this.SaveMap(); base.Close(); } } }
private CellTrafficMap CreateCellMapObj() { CellTrafficMap map = new CellTrafficMap { Name = this.m_TxtBoxMapName.Text.Trim() }; int selectedIndex = this.cmBoxSelectGroup.SelectedIndex; if (selectedIndex != -1) { ICoverageInfo info = this.m_PredGroups[selectedIndex]; map.PredictionGroup = info; map.PredcitionResolution = info.Resolution; } Dictionary<Transceiver, List<CellServiceContext>> cellSvcCtxDict = new Dictionary<Transceiver, List<CellServiceContext>>(); this.SaveCellServiceContext(ref cellSvcCtxDict); map.CellServiceContextDict = cellSvcCtxDict; Dictionary<Terminal, float> tmlDict = new Dictionary<Terminal, float>(); this.SaveTerminals(ref tmlDict); map.TerminalDistributionDict = tmlDict; Dictionary<Mobility, float> mobDict = new Dictionary<Mobility, float>(); this.SaveMobilities(ref mobDict); map.MobilityDistributionDict = mobDict; Dictionary<short, ClutterData> clutterDataDict = new Dictionary<short, ClutterData>(); this.SaveClutterData(ref clutterDataDict); map.ClutterDataDict = clutterDataDict; return map; }
private void SetUserProperties(List<User> users, CellTrafficMap map, short clutterID) { this.SetIndoor(users, map.ClutterDataDict[clutterID].IndoorUserRatio, clutterID); this.Shuffle(users); }
private bool checkTrafficMapProperty(CellTrafficMap map) { if (!this.checkMobilityProperty(map.MobilityDistributionDict)) { return false; } if (!this.checkTerminalProperty(map.TerminalDistributionDict)) { return false; } if (!this.checkClutterDataProperty(map.ClutterDataDict)) { return false; } if ((map.PredictionGroup != null) && !this.checkCellContext(map.CellServiceContextDict)) { return false; } return true; }
private void ProcessGenUserService(CellTrafficMap map, int scalingFactor, Transceiver cell, bool isFixure) { if (this.m_CellRectHelper.CellCenterPtsDict.ContainsKey(cell.ID)) { List<GeoXYRect> cellRects = this.GetCellRects(cell.ID); if (cellRects.Count != 0) { if (map.ClutterDataDict.Count != 0) { MapClutterHelper clutterHelper = new MapClutterHelper(cellRects, this.m_PolyAssist, map.ClutterDataDict, this.m_ServiceContext); this.GenerateClutterUserPerCell(map, scalingFactor, cell, isFixure, clutterHelper); } else { foreach (CellServiceContext context in map.CellServiceContextDict[cell]) { this.GenerateBlankUserPerService(cell.ID, context, scalingFactor, map); } } cellRects.Clear(); } } }
private void SetBlanUserProperties(List<User> users, CellTrafficMap map) { this.SetTerminal(users, map.TerminalDistributionDict); this.Shuffle(users); this.SetMobility(users, map.MobilityDistributionDict); }
private void GenerateUserPerService(short cellID, CellServiceContext ctx, int scalingFactor, CellTrafficMap map, MapClutterHelper clutterHelper, bool isFixure) { Predicate<GeoXYPoint> match = null; int count = this.m_UserCollection.UserList.Count; foreach (short num2 in clutterHelper.CluttersId) { List<int> list3; bool flag; List<GeoXYRect> cellRects = this.GetCellRects(cellID); int num3 = Convert.ToInt32((double) ((ctx.UserCnt * scalingFactor) * clutterHelper.ClutterWeightFactorDict[num2])); int max = clutterHelper.ClutterPtsCntDict[num2]; int cnt = num3; List<GeoXYPoint> pts = new List<GeoXYPoint>(); goto Label_00E4; Label_0072: list3 = this.GetRandomIdx(max, cnt); List<GeoXYPoint> collection = this.GetRandomClutterPts(cellRects, num2, list3, isFixure); if (match == null) { match = geoXYPoint => !this.m_CellRectHelper.IsPoiontIsPolyRegion(geoXYPoint); } collection.RemoveAll(match); pts.AddRange(collection); if ((pts.Count < num3) && (cnt > 0)) { cnt -= pts.Count; } else { goto Label_00E9; } Label_00E4: flag = true; goto Label_0072; Label_00E9: cnt = 0; List<User> users = this.CreateUsers(ctx, pts, num2); this.SetUserProperties(users, map, num2); this.m_UserCollection.UserList.AddRange(users); } }
private void GenerateUserPerCell(CellTrafficMap map, int scalingFactor, bool isFixure) { List<Transceiver> cells = new List<Transceiver>(); foreach (Transceiver transceiver in map.CellServiceContextDict.Keys) { cells.Add(transceiver); this.m_CellRectHelper.GetAllCellCenterPts(map, cells); this.ProcessGenUserService(map, scalingFactor, transceiver, isFixure); this.m_CellRectHelper.CellCenterPtsDict.Remove(transceiver.ID); cells.Remove(transceiver); } }
private void GenerateClutterUserPerCell(CellTrafficMap map, int scalingFactor, Transceiver cell, bool isFixure, MapClutterHelper clutterHelper) { foreach (CellServiceContext context in map.CellServiceContextDict[cell]) { bool flag; int count = this.m_UserCollection.UserList.Count; int userCnt = context.UserCnt; this.GenerateUserPerService(cell.ID, context, scalingFactor, map, clutterHelper, isFixure); int num3 = 0; goto Label_00F5; Label_0056: if ((this.m_UserCollection.UserList.Count - count) < userCnt) { context.UserCnt = (userCnt - (this.m_UserCollection.UserList.Count - count)) + num3; this.GenerateUserPerService(cell.ID, context, scalingFactor, map, clutterHelper, isFixure); } else { if ((this.m_UserCollection.UserList.Count - count) == userCnt) { goto Label_00FD; } this.m_UserCollection.UserList.RemoveAt(this.m_UserCollection.UserList.Count - 1); } num3++; Label_00F5: flag = true; goto Label_0056; Label_00FD: context.UserCnt = userCnt; List<User> range = this.m_UserCollection.UserList.GetRange(count, userCnt); this.SetTerminal(range, map.TerminalDistributionDict); this.Shuffle(range); this.SetMobility(range, map.MobilityDistributionDict); } }
public bool NewCellTrafficMap(CellTrafficMap newMap) { this.BuildMapData(newMap); if (!this.modelService.CellTrafficMapMgr.AddTrafficMap(this.m_Map)) { return false; } this.AddTrafficMapNode(this.m_Map.Name, TrafficMapResource.TRAFFICMAP_NEW); return true; }
public bool MoidfyCellTrafficMap(string oldName, CellTrafficMap newMap) { if (this.checkNameIsNotExist(oldName)) { this.ErrorMessage = TrafficMapResource.TRAFFIC_NAME_NOT_EXISTED; return false; } if ((oldName != newMap.Name) && !this.checkNameIsNotExist(newMap.Name)) { this.ErrorMessage = this.m_ErrorMessageDic[TrafficMapResource.TRAFFICMAP_NAME_EXIST]; return false; } if (!this.checkTrafficMapProperty(newMap)) { return false; } this.changeCellMap(oldName, newMap); ProjectSingleton.CurrentProject.NeedPromptSave = true; return true; }
private void btnApply_Click(object sender, EventArgs e) { ProjectSingleton.CurrentProject.NeedPromptSave = true; if (!this.m_IsNodeAdded) { this.m_Map = new CellTrafficMap(); } if (this.IsMapNameInvalid()) { this.SaveMap(); this.m_TxtBoxMapName.Text = this.m_Map.Name; this.m_OldMapName = this.m_Map.Name; this.m_IsNodeAdded = true; this.btnApply.Enabled = false; } }
public bool RemoveTrafficMap(CellTrafficMap map) { ProjectSingleton.CurrentProject.NeedPromptSave = true; return this.m_MapDict.Remove(map.Name); }
private void BuildMapData(CellTrafficMap newMap) { this.m_Map = new CellTrafficMap(); this.m_Map.Name = newMap.Name; if (this.m_PredGroups != null) { this.m_PredGroups.Clear(); } this.m_PredGroups = this.modelService.getCoverageInfoList(); ICoverageInfo info = this.m_PredGroups.Find(curCovInfo => curCovInfo.Name.Equals(newMap.PredictionGroup.Name)); if (null != info) { this.m_Map.PredictionGroup = info; this.m_Map.PredcitionResolution = info.Resolution; } TerminalManagement manager = this.m_TrafficService.LookupManager(typeof(TerminalManagement)) as TerminalManagement; Dictionary<Terminal, float> dictionary = new Dictionary<Terminal, float>(); foreach (KeyValuePair<Terminal, float> pair in newMap.TerminalDistributionDict) { Terminal key = manager.FindTerminalByName(pair.Key.Name); dictionary.Add(key, pair.Value); } this.m_Map.TerminalDistributionDict = dictionary; MobilityManagement management2 = this.m_TrafficService.LookupManager(typeof(MobilityManagement)) as MobilityManagement; Dictionary<Mobility, float> dictionary2 = new Dictionary<Mobility, float>(); foreach (KeyValuePair<Mobility, float> pair2 in newMap.MobilityDistributionDict) { Mobility mobility = management2.FindMobilityByName(pair2.Key.Name); dictionary2.Add(mobility, pair2.Value); } this.m_Map.MobilityDistributionDict = dictionary2; ClutterDataManagement management3 = this.m_TrafficService.LookupManager(typeof(ClutterDataManagement)) as ClutterDataManagement; Dictionary<short, ClutterData> dictionary3 = new Dictionary<short, ClutterData>(); foreach (KeyValuePair<short, ClutterData> pair3 in newMap.ClutterDataDict) { ClutterData data = management3.ClutterDataDic[pair3.Key]; dictionary3.Add(pair3.Key, data); } this.m_Map.ClutterDataDict = dictionary3; }
public bool UpdateTrafficMap(CellTrafficMap map) { if (this.m_MapDict.ContainsKey(map.Name)) { map.SerivceContext = this.m_ServiceContext; this.m_MapDict[map.Name] = map; return true; } return false; }
private void InitCellMap() { this.m_CellDict = new Dictionary<string, Transceiver>(); this.m_Map = new CellTrafficMap(); this.m_Map.Name = this.getNewMapName(); this.setTerminalDic(); this.setMobilityDic(); this.setServiceDic(); this.setClutterDic(); }
public UserCollection Generate(CellTrafficMap map, int scalingFactor, bool isFixure) { if (isFixure) { this.m_Random = new Random(0); } else { this.m_Random = new Random(); } this.m_CellRectHelper = new CellRectHelper(map, this.m_ServiceContext); this.GenerateUserPerCell(map, scalingFactor, isFixure); this.IndexUsersId(this.m_UserCollection); return this.m_UserCollection; }