예제 #1
0
 public CState0(CGanFairy[] ganc, CLineFairy[] xianc, CBmpFairy chec, ExamForm eform)
     : base(ganc, xianc, chec, eform)
 {
     tm          = new Timer();
     tm.Interval = 1000;
     tm.Tick    += new EventHandler(tm_Tick);
 }
예제 #2
0
파일: CState7.cs 프로젝트: wpmyj/Zhuangkao
        private bool lkxian8; //代表离开了线8

        public CState7(CGanFairy[] ganc, CLineFairy[] xianc, CBmpFairy chec, ExamForm eform)
            : base(ganc, xianc, chec, eform)
        {
            //stopmark = false;
            tm       = new Timer();
            tm.Tick += new EventHandler(Timerfun);
        }
예제 #3
0
파일: CState8.cs 프로젝트: wpmyj/Zhuangkao
        private Timer tm3;   //T3延时

        public CState8(CGanFairy[] ganc, CLineFairy[] xianc, CBmpFairy chec, ExamForm eform)
            : base(ganc, xianc, chec, eform)
        {
            tm        = new Timer();
            tm.Tick  += new EventHandler(Timerfun);
            tm3       = new Timer();
            tm3.Tick += new EventHandler(Timerfun);
        }
예제 #4
0
        protected static int jinku_line;//判断进库的方向(压2线进库还是压1线进库),2为压2线,1为压1线


        public CState(CGanFairy[] ganc, CLineFairy[] xianc, CBmpFairy chec, ExamForm examform)
        {
            gan        = ganc;
            xian       = xianc;
            che        = chec;
            eform      = examform;
            stopcount  = 0;
            jinku_line = 2;
        }
예제 #5
0
파일: CState14.cs 프로젝트: wpmyj/Zhuangkao
 public CState14(CGanFairy[] ganc, CLineFairy[] xianc, CBmpFairy chec, ExamForm eform)
     : base(ganc, xianc, chec, eform)
 {
     tm               = new Timer();
     tm.Tick         += new EventHandler(Timerfun);
     checkQJtm4       = new Timer();
     checkQJtm4.Tick += new EventHandler(checkQianJinByXian4);
     checkQJtm7       = new Timer();
     checkQJtm7.Tick += new EventHandler(checkQianJinByXian7);
 }
예제 #6
0
 public void Initial(CBmpFairy che)
 {
     keyPoints    = new List <Point>();
     vPoints      = new List <Point>();
     bufferPoints = new Queue <Point>();
     speedx       = 0.0;
     speedy       = 0.0;
     stepcount    = 0.0;
     this.AddKeyPoint(new Point(che.X, che.Y));
 }
예제 #7
0
 public StateManager(CGanFairy[] ganc, CLineFairy[] xianc, CBmpFairy chec, ExamForm eform)
 {
     StateList = new Hashtable();
     State0    = new CState0(ganc, xianc, chec, eform);
     StateList.Add("State0", State0);
     State1 = new CState1(ganc, xianc, chec, eform);
     StateList.Add("State1", State1);
     State2 = new CState2(ganc, xianc, chec, eform);
     StateList.Add("State2", State2);
     State3 = new CState3(ganc, xianc, chec, eform);
     StateList.Add("State3", State3);
     State4 = new CState4(ganc, xianc, chec, eform);
     StateList.Add("State4", State4);
     State4i = new CState4i(ganc, xianc, chec, eform);
     StateList.Add("State4i", State4i);
     State5 = new CState5(ganc, xianc, chec, eform);
     StateList.Add("State5", State5);
     State6 = new CState6(ganc, xianc, chec, eform);
     StateList.Add("State6", State6);
     State7 = new CState7(ganc, xianc, chec, eform);
     StateList.Add("State7", State7);
     State8 = new CState8(ganc, xianc, chec, eform);
     StateList.Add("State8", State8);
     State9 = new CState9(ganc, xianc, chec, eform);
     StateList.Add("State9", State9);
     State10 = new CState10(ganc, xianc, chec, eform);
     StateList.Add("State10", State10);
     State11 = new CState11(ganc, xianc, chec, eform);
     StateList.Add("State11", State11);
     State11i = new CState11i(ganc, xianc, chec, eform);
     StateList.Add("State11i", State11i);
     State12 = new CState12(ganc, xianc, chec, eform);
     StateList.Add("State12", State12);
     State13 = new CState13(ganc, xianc, chec, eform);
     StateList.Add("State13", State13);
     State14 = new CState14(ganc, xianc, chec, eform);
     StateList.Add("State14", State14);
     State14i = new CState14i(ganc, xianc, chec, eform);
     StateList.Add("State14i", State14i);
     State15 = new CState15(ganc, xianc, chec, eform);
     StateList.Add("State15", State15);
     State16 = new CState16(ganc, xianc, chec, eform);
     StateList.Add("State16", State16);
     State17 = new CState17(ganc, xianc, chec, eform);
     StateList.Add("State17", State17);
     StateEnd = new CStateEnd(ganc, xianc, chec, eform);
     StateList.Add("StateEnd", StateEnd);
     CurrState = State1;
 }
예제 #8
0
파일: CState8.cs 프로젝트: wpmyj/Zhuangkao
        private Timer tm7, tm8, tm2;    //, tm4;

        public CState8(CGanFairy[] ganc, CLineFairy[] xianc, CBmpFairy chec, ExamForm eform)
            : base(ganc, xianc, chec, eform)
        {
            tm7          = new Timer();
            tm7.Interval = 500;
            tm7.Tick    += new EventHandler(onTm7);
            tm2          = new Timer();
            tm2.Interval = 500;
            tm2.Tick    += new EventHandler(onTm2);
            tm8          = new Timer();
            tm8.Interval = 500;
            tm8.Tick    += new EventHandler(onTm8);
            //tm4 = new Timer();
            //tm4.Interval = 500;
            //tm4.Tick += new EventHandler(onTm4);
        }
예제 #9
0
 public Trace(double horRate, double virRate, CBmpFairy che, CLineFairy[] line)
 {
     this.horRate = horRate;
     this.virRate = virRate;
     rdNum        = new Random();
     xian         = new Point[9][];
     for (int i = 0; i < 9; i++)
     {
         CLineFairy x = line[i];
         xian[i]    = new Point[2];
         xian[i][0] = new Point((int)((double)x.X1 * horRate), (int)((double)x.Y1 * virRate));
         xian[i][1] = new Point((int)((double)x.X2 * horRate), (int)((double)x.Y2 * virRate));
         //(float)(x.X1 * horRate), (float)(x.Y1 * virRate), (float)(x.X2 * horRate), (float)(x.Y2 * virRate));
     }
     Initial(che);
 }
예제 #10
0
파일: CState9.cs 프로젝트: wpmyj/Zhuangkao
 public CState9(CGanFairy[] ganc, CLineFairy[] xianc, CBmpFairy chec, ExamForm eform)
     : base(ganc, xianc, chec, eform)
 {
 }
예제 #11
0
        public void myinit(int chetype)
        {
            // Graphics g = this.pictureBox1.CreateGraphics();


            CDM         = new CDisplayManager();
            cm          = new CMonitor();
            cm.Che_Type = chetype;
            cm.RegMonitor(this);
            myInvoke   = new InvokeDelegate(Invokefun);
            formInvoke = new InvokeDelegate(formInvokefun);

            //-----------初始化线数据-----------------------------
            xian = new CLineFairy[9];

            xian[0]          = new CLineFairy(170, 125, 170, 370);
            xian[0].LineName = "1";
            xian[0].Linex    = xian[0].X1 - 9;
            xian[0].Liney    = xian[0].Y1 - 120;
            CDM.RegDisplay(xian[0]);


            xian[1]          = new CLineFairy(260, 125, 260, 370);
            xian[1].LineName = "2";
            xian[1].Linex    = xian[1].X1 - 9;
            xian[1].Liney    = xian[1].Y1 - 120;
            CDM.RegDisplay(xian[1]);

            xian[2]          = new CLineFairy(350, 125, 350, 370);
            xian[2].LineName = "3";
            xian[2].Linex    = xian[2].X1 - 9;
            xian[2].Liney    = xian[2].Y1 - 120;
            CDM.RegDisplay(xian[2]);

            xian[3]          = new CLineFairy(20, 125, 170, 125);
            xian[3].LineName = "4";
            xian[3].Linex    = xian[3].X1 - 20;
            xian[3].Liney    = xian[3].Y1 - 7;
            CDM.RegDisplay(xian[3]);


            xian[6] = new CLineFairy(170, 125, 260, 125);
            CDM.RegDisplay(xian[6]);
            xian[7] = new CLineFairy(260, 125, 350, 125);
            CDM.RegDisplay(xian[7]);
            xian[8] = new CLineFairy(350, 125, 508, 125);
            CDM.RegDisplay(xian[8]);


            xian[4]          = new CLineFairy(170, 370, 350, 370);
            xian[4].LineName = "5";
            xian[4].Linex    = xian[4].X1 - 30;
            xian[4].Liney    = xian[4].Y1 - 7;
            CDM.RegDisplay(xian[4]);

            xian[5]          = new CLineFairy(20, 30, 508, 30);
            xian[5].LineName = "6";
            xian[5].Linex    = xian[5].X1 - 20;
            xian[5].Liney    = xian[5].Y1 - 7;
            CDM.RegDisplay(xian[5]);


            //-----------线数据初始化结束-----------------------------
            // 车初始化
            if (chetype == 0)
            {
                che = new CBmpFairy(".\\img\\scar00.gif");
            }
            else
            {
                che = new CBmpFairy(".\\img\\car00.gif");
            }
            che.SetWeizhi(445, 75);
            CDM.RegDisplay(che);
            che.Speed  = 1;
            che.RSpeed = 3;;


            //-----------初始化杆数据-----------------------------
            ganbm    = new Bitmap[3];
            ganbm[0] = new Bitmap(".\\img\\green2.gif");
            ganbm[1] = new Bitmap(".\\img\\red2.gif");
            ganbm[2] = new Bitmap(".\\img\\gray2.gif");
            for (int i = 0; i < 3; i++)
            {
                Color backcolor = ganbm[i].GetPixel(1, 1);
                ganbm[i].MakeTransparent(backcolor);
            }
            gan = new CGanFairy[6];
            for (int i = 0; i < 6; i++)
            {
                gan[i] = new CGanFairy(ganbm);
                CDM.RegDisplay(gan[i]);
                gan[i].GanName = Convert.ToString(i + 1);
            }

            gan[0].X = 160;
            gan[0].Y = 115;

            gan[1].X = 250;
            gan[1].Y = 115;

            gan[2].X = 340;
            gan[2].Y = 115;


            gan[3].X = 160;
            gan[3].Y = 360;

            gan[4].X = 250;
            gan[4].Y = 360;

            gan[5].X = 340;
            gan[5].Y = 360;

            //------杆数据初始化完成
            //---读配置文件屏蔽杆,线,车信号
            for (int i = 0; i < 6; i++)
            {
                if (((settings.PbGan_s >> i) & 1) == 1)
                {
                    cm.Shield(0, i + 1);
                    gan[i].Stat = -1;
                }
                if (((settings.PbXian_s >> i) & 1) == 1)
                {
                    cm.Shield(1, i + 1);
                    xian[i].Stat = -1;
                }
                if (i < 4)
                {
                    if (((settings.PbChe_s >> i) & 1) == 1)
                    {
                        cm.Shield(2, i + 1);
                    }
                }
            }


            //--------各状态初始化----------
            double horRate = (double)pictureBoxTrace.Width / (double)pictureBox1.Width;
            double virRate = (double)pictureBoxTrace.Height / (double)pictureBox1.Height;

            myTrace      = new Trace(horRate, virRate, che, xian);
            che.CarTrace = myTrace;
            statemanager = new StateManager(gan, xian, che, this);
            StateManager.SwitchState("State0");
            StateTime = new int[20];
            if (chetype == 0)
            {
                StateTime[2]  = settings.State2_Time_s;
                StateTime[3]  = settings.State3_Time_s;
                StateTime[4]  = settings.State4_Time_s;
                StateTime[5]  = settings.State5_Time_s;
                StateTime[6]  = settings.State6_Time_s;
                StateTime[7]  = settings.State7_Time_s;
                StateTime[8]  = settings.State8_Time_s;
                StateTime[9]  = settings.State9_Time_s;
                StateTime[10] = settings.State10_Time_s;
                StateTime[11] = settings.State11_Time_s;
                StateTime[12] = settings.State12_Time_s;
                StateTime[13] = settings.State13_Time_s;
                StateTime[14] = settings.State14_Time_s;
                StateTime[15] = settings.State15_Time_s;
                StateTime[16] = settings.State16_Time_s;
                StateTime[17] = settings.State4i_Time_s;
                StateTime[18] = settings.State14i_Time_s;
            }
            else
            {
                StateTime[2]  = settings.State2_Time_l;
                StateTime[3]  = settings.State3_Time_l;
                StateTime[4]  = settings.State4_Time_l;
                StateTime[5]  = settings.State5_Time_l;
                StateTime[6]  = settings.State6_Time_l;
                StateTime[7]  = settings.State7_Time_l;
                StateTime[8]  = settings.State8_Time_l;
                StateTime[9]  = settings.State9_Time_l;
                StateTime[10] = settings.State10_Time_l;
                StateTime[11] = settings.State11_Time_l;
                StateTime[12] = settings.State12_Time_l;
                StateTime[13] = settings.State13_Time_l;
                StateTime[14] = settings.State14_Time_l;
                StateTime[15] = settings.State15_Time_l;
                StateTime[16] = settings.State16_Time_l;
                StateTime[17] = settings.State4i_Time_l;
                StateTime[18] = settings.State14i_Time_l;
            }
            cm.Start();                         //接收信号线程启动
            isstart = false;
            timer1.Start();                     //屏幕刷新启动
            Hkey = new CHotkeyApp(this.Handle); //热键系统启动
            toolStripStatusLabel1.Text  = "状态:准备考试";
            this.pictureBoxTrace.Paint += new PaintEventHandler(myTrace.DrawTrace);
        }
예제 #12
0
 public CState12(CGanFairy[] ganc, CLineFairy[] xianc, CBmpFairy chec, ExamForm eform)
     : base(ganc, xianc, chec, eform)
 {
     stopmark = false;
 }