Example #1
0
 /// <summary>
 /// 更新邻小区,如果某在目标小区计算范围内,则加入邻小区列表
 /// </summary>
 /// <param name="targetSortCell">目标小区</param>
 /// <param name="neighbourSortedCell">邻小区</param>
 /// <param name="cell">某需要考虑是否加入邻小区列表的小区</param>
 private void UpdateNeighbourSortedCell(SortedCell targetSortCell, List<SortedCell> neighbourSortedCell, SortedCell cell)
 {
     bool isinter = CheckDistanceAndDirection(targetSortCell, cell);
     if (isinter)
     {
         neighbourSortedCell.Add(cell);
     }
 }
Example #2
0
 /// <summary>
 /// 根据目标小区,对邻小区排序
 /// </summary>
 /// <param name="targetSortCell">目标小区</param>
 /// <param name="toBeSortedCells">邻小区</param>
 /// <returns>排序后的邻小区</returns>
 private List<SortedCell> GetSortedCells(SortedCell targetSortCell, List<SortedCell> toBeSortedCells)
 {
     List<SortedCell> neighbourSortedCell = new List<SortedCell>();
     foreach (SortedCell cell in toBeSortedCells)
     {
         //如果被比较的小区为目标小区,则跳过
         if (IsCellEqual(targetSortCell, cell))
             continue;
         UpdateNeighbourSortedCell(targetSortCell, neighbourSortedCell, cell);
     }
     return neighbourSortedCell;
 }
Example #3
0
 /// <summary>
 /// 获取给定阈值内邻小区
 /// </summary>
 /// <param name="targetCell">目标小区</param>
 /// <param name="Cells">备选邻小区集合</param>
 /// <param name="maxInterNum">邻小区集合元素数阈值</param>
 /// <returns>符合条件的邻小区集合</returns>
 public List<ISimCellBase> GetNeighbourCells(ISimCellBase targetCell, List<ISimCellBase> Cells,int maxInterNum)
 {
     List<ISimCellBase> neighbourCells = new List<ISimCellBase>();
     SortedCell targetSortCell = new SortedCell(targetCell);
     //获取包装后的小区列表
     List<SortedCell> toBeSortedCells = GetToBeSortedCell(Cells);
     //获取排序后的邻小区
     List<SortedCell> neighbourSortedCell = GetSortedCells(targetSortCell, toBeSortedCells);
     //依据最大切换小区阈值确定最终小区列表
     neighbourSortedCell = GetSortedCellinMaxInterNum(neighbourSortedCell, maxInterNum);
     //将小区拆包装
     return GetCellBaseList(neighbourSortedCell);
 }
Example #4
0
 private bool IsCellEqual(SortedCell target, SortedCell compare)
 {
     return (target.CellBase == compare.CellBase);
 }
Example #5
0
        /// <summary>
        /// 构造距离
        /// </summary>
        /// <param name="homeCell"></param>
        /// <param name="checkCell"></param>
        /// <param name="distance"></param>
        /// <param name="trandistance"></param>
        private void ConstructDistance(SortedCell homeCell, SortedCell checkCell, out double distance, out double trandistance)
        {
            distance = CalcRadius(homeCell.CellBase);
            double dx;
            double dy;

            dx = homeCell.CellBase.Parent.X - checkCell.CellBase.Parent.X;
            dy = homeCell.CellBase.Parent.Y - checkCell.CellBase.Parent.Y;
            trandistance = dx * dx + dy * dy;
            checkCell.Distance = trandistance;
        }
Example #6
0
 /// <summary>
 /// 获取小区距离是否合适
 /// </summary>
 /// <param name="homeCell"></param>
 /// <param name="checkCell"></param>
 /// <returns></returns>
 private bool CheckDistanceAndDirection(SortedCell homeCell, SortedCell checkCell)
 {
     double distance;
     double trandistance;
     ConstructDistance(homeCell, checkCell, out distance, out trandistance);
     bool isDistanceFit = true;
     if (trandistance > distance * distance)
     {
         isDistanceFit = false;
     }
     //else if (0 == trandistance)
     //{
     //    return true;
     //}
     //else
     //{
     //    //float currentangle = (float)(450 - Math.Atan2(dy, dx) * 180 / Math.PI) % 360;
     //    //float dangle = Math.Abs(currentangle - azimuth);
     //    //if (dangle < SweepAngle / 2 || 360 - dangle < SweepAngle / 2)
     //    //{
     //    return true;
     //    //}
     //}
     return isDistanceFit;
 }
Example #7
0
 private List<SortedCell> GetToBeSortedCell(List<ISimCellBase> cells)
 {
     List<SortedCell> sortedCells = new List<SortedCell>();
     foreach (ISimCellBase cell in cells)
     {
         SortedCell sortedCell = new SortedCell(cell);
         sortedCells.Add(sortedCell);
     }
     return sortedCells;
 }