Example #1
0
 /// <summary>
 /// 取得所有的方向对应相位的数据
 /// </summary>
 /// <returns></returns>
 public static List<PhaseToDirec> GetPhaseToDirec()
 {
     TscData t = Utils.Utils.GetTscDataByApplicationCurrentProperties();
     byte[] byt = Udp.recvUdp(t.Node.sIpAddress, Define.GBT_PORT, Define.GET_PHASE_DIREC);
     if (!CheckGBT(byt, "相位与方向关系"))
     {
         return null;
     }
     List<PhaseToDirec> llc = new List<PhaseToDirec>();
     byte[] pdArray = new byte[Convert.ToInt32(byt[3]) * Define.PHASE_DIREC_BYTE_SIZE];
     Array.Copy(byt, 4, pdArray, 0, Convert.ToInt32(byt[3]) * Define.PHASE_DIREC_BYTE_SIZE);
     byte[,] twoArray = ByteUtils.oneArray2TwoArray(pdArray, Convert.ToInt32(byt[3]), Define.PHASE_DIREC_BYTE_SIZE);
     PhaseToDirec lc;
     for (int i = 0; i < Convert.ToInt32(byt[3]); i++)
     {
         lc = new PhaseToDirec();
         lc.ucId = twoArray[i, 0];
         lc.ucPhase = twoArray[i, 1];
         lc.ucOverlapPhase = twoArray[i, 2];
         lc.ucRoadCnt = twoArray[i, 3];
         llc.Add(lc);
     }
     return llc;
 }
Example #2
0
        private void initRedPhaseDirec(PhaseToDirec ptd,CollisionItem c)
        {
            if (ptd.ucId == Define.NORTH_LEFT)
            {
                c.northLeft.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.NORTH_STRAIGHT)
            {
                c.northStraight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.NORTH_RIGHT)
            {
                c.northRight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.NORTH_OTHER)
            {
                c.northOther.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.NORTH_PEDESTRAIN_ONE)
            {
                c.northPedestrain1.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight1.png", UriKind.Relative));
            }

            if (ptd.ucId == Define.SOUTH_LEFT)
            {
                c.southLeft.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.SOUTH_STRAIGHT)
            {
                c.southStraight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.SOUTH_RIGHT)
            {
                c.southRight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.SOUTH_OTHER)
            {
                c.southOther.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.SOUTH_PEDESTRAIN_ONE)
            {
                c.southPedestrain1.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight1.png", UriKind.Relative));
            }

            if (ptd.ucId == Define.EAST_LEFT)
            {
                c.eastLeft.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.EAST_STRAIGHT)
            {
                c.eastStraight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.EAST_RIGHT)
            {
                c.eastRight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.EAST_OTHER)
            {
                c.eastOther.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.EAST_PEDESTRAIN_ONE)
            {
                c.eastPedestrain1.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight.png", UriKind.Relative));
            }

            if (ptd.ucId == Define.WEST_LEFT)
            {
                c.westLeft.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.WEST_STRAIGHT)
            {
                c.westStraight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.WEST_RIGHT)
            {
                c.westRight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.WEST_OTHER)
            {
                c.westOther.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.WEST_PEDESTRAIN_ONE)
            {
                c.westPedestrain1.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/redlight.png", UriKind.Relative));
            }
        }
Example #3
0
 private void collisionFlagSetPhaseBit(tscui.Models.Collision c , PhaseToDirec ptd)
 {
     if (ptd.ucPhase == 1)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_1_PHASE;
     }
     if (ptd.ucPhase == 2)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_2_PHASE;
     }
     if (ptd.ucPhase == 3)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_3_PHASE;
     }
     if (ptd.ucPhase == 4)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_4_PHASE;
     }
     if (ptd.ucPhase == 5)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_5_PHASE;
     }
     if (ptd.ucPhase == 6)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_6_PHASE;
     }
     if (ptd.ucPhase == 7)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_7_PHASE;
     }
     if (ptd.ucPhase == 8)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_8_PHASE;
     }
     if (ptd.ucPhase == 9)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_9_PHASE;
     }
     if (ptd.ucPhase == 10)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_10_PHASE;
     }
     if (ptd.ucPhase == 11)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_11_PHASE;
     }
     if (ptd.ucPhase == 12)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_12_PHASE;
     }
     if (ptd.ucPhase == 13)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_13_PHASE;
     }
     if (ptd.ucPhase == 14)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_14_PHASE;
     }
     if (ptd.ucPhase == 15)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_15_PHASE;
     }
     if (ptd.ucPhase == 16)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_16_PHASE;
     }
     if (ptd.ucPhase == 17)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_17_PHASE;
     }
     if (ptd.ucPhase == 18)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_18_PHASE;
     }
     if (ptd.ucPhase == 19)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_19_PHASE;
     }
     if (ptd.ucPhase == 20)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_20_PHASE;
     }
     if (ptd.ucPhase == 21)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_21_PHASE;
     }
     if (ptd.ucPhase == 22)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_22_PHASE;
     }
     if (ptd.ucPhase == 23)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_23_PHASE;
     }
     if (ptd.ucPhase == 24)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_24_PHASE;
     }
     if (ptd.ucPhase == 25)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_25_PHASE;
     }
     if (ptd.ucPhase == 26)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_26_PHASE;
     }
     if (ptd.ucPhase == 27)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_27_PHASE;
     }
     if (ptd.ucPhase == 28)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_28_PHASE;
     }
     if (ptd.ucPhase == 29)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_29_PHASE;
     }
     if (ptd.ucPhase == 30)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_30_PHASE;
     }
     if (ptd.ucPhase == 31)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_31_PHASE;
     }
     if (ptd.ucPhase == 32)
     {
         c.ucCollisionFlag = c.ucCollisionFlag | Define.COLLISION_32_PHASE;
     }
 }
Example #4
0
        private void setPatternAndStagePattern(List<Pattern> lp ,List<StagePattern> lsp , StageItem currentStage,PhaseToDirec ptd)
        {
            //半断是新增加stage还是,老的更新用的
            Pattern ptemp= null;
           // List<Pattern> lptemp = new List<Pattern>();
            bool newPattern = false;
            bool oldPattern = false;
            foreach(Pattern p in lp)
            {
               
                if (sldSchemeId.Value == p.ucPatternId )
                {
                    p.ucCoorPhase = Convert.ToByte(cbxCoordination.SelectedItem);
                    p.ucCycleTime = Convert.ToByte(tbxCycle.Text);
                    p.ucOffset = Convert.ToByte(tbxOffset.Text);
                    p.ucPatternId = Convert.ToByte(sldSchemeId.Value);
                    p.ucStagePatternId = Convert.ToByte(sldStagePatternId.Value);
                    oldPattern = true;
                    //if (sldStagePatternId.Value == p.ucStagePatternId)
                    //{
                    //    p.ucCoorPhase = Convert.ToByte(cbxCoordination.SelectedItem);
                    //    p.ucCycleTime = Convert.ToByte(tbxCycle.Text);
                    //    p.ucOffset = Convert.ToByte(tbxOffset.Text);
                    //    p.ucPatternId = Convert.ToByte(sldSchemeId.Value);
                    //    p.ucStagePatternId = Convert.ToByte(sldStagePatternId.Value);
                    //}
                    //else
                    //{
                       
                    //}
                    //p.ucPatternId = Convert.ToByte(sldSchemeId.Value);
                    //p.ucStagePatternId = Convert.ToByte(sldStagePatternId.Value);
                    //ptemp = null;
                }
                else
                {
                    newPattern = true;
                }
            
            }
            if (!oldPattern)
            {
                if (newPattern)
                {
                    ptemp = new Pattern();
                    ptemp.ucCoorPhase = Convert.ToByte(cbxCoordination.SelectedItem);
                    ptemp.ucCycleTime = Convert.ToByte(tbxCycle.Text);
                    ptemp.ucOffset = Convert.ToByte(tbxOffset.Text);
                    ptemp.ucPatternId = Convert.ToByte(sldSchemeId.Value);
                    ptemp.ucStagePatternId = Convert.ToByte(sldStagePatternId.Value);
                    lp.Add(ptemp);
                }
               
            }
            //if (!lp.Contains(ptemp))//这里主要 是,新的方案号需要增加。旧的方案,不用进行增加,
            //{
                
            //}
           
            

            foreach (StagePattern sp in lsp)
            {
                if (sp.ucStagePatternId == sldStagePatternId.Value)
                {
                    
                    if (sp.ucStageNo == Convert.ToByte(currentStage.lblNumber.Content))
                    {
                        sp.ucStagePatternId = Convert.ToByte(sldStagePatternId.Value);
                        sp.ucStageNo = Convert.ToByte(currentStage.lblNumber.Content);
                        sp.ucGreenTime = Convert.ToByte(sldGreenTime.Value);
                        sp.ucYellowTime = Convert.ToByte(sldYellowTime.Value);
                        sp.ucRedTime = Convert.ToByte(sldRedTime.Value);
                        sp.ucOption = returnReactionTrueOrFalse();
                        sp.usAllowPhase = returnAllowPhase(ptd.ucPhase, sp.usAllowPhase);
                        Console.WriteLine(sp.usAllowPhase);
                        break;
                    }
                    else if(sp.ucStageNo == 0)
                    {
                        sp.ucStagePatternId = Convert.ToByte(sldStagePatternId.Value);
                        sp.ucStageNo = Convert.ToByte(currentStage.lblNumber.Content);
                        sp.ucGreenTime = Convert.ToByte(sldGreenTime.Value);
                        sp.ucYellowTime = Convert.ToByte(sldYellowTime.Value);
                        sp.ucRedTime = Convert.ToByte(sldRedTime.Value);
                        sp.ucOption = returnReactionTrueOrFalse();
                        sp.usAllowPhase = returnAllowPhase(ptd.ucPhase, sp.usAllowPhase);
                        Console.WriteLine(sp.usAllowPhase);
                        break;
                    }
                    else
                    {
                        //MessageBox.Show("研发专用,程序异常。没有进行stage,stageNo 不为0,也不为小图上的编号\n");
                    }
                }
            }
               
        }
Example #5
0
 private uint returnUnAllowPhase(PhaseToDirec  ptd, uint ap)
 {
     uint temp = 1;
     uint c = (~(temp << (ptd.ucPhase - 1))) & ap;
     //ap = c;
     return c;
 }
Example #6
0
        /// <summary>
        /// 通过方向 表和阶段表可以确定,相应的相位已经配置上去。
        /// </summary>
        /// <param name="ptd"></param>
        /// <param name="sp"></param>
        private void InitStageDirec(PhaseToDirec ptd,StagePattern sp)
        {
            if (ptd.ucId == Define.NORTH_PEDESTRAIN_ONE)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.northPedestrain1.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));

            }
            if (ptd.ucId == Define.NORTH_PEDESTRAIN_TWO)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.northPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));

            }
            if (ptd.ucId == Define.NORTH_TURN_AROUND)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.northPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));

            }
            if (ptd.ucId == Define.NORTH_LEFT_STRAIGHT)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.northPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));

            }
            if (ptd.ucId == Define.NORTH_RIGHT_STRAIGHT)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.northPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));

            }
            if (ptd.ucId == Define.NORTH_LEFT_STRAIGHT_RIGHT)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.northPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));

            }
            if (ptd.ucId == Define.NORTH_LEFT)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.northLeft.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative)); 

            }
            if (ptd.ucId == Define.NORTH_STRAIGHT)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.northStraight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.NORTH_RIGHT)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.northRight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.NORTH_OTHER)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.northOther.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
            }
            // 南
            if (ptd.ucId == Define.SOUTH_PEDESTRAIN_ONE)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.southPedestrain1.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.SOUTH_PEDESTRAIN_TWO)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.southPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.SOUTH_LEFT_STRAIGHT)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.southPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.SOUTH_LEFT_STRAIGHT_RIGHT)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.southPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.SOUTH_RIGHT_STRAIGHT)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.southPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.SOUTH_LEFT)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.southLeft.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.SOUTH_OTHER)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.southOther.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.SOUTH_RIGHT)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.southRight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.SOUTH_STRAIGHT)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.southStraight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
            }
            // 西
            if (ptd.ucId == Define.WEST_PEDESTRAIN_ONE)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.westPedestrain1.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.WEST_PEDESTRAIN_TWO)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.westPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.WEST_LEFT_STRAIGHT)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.westPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.WEST_LEFT_STRAIGHT_RIGHT)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.westPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.WEST_RIGHT_STRAIGHT)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.westPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.WEST_LEFT)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.westLeft.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.WEST_STRAIGHT)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.westStraight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.WEST_RIGHT)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.westRight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.WEST_OTHER)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.westOther.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }

            if (ptd.ucId == Define.EAST_PEDESTRAIN_ONE)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.eastPedestrain1.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.EAST_PEDESTRAIN_TWO)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.eastPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.EAST_LEFT_STRAIGHT)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.eastPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.EAST_LEFT_STRAIGHT_RIGHT)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.eastPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.EAST_RIGHT_STRAIGHT)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.eastPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.EAST_LEFT)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.eastLeft.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.EAST_STRAIGHT)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.eastStraight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.EAST_RIGHT)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.eastRight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.EAST_OTHER)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.eastOther.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }

            //byte direcId = ptd.ucId;
            //byte direc = Convert.ToByte(direcId >> 5);
            //byte turn = Convert.ToByte(direcId >> 3);
            //byte pedestrain = Convert.ToByte((direcId >> 3) & 0x07);

            //if (direc == 0x01)
            //{
            //    if (turn == 0x00)
            //    {

            //    }
            //}
        }
Example #7
0
        /// <summary>
        /// 根据方向表,可以得到哪个方向有配置相位。哪个方向没有配置相位,
        /// 根据方向表的相位字段,可以将方向隐藏起来
        /// </summary>
        /// <param name="ptd"></param>
        /// <param name="sp"></param>
        private void initDirecArrow(PhaseToDirec ptd, StagePattern sp)
        {
            if (ptd.ucId == Define.NORTH_PEDESTRAIN_ONE && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.northPedestrain1.Visibility = Visibility.Hidden;
                northPedestrain1.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.NORTH_PEDESTRAIN_TWO && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.northPedestrain2.Visibility = Visibility.Hidden;
                northPedestrain2.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.NORTH_TURN_AROUND && ptd.ucPhase == 0)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.northPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));

            }
            if (ptd.ucId == Define.NORTH_LEFT_STRAIGHT && ptd.ucPhase == 0)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.northPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));

            }
            if (ptd.ucId == Define.NORTH_RIGHT_STRAIGHT && ptd.ucPhase == 0)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.northPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));

            }
            if (ptd.ucId == Define.NORTH_LEFT_STRAIGHT_RIGHT && ptd.ucPhase == 0)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.northPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));

            }
            if (ptd.ucId == Define.NORTH_LEFT && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.northLeft.Visibility = Visibility.Hidden;
                northLeft.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.NORTH_STRAIGHT && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.northStraight.Visibility = Visibility.Hidden;
                northStraight.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.NORTH_RIGHT && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.northRight.Visibility = Visibility.Hidden;
                northRight.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.NORTH_OTHER && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.northOther.Visibility = Visibility.Hidden;
                northOther.Visibility = Visibility.Hidden;
            }
            // 南
            if (ptd.ucId == Define.SOUTH_PEDESTRAIN_ONE && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.southPedestrain1.Visibility = Visibility.Hidden;
                southPedestrain1.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.SOUTH_PEDESTRAIN_TWO && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.southPedestrain2.Visibility = Visibility.Hidden;
                southPedestrain2.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.SOUTH_LEFT_STRAIGHT && ptd.ucPhase == 0)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.southPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.SOUTH_LEFT_STRAIGHT_RIGHT && ptd.ucPhase == 0)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.southPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.SOUTH_RIGHT_STRAIGHT && ptd.ucPhase == 0)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.southPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.SOUTH_LEFT && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.southLeft.Visibility = Visibility.Hidden;
                southLeft.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.SOUTH_OTHER && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.southOther.Visibility = Visibility.Hidden;
                southOther.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.SOUTH_RIGHT && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.southRight.Visibility = Visibility.Hidden;
                southRight.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.SOUTH_STRAIGHT && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.southStraight.Visibility = Visibility.Hidden;
                southStraight.Visibility = Visibility.Hidden;
            }
            // 西
            if (ptd.ucId == Define.WEST_PEDESTRAIN_ONE && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.westPedestrain1.Visibility = Visibility.Hidden;
                westPedestrain1.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.WEST_PEDESTRAIN_TWO && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.westPedestrain2.Visibility = Visibility.Hidden;
                westPedestrain2.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.WEST_LEFT_STRAIGHT && ptd.ucPhase == 0)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.westPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.WEST_LEFT_STRAIGHT_RIGHT && ptd.ucPhase == 0)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.westPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.WEST_RIGHT_STRAIGHT && ptd.ucPhase == 0)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.westPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.WEST_LEFT && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.westLeft.Visibility = Visibility.Hidden;
                westLeft.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.WEST_STRAIGHT && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.westStraight.Visibility = Visibility.Hidden;
                westStraight.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.WEST_RIGHT && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.westRight.Visibility = Visibility.Hidden;
                westRight.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.WEST_OTHER && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.westOther.Visibility = Visibility.Hidden;
                westOther.Visibility = Visibility.Hidden;
            }

            if (ptd.ucId == Define.EAST_PEDESTRAIN_ONE && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.eastPedestrain1.Visibility = Visibility.Hidden;
                eastPedestrain1.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.EAST_PEDESTRAIN_TWO && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.eastPedestrain2.Visibility = Visibility.Hidden;
                eastPedestrain2.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.EAST_LEFT_STRAIGHT && ptd.ucPhase == 0)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.eastPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.EAST_LEFT_STRAIGHT_RIGHT && ptd.ucPhase == 0)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.eastPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.EAST_RIGHT_STRAIGHT && ptd.ucPhase == 0)
            {
                //StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                //si.eastPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
            }
            if (ptd.ucId == Define.EAST_LEFT && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.eastLeft.Visibility = Visibility.Hidden;
                eastLeft.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.EAST_STRAIGHT && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.eastStraight.Visibility = Visibility.Hidden;
                eastStraight.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.EAST_RIGHT && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.eastRight.Visibility = Visibility.Hidden;
                eastRight.Visibility = Visibility.Hidden;
            }
            if (ptd.ucId == Define.EAST_OTHER && ptd.ucPhase == 0)
            {
                StageItem si = returnStageItemObjectByStageNo(sp.ucStageNo);
                si.eastOther.Visibility = Visibility.Hidden;
                eastOther.Visibility = Visibility.Hidden;
            }



        }
Example #8
0
 private void updateGreen(PhaseToDirec ptd)
 {
     if (ptd.ucId == Define.NORTH_LEFT)
     {
         imgNorthLeft.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.NORTH_STRAIGHT)
     {
         imgNorthStraight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.NORTH_RIGHT)
     {
         imgNorthRight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.NORTH_OTHER)
     {
         imgNorthOther.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.NORTH_PEDESTRAIN_ONE)
     {
         imgNorthPedestrain1.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.NORTH_PEDESTRAIN_TWO)
     {
         imgNorthPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.EAST_LEFT)
     {
         imgEastLeft.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.EAST_STRAIGHT)
     {
         imgEastStraight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.EAST_RIGHT)
     {
         imgEastRight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.EAST_OTHER)
     {
         imgEastOther.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.EAST_PEDESTRAIN_ONE)
     {
         imgEastPedestrain1.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.EAST_PEDESTRAIN_TWO)
     {
         imgEastPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.SOUTH_LEFT)
     {
         imgSouthLeft.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.SOUTH_STRAIGHT)
     {
         imgSouthStraight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.SOUTH_RIGHT)
     {
         imgSouthRight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.SOUTH_OTHER)
     {
         imgSouthOther.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.SOUTH_PEDESTRAIN_ONE)
     {
         imSouthPedestrain1.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.SOUTH_PEDESTRAIN_TWO)
     {
         imSouthPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.WEST_LEFT)
     {
         imgWestLeft.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.WEST_STRAIGHT)
     {
         imgWestStraight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.WEST_RIGHT)
     {
         imgWestRight.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.WEST_OTHER)
     {
         imgWestOther.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight1.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.WEST_PEDESTRAIN_ONE)
     {
         imgWestPedestrain1.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
     }
     if (ptd.ucId == Define.WEST_PEDESTRAIN_TWO)
     {
         imgWestPedestrain2.Source = new BitmapImage(new Uri("/tscui;component/Resources/Images/greenlight.png", UriKind.Relative));
     }
 }