Esempio n. 1
0
        public void DealPacket_ChainInfo(object pack)
        {
            RD_ChainInfo rd = (RD_ChainInfo)pack;

            if (rd.StartOrEnd == "s")
            {
                chain_path temp = new chain_path(this);
                temp.sensor_name = rd.id;
                temp.path        = rd.PathNodes;
                foreach (var o in rd.PathNodes)
                {
                    temp.path_Objs.Add(Scenemana.stkObjs.Find(c => c.ObjName == o));
                }
                Scenemana.setupchain(temp);
                Scenemana.all_path.Add(temp);
            }
            else if (rd.StartOrEnd == "e")
            {
                //清楚掉链路
                chain_path temp;
                temp = Scenemana.all_path.Find(c => c.sensor_name == rd.id);
                if (temp != null)
                {
                    Scenemana.RemoveAllSensorOnPath(temp);
                    Scenemana.all_path.Remove(temp);
                }
                else
                {
                    MessageBox.Show("读取链路记录异常");
                }
            }
        }
Esempio n. 2
0
        public void DealPacket_InterSatellitePath(object pack)
        {
            RD_InterSatellitePath rd = (RD_InterSatellitePath)pack;

            //判断是否为之前已存在的相同链路,如不同,则清除之前的链路
            if (rd_update.ISLPath != null && !rd.ISLPath.Equals(rd_update.ISLPath))
            {
                //清除链路
                chain_path temp;
                temp = Scenemana.all_path.Find(c => c.sensor_name == rd_update.ISLid.ToString());
                if (temp != null)
                {
                    Scenemana.RemoveAllSensorOnPath(temp);
                    Scenemana.all_path.Remove(temp);
                }
                //else MessageBox.Show("读取链路记录异常");
            }
            //判断是否需要建立新的链路(第一次建立或者链路改变)
            if (rd_update.ISLPath == null || !rd.ISLPath.Equals(rd_update.ISLPath))
            {
                chain_path   pathinfo = new chain_path(this);
                RD_ChainInfo temp1;
                int          index    = 0;
                string       Nodes    = rd.ISLPath.ToString();
                string[]     nodelist = Nodes.Split(new string[] { "->" }, StringSplitOptions.None);
                foreach (var str in nodelist)
                {
                    pathinfo.path.Add(str);
                    //将系统物件表中的物体添加到链路的小表中
                    pathinfo.path_Objs.Add(Scenemana.stkObjs.Find(c => c.ObjName == str));
                }
                //pathinfo.sensor_name = pathinfo.path[0] + "-" + pathinfo.path[pathinfo.path.Count - 1];
                pathinfo.sensor_name = rd.ISLid.ToString();
                Scenemana.msglist.Clear();
                Scenemana.msglist.Add(new Msg {
                    PathNodes = pathinfo.path, id = pathinfo.sensor_name
                });
                temp1 = Scenemana.MakePacket(Scenemana.msglist[index]);
                if (temp1 != null)
                {
                    //立即执行
                    DealPacket_ChainInfo(temp1);
                    index++;
                }
            }
            rd_update = rd;//记录最新的链路信息,为下次判断做准备
        }