Ejemplo n.º 1
0
 public void DataQualityUpdate <T>(T q)
 {
     try
     {
         if (q is ClusterQuality)
         {
             ClusterQuality quality = (dynamic)q;
             ClusterGeneral general = this.ListBuffer_Cluster.Find(c => c.Id == quality.Id);
             general.Pdh0         = quality.Pdh0;
             general.InvalidState = quality.InvalidState;
             general.AmbigState   = quality.AmbigState;
         }
         else
         {
             ObjectQuality quality = (dynamic)q;
             ObjectGeneral general = this.ListBuffer_Object.Find(c => c.Id == quality.Id);
             general.MeasState   = quality.MeasState;
             general.ProbOfExist = quality.ProbOfExist;
             //TODO 输出结果过滤条件2
             //(假如是目标)判断存在概率的可能最小值是否小于允许的最低值
             if (general.ProbOfExistMinimum < this.ParentForm.ProbOfExistMinimum)
             {
                 this.ListBuffer_Object.Remove(general);
             }
         }
     }
     catch (Exception) { }
 }
        public void DataQualityUpdate <T>(T q)
        {
            try
            {
                if (q is ClusterQuality)
                {
                    ClusterQuality quality = (dynamic)q;
                    //在普通缓冲区查找ID,找不到则在其它缓冲区查找,还找不到则跳出
                    List <ClusterGeneral> list    = this.ListBuffer_Cluster;
                    ClusterGeneral        general = list.Find(c => c.Id == quality.Id);
                    if (general == null)
                    {
                        list    = this.ListBuffer_Cluster_Other;
                        general = list.Find(c => c.Id == quality.Id);
                    }
                    if (general == null)
                    {
                        return;
                    }

                    general.Pdh0         = quality.Pdh0;
                    general.InvalidState = quality.InvalidState;
                    general.AmbigState   = quality.AmbigState;
                    //TODO 集群模式输出结果过滤条件2:(过滤器启用、过滤器不为空)不在集群/不确定性/有效性过滤器内
                    if (BaseConst.FilterEnabled && ((ClusterQuality.FalseAlarmFilter.Count > 0 && !ClusterQuality.FalseAlarmFilter.Contains(general.Pdh0)) ||
                                                    (ClusterQuality.AmbigStateFilter.Count > 0 && !ClusterQuality.AmbigStateFilter.Contains(general.AmbigState)) ||
                                                    (ClusterQuality.InvalidStateFilter.Count > 0 && !ClusterQuality.InvalidStateFilter.Contains(general.InvalidState))))
                    {
                        list.Remove(general);
                    }
                }
                else
                {
                    ObjectQuality quality = (dynamic)q;
                    ObjectGeneral general = this.ListBuffer_Object.Find(c => c.Id == quality.Id);
                    if (general == null)
                    {
                        general = this.ListBuffer_Object_Other.Find(c => c.Id == quality.Id);
                    }
                    general.MeasState   = quality.MeasState;
                    general.ProbOfExist = quality.ProbOfExist;
                    //TODO 目标模式输出结果过滤条件2
                    //(假如过滤器启用)判断存在概率的可能最小值是否小于允许的最低值
                    if (BaseConst.FilterEnabled && general.ProbOfExistMinimum < this.ParentForm.ProbOfExistMinimum)
                    {
                        this.ListBuffer_Object.Remove(general);
                    }
                }
            }
            catch (Exception) { }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 处理输入信息
        /// </summary>
        /// <param name="input">输入的信息</param>
        public void Filter(string input)
        {
            if (string.IsNullOrWhiteSpace(input))
            {
                return;
            }

            #region 方法3 新正则提取
            MatchCollection col = pattern.Matches(input);
            if (col == null || col.Count == 0)
            {
                return;
            }
            foreach (Match match in col)
            {
                BaseMessage message = new BaseMessage(match.Value);
                dynamic     obj;
                switch (message.MessageId)
                {
                case SensorMessageId_0.RadarState_Out:
                    this.RadarState.Base = message;
                    break;

                case SensorMessageId_0.Cluster_0_Status_Out:
                    obj = new ClusterStatus(message);
                    this.DataPushFinalize();
                    this.CurrentSensorMode = SensorMode.Cluster;
                    this.BufferSize        = obj.NofClustersNear + obj.NofClustersFar;
                    break;

                case SensorMessageId_0.Cluster_1_General_Out:
                    obj = new ClusterGeneral(message, this.Radar);
                    this.DataPush <ClusterGeneral>(obj);
                    this.ActualSize++;
                    break;

                case SensorMessageId_0.Cluster_2_Quality_Out:
                    obj = new ClusterQuality(message);
                    this.DataQualityUpdate <ClusterQuality>(obj);
                    break;

                case SensorMessageId_0.Obj_0_Status_Out:
                    obj = new ObjectStatus(message);
                    this.DataPushFinalize();
                    this.CurrentSensorMode = SensorMode.Object;
                    this.BufferSize        = obj.NofObjects;
                    break;

                case SensorMessageId_0.Obj_1_General_Out:
                    obj = new ObjectGeneral(message, this.Radar);
                    this.DataPush <ObjectGeneral>(obj);
                    this.ActualSize++;
                    break;

                case SensorMessageId_0.Obj_2_Quality_Out:
                    obj = new ObjectQuality(message);
                    this.DataQualityUpdate <ObjectQuality>(obj);
                    break;

                default:
                    continue;
                }
            }
            #endregion
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 处理输入信息
        /// </summary>
        /// <param name="input">输入的信息</param>
        public void Filter(string input)
        {
            if (string.IsNullOrWhiteSpace(input))
            {
                return;
            }

            #region 方法1 旧正则提取方法(注释)
            //this.Messages = RegexMatcher.FindMatches(input, BaseConst.Pattern_SensorMessage);
            //if (this.Messages == null || this.Messages.Length == 0)
            //    return;
            //foreach (var m in this.Messages)
            //{
            //    BaseMessage message = new BaseMessage(m);
            //    dynamic obj;
            //    switch (message.MessageId)
            //    {
            //        case SensorMessageId_0.Cluster_0_Status_Out:
            //            obj = new ClusterStatus(message);
            //            this.DataPushFinalize();
            //            this.BufferSize = obj.NofClustersNear + obj.NofClustersFar;
            //            break;
            //        case SensorMessageId_0.Cluster_1_General_Out:
            //            obj = new ClusterGeneral(message);
            //            this.DataPush(obj);
            //            //this.List_ClusterGeneral.Add(obj);
            //            break;
            //        case SensorMessageId_0.Cluster_2_Quality_Out:
            //            obj = new ClusterQuality(message);
            //            break;
            //        default:
            //            continue;
            //    }
            //    //this.List_SensorInfos.Add(obj);
            //}
            #endregion

            #region 方法2 逐字符分解(注释)
            //this.Messages = this.GatherMessages(input); //方法2 逐字符分解
            #endregion

            #region 方法3 新正则提取
            MatchCollection col = pattern.Matches(input);
            if (col == null || col.Count == 0)
            {
                return;
            }
            foreach (Match match in col)
            {
                BaseMessage message = new BaseMessage(match.Value);
                dynamic     obj;
                switch (message.MessageId)
                {
                case SensorMessageId_0.RadarState_Out:
                    //obj = new RadarState(message);
                    this.RadarState.Base = message;
                    //this.Timer = 0;
                    //this.RadarState.Working = true;
                    break;

                case SensorMessageId_0.Cluster_0_Status_Out:
                    obj = new ClusterStatus(message);
                    this.DataPushFinalize();
                    this.CurrentSensorMode = SensorMode.Cluster;
                    this.BufferSize        = obj.NofClustersNear + obj.NofClustersFar;
                    break;

                case SensorMessageId_0.Cluster_1_General_Out:
                    obj = new ClusterGeneral(message, this.Radar);
                    this.DataPush <ClusterGeneral>(obj);
                    break;

                case SensorMessageId_0.Cluster_2_Quality_Out:
                    obj = new ClusterQuality(message);
                    this.DataQualityUpdate <ClusterQuality>(obj);
                    break;

                case SensorMessageId_0.Obj_0_Status_Out:
                    obj = new ObjectStatus(message);
                    this.DataPushFinalize();
                    this.CurrentSensorMode = SensorMode.Object;
                    this.BufferSize        = obj.NofObjects;
                    break;

                case SensorMessageId_0.Obj_1_General_Out:
                    obj = new ObjectGeneral(message, this.Radar);
                    this.DataPush <ObjectGeneral>(obj);
                    break;

                case SensorMessageId_0.Obj_2_Quality_Out:
                    obj = new ObjectQuality(message);
                    this.DataQualityUpdate <ObjectQuality>(obj);
                    break;

                default:
                    continue;
                }
            }
            #endregion
        }