コード例 #1
0
        ElevationCell CreateElevationCell(byte[] data, int begin)
        {
            int elIndex = 0;
            int pos     = begin;

            //计算仰角单元编号
            for (int i = 0; i < ElevationCell.HeadLength; i++)
            {
                elIndex  = elIndex << 8;
                elIndex += data[pos++];
            }
            ElevationCell elCell = new ElevationCell(elIndex);

            //生成距离单元
            for (int i = 0; i < ElevationCell.DistanceCellsCount; i++)
            {
                DistanceCell cell = new DistanceCell(data, pos);
                pos += DistanceCell.TotalLength;

                if (Pass(cell))
                {
                    elCell.AddDistanceCell(cell);
                }
            }

            return(elCell);
        }
コード例 #2
0
        public AzimuthCell(byte[] data)
        {
            DisCells = new Dictionary <int, DistanceCell>();

            int angleI;

            (Angle, angleI) = GetAngleFromCycleData(data);

            int cellCount = Tools.MakeInt(data, HeadLength + AzimuthLength, DistanceCellCountLength);

            int pos = DistanceCellsDataStartPosition;

            for (int i = 0; i < cellCount; i++)
            {
                if (pos + DistanceCell.Length >= data.Length)       //数据溢出判断
                {
                    break;
                }
                var cell = new DistanceCell(data, pos)
                {
                    az = Angle, azInt = angleI
                };

                if (DistanceCellFilter.Pass(cell) && !DisCells.ContainsKey(cell.index))     //滤波
                {
                    DisCells.Add(cell.index, cell);
                }

                pos += DistanceCell.Length;
            }
        }
コード例 #3
0
        protected override bool Pass(DistanceCell cell)
        {
            int sum = 0;

            for (int i = 1; i < DistanceCell.AMCount; i++)
            {
                sum += cell.speedAM[i];
            }

            if (sum == 0)   //1-7号速度回波幅度都是零则丢弃该距离单元
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
コード例 #4
0
        ElevationCell CreateElevationCell(byte[] data)                 //基于数组拷贝的算法
        {
            int           elIndex = data[0];                           //第一个8位为仰角单元编号
            ElevationCell elCell  = new ElevationCell(elIndex);
            int           pos     = ElevationCell.HeadLength;          //从取完仰角包头的位置开始创建距离单元

            byte[] tmp = new byte[DistanceCell.TotalLength];           //存放一个距离单元数据的缓存
            for (int i = 0; i < ElevationCell.DistanceCellsCount; i++) //根据一个仰角单元包含的距离单元的个数,循环创建距离单元
            {
                System.Buffer.BlockCopy(data, pos, tmp, 0, tmp.Length);

                //创建距离单元对象
                DistanceCell cell = new DistanceCell(tmp);
                if (Pass(cell))
                {
                    elCell.AddDistanceCell(cell);
                }

                pos += DistanceCell.TotalLength;    //指向下一距离单元
            }

            return(elCell);
        }
コード例 #5
0
 protected abstract bool Pass(DistanceCell cell);
コード例 #6
0
 public void RemoveDistanceCell(DistanceCell cell)
 {
     disCells.Remove(cell.Index);
 }
コード例 #7
0
 public void AddDistanceCell(DistanceCell cell)
 {
     disCells.Add(cell.Index, cell);
 }