Exemple #1
0
        public List<AntennaEntity> import(string path)
        {
            List<AntennaEntity> antennaEntityList = new List<AntennaEntity>();
            //SmartAntenna sa = new SmartAntenna();
            SmartAntenna SA = new SmartAntenna();
            SA = BinarySerialize.GetSmartAnt();
            FixedAntenna antFixed = new FixedAntenna();
            FixedAntenna pattern = new FixedAntenna() ;
            int nameStart = path.LastIndexOf("_");
            int nameEnd = path.LastIndexOf(".");
            string pattMainAngle = path.Substring((nameStart + 1), (nameEnd - nameStart - 1));
            if (pattMainAngle.Contains("BCH"))
            {
                antennaEntityList.Add(SA.BCH_SmartAntenna.Antenna);
                return antennaEntityList;
            }
            else
            {
                pattMainAngle = pattMainAngle.Substring(0, (pattMainAngle.Length - 1));
                int mainAngle = int.Parse(pattMainAngle);
                if (mainAngle < 0)
                {
                    mainAngle = 360 + mainAngle;
                }

                SA.DicPAngleWithAntenna.TryGetValue(mainAngle, out pattern);
                antennaEntityList.Add(pattern.Antenna);
                return antennaEntityList ;
            }
        }
Exemple #2
0
        public void Update(FixedAntenna data)
        {
            if (DataForUpdate.Name != data.Name)
            {
                //修改了底层数据的Name, 
                //并修改了树节点的显示,但没有修改底层数据的OldName
                SaMg.ModifySmartAntPattern(DataForUpdate.Name,
                    SANameForUpdate, data.Name);
             } 
            this.DataForUpdate.Antenna = (AntennaEntity)data.Antenna.Clone();

        }
Exemple #3
0
        public bool Validate(FixedAntenna data, out string errorInfo)
        {
            //检查赋形图是否重名
            if (data.Name != DataForUpdate.Name)
            {
                FixedAntenna antfixed = SaMg.FindSmartAntPatternByName(data.Name, SANameForUpdate);
                if (antfixed != null)
                {
                    errorInfo = "The pattern name already exists!";
                    return false;
                }
            }

            errorInfo = "OK";
            return true;
        }
Exemple #4
0
 /// <summary>
 /// 智能天线的构造参数
 /// </summary>
 /// <param name="info"></param>
 /// <param name="context"></param>
 public SmartAntenna(SerializationInfo info, StreamingContext context)
 {
     m_BCH_SmartAntenna = info.GetValue("m_BCH_SmartAntenna", m_BCH_SmartAntenna.GetType()) as FixedAntenna;
     m_PatternAngles = info.GetValue("m_PatternAngles", m_PatternAngles.GetType()) as List<float>;
     m_SAPatterns = info.GetValue("m_SAPatterns", m_SAPatterns.GetType()) as List<FixedAntenna>;
     m_selectedAnt = info.GetValue("m_selectedAnt", m_selectedAnt.GetType()) as Dictionary<int, int>;
     name = info.GetString("name");
     m_dicPAngleWithAntenna = info.GetValue("m_dicPAngleWithAntenna", m_dicPAngleWithAntenna.GetType()) as Dictionary<float, FixedAntenna>;
 }
        /// <summary>
        /// 更新智能天线,除了BCH
        /// </summary>
        private void UpdateSmartAnt(FixedAntenna bchAnt)
        {
            m_SA.DicPAngleWithAntenna.Clear();
            m_SA.PatternAngles.Clear();
            m_SA.SmartAntPatterns.Clear();

            foreach (DataGridViewRow row in InputMainAngle_dataGridView.Rows)
            {
                FixedAntenna ant = row.Tag as FixedAntenna;
                if (bchAnt != ant)//除了BCH,修改所有的主瓣角
                {
                    int angle;
                    int.TryParse(row.Cells[1].FormattedValue.ToString(), out angle);
                    m_SA.PatternAngles.Add(angle);
                    m_SA.SmartAntPatterns.Add(ant);
                    m_SA.DicPAngleWithAntenna.Add(angle, ant);
                }
            }
        }
        /// <summary>
        /// 更新智能天线,除了BCH
        /// </summary>
        private void UpdateSmartAnt(FixedAntenna bchAnt)
        {
            m_SA.DicPAngleWithAntenna.Clear();
            m_SA.PatternAngles.Clear();
            m_SA.SmartAntPatterns.Clear();

            foreach (DataGridViewRow row in InputMainAngle_dataGridView.Rows)
            {
                UpdateSmartAntHelper(bchAnt, row);
            }
        }
 private void UpdateSmartAntHelper(FixedAntenna bchAnt, DataGridViewRow row)
 {
     FixedAntenna ant = row.Tag as FixedAntenna;
     if (bchAnt != ant)//除了BCH,修改所有的主瓣角
     {
         int angle;
         int.TryParse(row.Cells[1].FormattedValue.ToString(), out angle);
         m_SA.PatternAngles.Add(angle);
         m_SA.SmartAntPatterns.Add(ant);
         m_SA.DicPAngleWithAntenna.Add(angle, ant);
     }
 }