Exemplo n.º 1
0
        public Simulation(MainForm mainform, int id)
        {
            buildinglist = new List<Building>();
            crossinglist = new List<Crossing>();
            FileName = string.Format("Simulation {0}", id);
            Id = id;
            this.mainform = mainform;
            manualresetevent = new ManualResetEvent(false);
            roadlist = new List<Road>();
            simulationthread = new Thread(simulate);
            spawnlanelist = new List<RoadLane>();
            timewatch = new TimeWatch();
            unspawnlanelist = new List<RoadLane>();
            vehiclefactory = new VehicleFactory();
            vehiclelist = new List<Vehicle>();
            buggedmap = false;

            makemenus();
            makemap();
            calculateborderpoints();

            foreach (Road road in roadlist)
            {
                spawnlanelist.AddRange(road.GetSpawnLanes());
                unspawnlanelist.AddRange(road.GetUnSpawnLanes());
            }

            matrixchanged(null, new EventArgs());
            subscribeeventhandlers();
            resetsimulation();

            simulationthread.Start();
            mainform.ExtendedStatusStrip.UpdateStatus("Simulation loaded.");
        }
Exemplo n.º 2
0
        public SimulationPanel(MainForm mainform)
        {
            DoubleBuffered = true;
            Draw = true;
            this.mainform = mainform;

            hscrollbar = new HScrollBar {Dock = DockStyle.Bottom, Enabled = false};
            hscrollbar.Scroll += hscroll;
            hscrollbar.Visible = true;

            vscrollbar = new VScrollBar {Dock = DockStyle.Right, Enabled = false};
            vscrollbar.Scroll += vscroll;
            vscrollbar.Visible = true;

            Controls.Add(hscrollbar);
            Controls.Add(vscrollbar);
        }
Exemplo n.º 3
0
        public StatisticsPanel(MainForm mainform)
        {
            BackColor = SystemColors.ControlLight;
            CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;
            CreateHandle();
            DoubleBuffered = true;
            this.mainform = mainform;
            Scroll += scroll;
            SizeChanged += sizechanged;
            textboxdictionary = new Dictionary<string, TextBox>();

            ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
            ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100));
            RowStyles.Add(new RowStyle(SizeType.Absolute, 50));

            ColumnCount = ColumnStyles.Count;
            RowCount = RowStyles.Count;

            makestatisticcontrols();
            totalcontrolheight = gettotalcontrolheight();
            vehiclecombobox.SelectedIndexChanged += selectedindexchanged;
        }
Exemplo n.º 4
0
        public ParameterPanel(MainForm mainform)
        {
            BackColor = SystemColors.ControlLight;
            CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;
            DoubleBuffered = true;
            this.mainform = mainform;
            Scroll += scroll;
            SizeChanged += sizechanged;

            ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
            ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100));
            ColumnCount = ColumnStyles.Count;

            RowStyles.Add(new RowStyle(SizeType.Absolute, 50));
            RowCount = RowStyles.Count;

            MatrixLock = new object();
            VehicleSetChanged += vehiclesetchanged;
            ViewChanged += UpdateMatrix;

            makeparametercontrols();

            totalcontrolheight = gettotalcontrolheight();
        }
Exemplo n.º 5
0
 public Simulation DeserializationRepopulation(MainForm mainform)
 {
     this.mainform = mainform;
     timewatch = new TimeWatch();
     font = new Font("Calibri", 2*ParameterPanel.Matrix.Elements[0]);
     manualresetevent = new ManualResetEvent(false);
     makemenus();
     calculateborderpoints();
     matrixchanged(null, new EventArgs());
     subscribeeventhandlers();
     resetsimulation();
     simulationthread = new Thread(simulate);
     simulationthread.Start();
     mainform.ExtendedStatusStrip.UpdateStatus("Simulation loaded.");
     return this;
 }