const double GateOrientationArrowLength = 0.3; // gatewidth in NM, used when/if plotting the SP/FP orientation public void SetParcour(ParcourSet iParcour) { Parcour = iParcour; Brush = new SolidBrush(Color.FromArgb((255 * iParcour.Alpha) / 100, iParcour.ColorPROH)); PenGates.Width = (float)iParcour.PenWidthGates; PenGates.Color = iParcour.ColorGates; HasCircleOnGates = iParcour.HasCircleOnGates; ShowIntersectionCircle = Properties.Settings.Default.ShowIntersectionCircles; PenIntersection.Color = Properties.Settings.Default.IntersectionColor; PenIntersection.Width = (float)Properties.Settings.Default.IntersectionPenWidth; IntersectionCircleRadius = (float)Properties.Settings.Default.IntersectionCircleRadius; Color c = iParcour.ColorChannel; PenChannel.Color = iParcour.ColorChannel == Color.FromArgb(0, 0, 0, 0) ? Properties.Settings.Default.ChannelColor : iParcour.ColorChannel; PenChannel.Width = iParcour.PenWidthChannel == 0 ? (float)Properties.Settings.Default.ChannelPenWidth : (float)iParcour.PenWidthChannel; PenFlight.Width = (float)Properties.Settings.Default.FlightPenWidth; PenFlight.Color = Properties.Settings.Default.FlightPenColor; Pen.Width = (float)iParcour.PenWidthGates; Pen.Color = iParcour.ColorGates; ParcourT = Parcour.PenaltyCalcType; }
private string GetPolygonKml(ParcourSet parcour) { String result = ""; result += GetKMLTemplateContent("headerPolygon"); int i = 0; foreach (Line n in parcour.Line.Where(p => p.Type == (int)LineType.PENALTYZONE)) { // note: conversion to invariant format required (KML has always dot as decimal separator) result += @"<Placemark><name>Polygon" + i++ + @"</name><styleUrl>#sn_ylw-pushpin</styleUrl><Polygon><extrude>1</extrude><altitudeMode>relativeToGround</altitudeMode><outerBoundaryIs><LinearRing><coordinates>"; result += n.A.longitude.ToString(ci) + "," + n.A.latitude.ToString(ci) + "," + HeightPenalty + " "; result += n.O.longitude.ToString(ci) + "," + n.O.latitude.ToString(ci) + "," + HeightPenalty + " "; result += n.B.longitude.ToString(ci) + "," + n.B.latitude.ToString(ci) + "," + HeightPenalty + " "; result += n.A.longitude.ToString(ci) + "," + n.A.latitude.ToString(ci) + "," + HeightPenalty + " "; result += @"</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>"; } foreach (Line n in parcour.Line.Where(p => p.Type >= 3 && p.Type <= 10)) { // note: conversion to invariant format required (KML has always dot as decimal separator) result += @"<Placemark><name>Polygon" + i++ + @"</name><styleUrl>#sn_ylw-pushpin</styleUrl><Polygon><extrude>1</extrude><altitudeMode>relativeToGround</altitudeMode><outerBoundaryIs><LinearRing><coordinates>"; result += n.B.longitude.ToString(ci) + "," + n.B.latitude.ToString(ci) + "," + HeightPenalty + " "; result += n.A.longitude.ToString(ci) + "," + n.A.latitude.ToString(ci) + "," + HeightPenalty + " "; result += n.B.longitude.ToString(ci) + "," + n.B.latitude.ToString(ci) + "," + HeightPenalty + " "; result += @"</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>"; } result += GetKMLTemplateContent("footerPolygon"); return(result); }
void ofd_FileOkKMLLayer(object sender, CancelEventArgs e) { OpenFileDialog ofd = sender as OpenFileDialog; try { activeParcour = Importer.importFromKMLLayer(ofd.FileName); ParcourSet p = activeParcour; p.ColorPROH = Properties.Settings.Default.PROHColor; p.ColorGates = Properties.Settings.Default.SPFPColor; p.Alpha = (int)Properties.Settings.Default.PROHTransp; p.HasCircleOnGates = Properties.Settings.Default.SPFPCircle; PictureBox1.SetParcour(activeParcour); PictureBox1.Invalidate(); PictureBox1.Refresh(); fldName.Text = Path.GetFileNameWithoutExtension(ofd.FileName); } catch (ApplicationException ex1) { MessageBox.Show(ex1.Message, "Parcour import from *.kml", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error while Parsing File"); } }
private void comboBoxParcours_SelectedIndexChanged(object sender, EventArgs e) { ListItem li = comboBoxParcours.SelectedItem as ListItem; if (li != null) { ParcourSet p = li.getParcour(); MapSet m = p.MapSet; MemoryStream ms = new MemoryStream(m.PictureSet.Data); PictureBox1.Image = System.Drawing.Image.FromStream(ms); c = new Converter(m); PictureBox1.SetConverter(c); CurrentMap = m; List <Line> toDelete = p.Line.Where(pp => pp.Type == (int)LineType.START || pp.Type == (int)LineType.END).ToList(); foreach (Line l in toDelete) { p.Line.Remove(l); } activeParcour = p; PictureBox1.SetParcour(activeParcour); bool generatedParcour = activeParcour.Line.Count(pp => pp.Type == (int)LineType.Point) > 0; btnRecalc.Enabled = generatedParcour; chkAutocalc.Enabled = generatedParcour; chkAutocalc.Checked = generatedParcour; } }
private string GetPolygonKml(ParcourSet parcour) { // double values in XML use always dot as decimal separator // we must explicitly set the CultureInfo, otherwise this will work onkly for dot as decimal separator CultureInfo ci = CultureInfo.InvariantCulture; int HeightPenalty = (int)height.Value; String result = ""; result += GetKMLTemplateContent("headerPolygon"); int i = 0; foreach (Line n in parcour.Line.Where(p => p.Type == (int)LineType.PENALTYZONE)) { result += @"<Placemark><name>Polygon" + i++ + @"</name><styleUrl>#sn_ylw-pushpin</styleUrl><Polygon><extrude>1</extrude><altitudeMode>relativeToGround</altitudeMode><outerBoundaryIs><LinearRing><coordinates>"; result += n.A.longitude.ToString(ci) + "," + n.A.latitude.ToString(ci) + "," + HeightPenalty + " "; result += n.O.longitude.ToString(ci) + "," + n.O.latitude.ToString(ci) + "," + HeightPenalty + " "; result += n.B.longitude.ToString(ci) + "," + n.B.latitude.ToString(ci) + "," + HeightPenalty + " "; result += n.A.longitude.ToString(ci) + "," + n.A.latitude.ToString(ci) + "," + HeightPenalty + " "; result += @"</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>"; } foreach (Line n in parcour.Line.Where(p => p.Type >= 3 && p.Type <= 10)) { result += @"<Placemark><name>Polygon" + i++ + @"</name><styleUrl>#sn_ylw-pushpin</styleUrl><Polygon><extrude>1</extrude><altitudeMode>relativeToGround</altitudeMode><outerBoundaryIs><LinearRing><coordinates>"; result += n.B.longitude.ToString(ci) + "," + n.B.latitude.ToString(ci) + "," + HeightPenalty + " "; result += n.A.longitude.ToString(ci) + "," + n.A.latitude.ToString(ci) + "," + HeightPenalty + " "; result += n.B.longitude.ToString(ci) + "," + n.B.latitude.ToString(ci) + "," + HeightPenalty + " "; result += @"</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>"; } result += GetKMLTemplateContent("footerPolygon"); return(result); }
internal void RecalcParcour(ParcourSet parcour, Converter c, double channel) { this.parcour = parcour; this.c = c; this.regenerate = true; ParcourModel pm = new ParcourModel(parcour, c, EndLineDist, channel, true); List <List <ParcourModel> > modelList = new List <List <ParcourModel> >(); //System.Diagnostics.Process.GetCurrentProcess(). for (int i = 0; i < 1; i++) { List <ParcourModel> list = new List <ParcourModel>(); modelList.Add(list); list.Add(pm); for (int j = 0; j < 300; j++) { list.Add(new ParcourModel(pm, 1)); } } best = double.MaxValue; bestModel = null; foreach (List <ParcourModel> list in modelList) { Thread t = new Thread(new ParameterizedThreadStart(ProcessList)); t.Start(list); } }
public ParcourEdit(Client.DataAccess iClient) { Client = iClient; InitializeComponent(); PictureBox1.Cursor = select; activeParcour = new ParcourSet(); PictureBox1.SetParcour(activeParcour); }
//private void btnColorLayer_Click(object sender, EventArgs e) //{ // ColorDialog cd = new ColorDialog(); // cd.AnyColor = false; // cd.SolidColorOnly = true; // cd.ShowDialog(); // btnColorPROH.BackColor = cd.Color; // ParcourSet p = activeParcour; // PictureBox1.ColorPROH = cd.Color; // p.ColorPROH = cd.Color; // PictureBox1.SetParcour(p); // PictureBox1.Invalidate(); //} //private void btnColorPen_Click(object sender, EventArgs e) //{ // ColorDialog cd = new ColorDialog(); // cd.AnyColor = false; // cd.SolidColorOnly = true; // cd.ShowDialog(); // btnColorGates.BackColor = cd.Color; // ParcourSet p = activeParcour; // p.ColorGates = cd.Color; // PictureBox1.ColorGates = cd.Color; // PictureBox1.SetParcour(p); // PictureBox1.Invalidate(); //} private void checkBoxCircle_CheckedChanged(object sender, EventArgs e) { ParcourSet p = activeParcour; PictureBox1.HasCircleOnGates = checkBoxCircle.Checked; p.HasCircleOnGates = checkBoxCircle.Checked; PictureBox1.SetParcour(p); PictureBox1.Invalidate(); }
public ParcourModelSingle(ParcourSet parcour, Converter c, double channel, double channelLength, bool regenerate) { this.desiredLength = Converter.NMtoM(channelLength); this.channelWidth = Converter.NMtoM(channel); this.c = c; List <Line> lines = new List <Line>(parcour.Line); AddLineAsCorridor(c, lines.Single(p => p.Type == (int)LineType.START_A), lines.Single(p => p.Type == (int)LineType.END_A), lines, LineType.START_A); }
private void numericUpDownPen_ValueChanged(object sender, EventArgs e) { if (activeParcour != null) { ParcourSet p = activeParcour; PictureBox1.PenWidthGates = (float)numericUpDownPenGates.Value; PictureBox1.SetParcour(p); PictureBox1.Invalidate(); } }
private void btnClear_Click(object sender, EventArgs e) { loadMaps(); activeParcour = new ParcourSet(); PictureBox1.SetParcour(activeParcour); SetHoverLine(null); SetSelectedLine(null); fldName.Text = ""; PictureBox1.Invalidate(); checkValidationErrors(); }
private void numericUpDownChannelAlpha_ValueChanged(object sender, EventArgs e) { if (activeParcour != null) { ParcourSet p = activeParcour; //p. = (int)numericUpDownAlpha.Value; //PictureBox1.HasCircleOnGates = checkBoxCircle.Checked; PictureBox1.SetParcour(p); PictureBox1.Invalidate(); } }
private void numericUpDownChannelPen_ValueChanged(object sender, EventArgs e) { if (activeParcour != null) { ParcourSet p = activeParcour; // PictureBox1.PenWidthGates = (float)numericUpDownPenGates.Value; p.PenWidthChannel = numericUpDownChannelPen.Value; Client.DBContext.SaveChanges(); PictureBox1.SetParcour(p); PictureBox1.Invalidate(); } }
public ParcourModel(ParcourSet parcour, Converter c, double desiredLengthFactor, double channel, bool regenerate) { this.desiredLengthFactor = desiredLengthFactor; this.channel = Converter.NMtoM(channel); this.c = c; List <Line> lines = new List <Line>(parcour.Line); AddLineAsCorridor(c, lines.Single(p => p.Type == (int)LineType.START_A), lines.Single(p => p.Type == (int)LineType.END_A), lines, LineType.START_A); AddLineAsCorridor(c, lines.Single(p => p.Type == (int)LineType.START_B), lines.Single(p => p.Type == (int)LineType.END_B), lines, LineType.START_B); AddLineAsCorridor(c, lines.Single(p => p.Type == (int)LineType.START_C), lines.Single(p => p.Type == (int)LineType.END_C), lines, LineType.START_C); AddLineAsCorridor(c, lines.Single(p => p.Type == (int)LineType.START_D), lines.Single(p => p.Type == (int)LineType.END_D), lines, LineType.START_D); }
private void listBox1_AfterLabelEdit(object sender, LabelEditEventArgs e) { string newName = e.Label; if (newName != null && newName != "") { ListItem item = listBox1.Items[e.Item] as ListItem; ParcourSet p = item.getParcour(); p.Name = newName; Client.DBContext.SaveChanges(); } }
private void numericUpDownChannelAlpha_ValueChanged(object sender, EventArgs e) { if (listBox1.SelectedItems.Count == 1) { ListItem li = listBox1.SelectedItems[0] as ListItem; ParcourSet p = li.getParcour(); //p.ChannelAlpha = (int)numericUpDownChannelAlpha.Value; //Client.DBContext.SaveChanges(); //PictureBox1.SetParcour(p); //PictureBox1.Invalidate(); } }
private void numericUpDownPenWidthIntersect_ValueChanged(object sender, EventArgs e) { if (activeParcour != null) { ParcourSet p = activeParcour; //PictureBox1. = (float)numericUpDownIntersect.Value; p.PenWidthIntersection = numericUpDownPenWidthIntersect.Value; Client.DBContext.SaveChanges(); PictureBox1.SetParcour(p); PictureBox1.Invalidate(); } }
private void chkIntersectionPointsShow_CheckedChanged(object sender, EventArgs e) { ParcourSet p = activeParcour; if (activeParcour != null) { p.HasIntersectionCircles = chkIntersectionPointsShow.Checked; Client.DBContext.SaveChanges(); PictureBox1.SetParcour(p); PictureBox1.Invalidate(); // listBox1_SelectedIndexChanged(null, null); } }
public void SetParcour(ParcourSet parcour) { try { if (Container != null) { Container.replaceChild(plugin.parseKml(GetPolygonKml(parcour)), Container.getLastChild()); dynamic lookAt = plugin.createLookAt(""); lookAt.set(averageLatitude(parcour.Line), averageLongitude(parcour.Line), 15000, plugin.ALTITUDE_RELATIVE_TO_GROUND, 0, 0, 10000); plugin.getView().setAbstractView(lookAt); } } catch { } }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { if (listBox1.SelectedItems.Count == 1) { ListItem li = listBox1.SelectedItems[0] as ListItem; ParcourSet parcour = li.getParcour(); if (parcour.Id != 0) { Client.DBContext.ParcourSet.Remove(parcour); } Client.DBContext.SaveChanges(); loadParcours(); } }
bool showProh = false; //TODO public void SetParcour(ParcourSet iParcour) { Parcour = iParcour; Brush = new SolidBrush(Color.FromArgb(255 * iParcour.Alpha / 100, iParcour.ColorPROH)); UserPenGates.Width = (float)iParcour.PenWidthGates; UserPenGates.Color = iParcour.ColorGates; PenIntersection.Color = Properties.Settings.Default.IntersectionColor; PenIntersection.Width = (float)Properties.Settings.Default.IntersectionPenWidth; Pen.Width = (float)iParcour.PenWidthGates; Pen.Color = iParcour.ColorGates; HasCircleOnGates = iParcour.HasCircleOnGates; }
private void btnIntersectColor_Click(object sender, EventArgs e) { ColorDialog cd = new ColorDialog(); cd.AnyColor = false; cd.SolidColorOnly = true; cd.ShowDialog(); btnIntersectColor.BackColor = cd.Color; ParcourSet p = activeParcour; //PictureBox1.ColorPROH = cd.Color; p.ColorIntersection = cd.Color; PictureBox1.SetParcour(p); PictureBox1.Invalidate(); }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { ListItem li = listBox1.SelectedItem as ListItem; if (li != null) { ParcourSet p = li.getParcour(); if (p.Id != 0) { Client.DBContext.ParcourSet.Remove(p); } Client.DBContext.SaveChanges(); loadParcours(); } }
private void comboBoxQualificRound_SelectedIndexChanged(object sender, EventArgs e) { qualificRound = null; if (comboBoxQualificRound.SelectedItem != null) { ComboQRExtension cce = comboBoxQualificRound.SelectedItem as ComboQRExtension; if (cce != null) { qualificRound = cce.q; dataGridView2.Rows.Clear(); long min = long.MaxValue; long max = long.MinValue; List <FlightSet> CompetitionTeamList = qualificRound.FlightSet.ToList(); CompetitionTeamList.Sort((p, q) => p.StartID.CompareTo(q.StartID)); List <Point> points = new List <Point>(); foreach (FlightSet ct in qualificRound.FlightSet) { min = Math.Min(ct.TimeTakeOff, min); max = Math.Max(ct.TimeEndLine, max); DataGridViewRow dgvr = new DataGridViewRow(); dgvr.CreateCells(dataGridView2); dgvr.SetValues(new string[] { ct.StartID.ToString(), "0", getTeamDsc(ct), new DateTime(ct.TimeTakeOff).ToShortTimeString(), new DateTime(ct.TimeStartLine).ToShortTimeString(), new DateTime(ct.TimeEndLine).ToShortTimeString(), getRouteText(ct.Route) }); dataGridView2.Rows.Add(dgvr); dgvr.Tag = ct; } parcour = cce.q.ParcourSet; MapSet map = parcour.MapSet; MemoryStream ms = new MemoryStream(map.PictureSet.Data); visualisationPictureBox1.Image = System.Drawing.Image.FromStream(ms); visualisationPictureBox1.SetConverter(new Converter(map)); visualisationPictureBox1.SetParcour(parcour); visualisationPictureBox1.Invalidate(); visualisationPictureBox1.Refresh(); this.BeginInvoke(new MethodInvoker(updatePoints)); dataGridView2_SelectionChanged(sender, e); } else { dataGridView2.Rows.Clear(); } } else { dataGridView2.Rows.Clear(); } }
private void btnColorPen_Click(object sender, EventArgs e) { ColorDialog cd = new ColorDialog(); cd.AnyColor = false; cd.SolidColorOnly = true; cd.ShowDialog(); btnColorGates.BackColor = cd.Color; ParcourSet p = activeParcour; p.ColorGates = cd.Color; Client.DBContext.SaveChanges(); PictureBox1.ColorGates = cd.Color; PictureBox1.SetParcour(p); PictureBox1.Invalidate(); }
void ofd_FileOk(object sender, CancelEventArgs e) { OpenFileDialog ofd = sender as OpenFileDialog; try { activeParcour = Importer.importFromDxfCH(ofd.FileName); PictureBox1.SetParcour(activeParcour); PictureBox1.Invalidate(); fldName.Text = Path.GetFileNameWithoutExtension(ofd.FileName); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error while Parsing File"); } }
private void loadParcours() { deleteToolStripMenuItem.Enabled = false; PictureBox1.SetConverter(c); PictureBox1.Image = null; activeParcour = new ParcourSet(); PictureBox1.SetParcour(activeParcour); PictureBox1.Invalidate(); listBox1.Items.Clear(); List <ParcourSet> parcours = Client.SelectedCompetition.ParcourSet.ToList(); foreach (ParcourSet p in parcours) { listBox1.Items.Add(new ListItem(p)); } }
private void radioButtonParcourTypeChannel_CheckedChanged(object sender, EventArgs e) { radioButtonParcourTypePROH.Checked = !radioButtonParcourTypeChannel.Checked; layerBox.Visible = radioButtonParcourTypePROH.Checked; groupBoxChannel.Visible = radioButtonParcourTypeChannel.Checked; ParcourSet p = activeParcour; if (activeParcour != null) { p.PenaltyCalcType = radioButtonParcourTypePROH.Checked ? 0 : 1; // Client.DBContext.SaveChanges(); PictureBox1.SetParcour(p); PictureBox1.Invalidate(); // listBox1_SelectedIndexChanged(null, null); } }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (listBox1.SelectedItems.Count == 1) { ListItem li = listBox1.SelectedItems[0] as ListItem; activeParcour = li.getParcour(); deleteToolStripMenuItem.Enabled = true; MapSet map = li.getParcour().MapSet; MemoryStream ms = new MemoryStream(map.PictureSet.Data); PictureBox1.Image = System.Drawing.Image.FromStream(ms); c = new Converter(map); PictureBox1.SetConverter(c); //PictureBox1.Invalidate(); numericUpDownAlpha.Value = activeParcour.Alpha; btnColorGates.BackColor = activeParcour.ColorGates; btnColorPROH.BackColor = activeParcour.ColorPROH; checkBoxCircle.Checked = activeParcour.HasCircleOnGates; numericUpDownPenGates.Value = activeParcour.PenWidthGates; //PictureBox1.ColorGates = activeParcour.ColorGates; //PictureBox1.PenWidthGates = (float)activeParcour.PenWidthGates; PictureBox1.HasCircleOnGates = activeParcour.HasCircleOnGates; radioButtonParcourTypePROH.Checked = (activeParcour.PenaltyCalcType == 0) ? true : false; radioButtonParcourTypeChannel.Checked = (!radioButtonParcourTypePROH.Checked); btnChannelColor.BackColor = activeParcour.ColorChannel; btnChannelFillColor.BackColor = activeParcour.ColorChannelFill; numericUpDownChannelAlpha.Value = activeParcour.Alpha; numericUpDownChannelPen.Value = activeParcour.PenWidthChannel; chkIntersectionPointsShow.Checked = activeParcour.HasIntersectionCircles; btnIntersectColor.BackColor = activeParcour.ColorIntersection; numericUpDownIntersectionCircleRadius.Value = activeParcour.IntersectionCircleRadius; numericUpDownPenWidthIntersect.Value = activeParcour.PenWidthIntersection; PictureBox1.SetParcour(activeParcour); SetHoverLine(null); SetSelectedLine(null); PictureBox1.Invalidate(); } }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { ListItem li = listBox1.SelectedItem as ListItem; if (li != null) { deleteToolStripMenuItem.Enabled = true; MapSet map = li.getParcour().MapSet; MemoryStream ms = new MemoryStream(map.PictureSet.Data); PictureBox1.Image = System.Drawing.Image.FromStream(ms); c = new Converter(map); PictureBox1.SetConverter(c); PictureBox1.SetParcour(li.getParcour()); activeParcour = li.getParcour(); PictureBox1.Invalidate(); } }