Пример #1
0
        /// <summary>
        /// 启动仿真非单步执行
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void MenuBar_SimluateSustained_Click(object sender, System.EventArgs e)
        {
            //关闭路网编辑器,显示仿真窗口
            netbuilder.Visible           = false;
            SplitMain.Panel1.AutoScroll  = true;
            SimController.Canvas.Visible = true;
            SplitMain.Panel2Collapsed    = false;
            SplitMain.Panel2.Controls.Add(abc);

            abc.Dock            = DockStyle.Fill;
            abc.FormBorderStyle = FormBorderStyle.None;
            abc.Visible         = true;
            //this.ShowDebugMessage();
            //----------------------------------------------------
            //SimController.iRoadWidth = 20;
            SimController.iSimInterval = 100;
            ModelSetting.dRate         = 0.85;


            SimController.iSimInterval = 10;

            //打开仿真运行的按钮
            this.menuBarSimulateStart.Enabled = true;
            //-------------------------------------------------
            SimController.bIsExit        = false;
            menuBarConfigSimEnvr.Enabled = false;

            SimController.OnSimulateImpulse += SimController_OnSimulateImpulse;

            SimController.StartSimulate();

            menuBarSimulateStart.Enabled = false;
        }
Пример #2
0
        //This event fires when a menu item or toolbar button is clicked.  So if you added a button or menu
        //on the Initialize event, then this is where you would handle it.
        public void ItemClicked(string ItemName, ref bool Handled)
        {
            if (ItemName == this.strBTNRun)
            {
                //显示仿真窗口
                //scConvas.Show();
                this.convas.Show();
                // SimController.Run();
                SimController.StartSimulate();
                Handled             = true;
                TBTN_Config.Enabled = false;
                TBTN_Pause.Enabled  = true;

                TBTN_ChartMeanSpeed.Enabled = false;
                TBTN_ChartSpaceTime.Enabled = false;
                TBTN_ChartSpeedTime.Enabled = false;
                TBTN_ShowData.Enabled       = false;
            }

            if (ItemName == this.strBTNConfig)
            {
                TBTN_Run.Enabled   = true;
                TBTN_Pause.Enabled = true;
                this.convas        = this.mMapWin.UIPanel.CreatePanel("TranSimGIS", MapWindowDockStyle.Right);


                TrafficSim.SimConfig cs = new TrafficSim.SimConfig();
                if (cs.ShowDialog() == DialogResult.OK)
                {
//                    SimController.iMobileCount = cs.iCarCount;

//                    SimController.iSimInterval = cs.iSimSpeed;
//                    ModelSetting.dRate = cs.dRatio;
//                    ModelSetting. = cs.dRatio;
//.i = cs.iCellWidth;
                }
                cs.Dispose();


//                SimController.ConfigSimEnvironment(this.convas);
                TBTN_Config.Enabled = false;
                TBTN_Pause.Enabled  = true;

                Handled = true;
            }

            //暂停
            if (ItemName == this.strBTNPause)
            {
                //SimController.IsPause = true;
                SimController.bIsExit = true;

                TBTN_Run.Enabled = true;

                TBTN_ChartMeanSpeed.Enabled = true;
                TBTN_ChartSpaceTime.Enabled = true;
                TBTN_ChartSpeedTime.Enabled = true;
                TBTN_ShowData.Enabled       = true;

                TBTN_Config.Enabled = false;
                Handled             = true;
            }
            //平均速度
            if (ItemName == this.strBTNMeanSpeed)
            {
                MeanSpeed msc = new MeanSpeed();
                msc.Show();
                Handled = true;
            }
            //时间空间图
            if (ItemName == this.strBTNSpaceTime)
            {
                TimeSpace tsc = new TimeSpace();
                tsc.Show();
                Handled = true;
            }
            //速度时间图
            if (ItemName == this.strBTNSpeedTime)
            {
                SpeedTime st = new SpeedTime();
                st.Show();
                Handled = true;
            }

            //速度时间图
            if (ItemName == this.strBTNShowData)
            {
                DataOutputer dop = new DataOutputer();
                dop.Show();
                Handled = true;
            }
        }