public carproperties(int acarnr, car acar, simulation asim) { InitializeComponent(); carnr = acarnr; sim = asim; thecar = acar; Text = String.Concat("Properties for car number: ", carnr.ToString()); string[] decisionarray = Enum.GetNames(typeof(decisiontype)); for (int i = 0; i < decisionarray.Length; i++) { listBox1.Items.Add(decisionarray[i]); } listBox1.SetSelected((int)thecar.decisiont, true); if (sim.buildings.Count > 0) { for (int i = 0; i < sim.buildings.Count; i++) { listBox2.Items.Add(i.ToString()); } listBox2.SetSelected(thecar.buildingfrom, true); for (int i = 0; i < sim.buildings.Count; i++) { listBox3.Items.Add(i.ToString()); } listBox3.SetSelected(thecar.buildingto, true); } numericUpDown1.Value = Convert.ToDecimal(Math.Round(thecar.speed * 3600)); }
public List <int> pointlist; //index numbers of the points that are part of this crossing. //Methods public crossingclean(point alocation, simulation asim) { location = alocation; sim = asim; nroads = global.CrossingNRoads; roadlist = new List <int>(); pointlist = new List <int>(); for (int i = 0; i < nroads + 1; i++) //the last point will be the middle of the crossing { pointlist.Add(sim.points.Count); sim.points.Add(new point(location.x, location.y)); } for (int i = 0; i < nroads; i++) { /*road(int anr, point^ p0, point^ p1, int anlanes, directionflowenum adirectionflow, * double aroadlanewidth);*/ roadlist.Add(sim.roads.Count); sim.roads.Add(new road(sim.roads.Count, sim.points[pointlist[i]], sim.points[pointlist[nroads]], 1, directionflowenum.Both, global.LaneWidth)); } positionelements(); }
public carinjectorproperties(int acarinjectornr, simulation asim) { InitializeComponent(); carinjectornr = acarinjectornr; thesim = asim; thecarinjector = thesim.carinjectors[carinjectornr]; textBox1.Text = thecarinjector.injectperiod.ToString("N"); }
public roadproperties(int aroadnr, simulation asim) { InitializeComponent(); sim = asim; roadnr = aroadnr; theroad = sim.roads[roadnr]; Text = String.Concat("Properties for road number: ", roadnr.ToString()); numericUpDown1.Value = Convert.ToDecimal(theroad.nlanes); label3.Text = Math.Round(theroad.direction * 180 / Math.PI, 2).ToString(); label5.Text = Math.Round(theroad.distance, 2).ToString(); }
public trafficlightproperties(int atrafficlightnr, simulation asim) { InitializeComponent(); sim = asim; trafficlightnr = atrafficlightnr; thetrafficlight = sim.trafficlights[trafficlightnr]; Text = String.Concat("Properties for trafficlight number: ", trafficlightnr.ToString()); numericUpDown1.Value = Convert.ToDecimal(Math.Round(thetrafficlight.timer)); numericUpDown2.Value = Convert.ToDecimal(Math.Round(thetrafficlight.greenlength)); numericUpDown3.Value = Convert.ToDecimal(Math.Round(thetrafficlight.yellowlength)); numericUpDown4.Value = Convert.ToDecimal(Math.Round(thetrafficlight.redlength)); }
List <int> pointlist; //index numbers of the points that are part of this circle. //Methods public circle(point alocation, int anroads, double aradius, simulation asim) { location = alocation; nroads = anroads; sim = asim; radius = aradius; roadlist = new List <int>(); pointlist = new List <int>(); for (int i = 0; i < nroads; i++) { pointlist.Add(sim.points.Count); sim.points.Add(new point(location.x, location.y)); } for (int i = 0; i < nroads; i++) { /*road(int anr, point^ p0, point^ p1, int anlanes, directionflowenum adirectionflow, * double aroadlanewidth);*/ roadlist.Add(sim.roads.Count); if (i == 0) { sim.roads.Add(new road(sim.roads.Count, sim.points[pointlist[nroads - 1]], sim.points[pointlist[i]], 1, directionflowenum.Direction01, global.LaneWidth)); } else { sim.roads.Add(new road(sim.roads.Count, sim.points[pointlist[i - 1]], sim.points[pointlist[i]], 1, directionflowenum.Direction01, global.LaneWidth)); } } positionroads(); /* * sim->roads->Add(gcnew road(sim->roads->Count, * dynamicpoint, * sim->points[sim->points->Count - 1], * Convert::ToInt32(numericUpDown1->Value), * Both, LaneWidth));*/ }
//Methods public crossingtrafficlight(point alocation, simulation asim) : base(alocation, asim) { trafficlightlist = new List <int>(); for (int i = 0; i < nroads; i++) { /*trafficlight(double aredlength, double ayellowlength, double agreenlength, * trafficlightcolour acolour, road^ aroadon, * double ax, double ay, int apointpointedto, double adt);*/ trafficlightlist.Add(sim.trafficlights.Count); sim.trafficlights.Add(new trafficlight(global.TrafficLightRedLength, global.TrafficLightYellowLength, global.TrafficLightGreenLength, i * (global.TrafficLightGreenLength + global.TrafficLightYellowLength + global.TrafficLightRedLength) / 4.0, sim.roads[roadlist[i]], sim.roads[roadlist[i]].points[1].x, sim.roads[roadlist[i]].points[1].y, 0, global.SampleT)); } }
public void setproperties(int acarnr, car acar, simulation asim) { carproperties carprop = new carproperties(acarnr, acar, asim); carprop.Show(); }