Exemple #1
0
 private int CompareSpectrumData(SpectrumFreqPointData pData1, SpectrumFreqPointData pData2)
 {
     if (pData1.Freq < pData2.Freq)
     {
         return(-1);
     }
     if (pData1.Freq > pData2.Freq)
     {
         return(1);
     }
     return(0);
 }
Exemple #2
0
 /// <summary>
 /// 更新谱图数据
 /// </summary>
 public void UpdateData()
 {
     if (_multibandSpectrumDataList.Count == 0)
     {
         return;
     }
     _spectrumFreqPointList.Clear();
     //取融合后频段的起始频率和终止频率
     StartFreq = _multibandSpectrumDataList.Min(t => t.StartFreq);
     StopFreq  = _multibandSpectrumDataList.Max(t => t.StopFreq);
     foreach (var multibandSpectrumData in _multibandSpectrumDataList)
     {
         if (multibandSpectrumData.Count == 0)
         {
             continue;
         }
         //在标准频段分析中,这三组数据由三个服务而来,但各自对应的频点有微小差异。
         //若要针对重构,涉及数据缓存、管理、谱图画法,比较繁琐。此处和服务组商议能否修改服务,若不能再重构。
         var countList = new[]
         {
             multibandSpectrumData.MaxDbuvs.Count,
             multibandSpectrumData.MedianDbuvs.Count,
             multibandSpectrumData.NoiseDbuvs.Count
         };
         //若有0项,说明未取到该项数据,排除掉
         var count = countList.Except(new List <int>
         {
             0
         });
         for (int j = 0; j < count.Min(); j++)
         {
             var spectrumFreqPointData = new SpectrumFreqPointData
             {
                 Freq    = multibandSpectrumData.FreqValues.Count > j ? multibandSpectrumData.FreqValues[j] : new short(),
                 MaxDbuv = multibandSpectrumData.MaxDbuvs.Count > j ? multibandSpectrumData.MaxDbuvs[j] : new short(),
                 Dbuv    = multibandSpectrumData.MedianDbuvs.Count > j ? multibandSpectrumData.MedianDbuvs[j] : new short(),
                 Noise   = multibandSpectrumData.NoiseDbuvs.Count > j ? multibandSpectrumData.NoiseDbuvs[j] : new short(),
                 Index   = j
             };
             _spectrumFreqPointList.Add(spectrumFreqPointData);
         }
     }
     _spectrumFreqPointList.Sort(CompareSpectrumData);
 }