public UserCollection Generate(int index, EnvTrafficMap map, int scalingFactor, bool isFixure) { this.m_UserCollection = new UserCollection(); ITrafficMapModelService service = this.ServiceContext.Lookup(typeof(ITrafficMapModelService).FullName) as ITrafficMapModelService; IGeoPolygonAssist polygonRegionAssist = service.PolygonRegionAssist; foreach (GeoPolygonRegion region in map.PolygonEnvironmentBindings.Keys) { try { GeoPolygonRegion poly = this.getActuralPolyonRegion(polygonRegionAssist, region); this.m_PolyClutterMapping = new MapClutterHelper(poly, polygonRegionAssist, map.PolygonEnvironmentBindings[region].ClutterDatas, this.ServiceContext, isFixure); this.m_UserCoordinateGen = new EnvUserCoordinateGen(index,poly, map.PolygonEnvironmentBindings[region], this.m_PolyClutterMapping, scalingFactor, isFixure, this.ServiceContext); this.GenerateUsersByClutters(); } catch (Exception exception) { WriteLog.Logger.Error(region.Name + " is not exist or" + exception.StackTrace); } } this.IndexUsersId(this.m_UserCollection); return this.m_UserCollection; }
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 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 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); } }