private string GetPolygonKml(Parcour parcour) { 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 + "," + n.A.latitude + "," + HeightPenalty + " "; result += n.O.longitude + "," + n.O.latitude + "," + HeightPenalty + " "; result += n.B.longitude + "," + n.B.latitude + "," + HeightPenalty + " "; result += n.A.longitude + "," + n.A.latitude + "," + 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 + "," + n.B.latitude + "," + HeightPenalty + " "; result += n.A.longitude + "," + n.A.latitude + "," + HeightPenalty + " "; result += n.B.longitude + "," + n.B.latitude + "," + HeightPenalty + " "; result += @"</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>"; } result += GetKMLTemplateContent("footerPolygon"); return result; }
public ParcourGen(Client.DataAccess iClient) { Client = iClient; InitializeComponent(); PictureBox1.Cursor = new Cursor(@"Resources\GPSCursor.cur"); activeParcour = new Parcour(); PictureBox1.SetParcour(activeParcour); }
public ParcourEditSingle(Client.DataAccess iClient) { Client = iClient; InitializeComponent(); PictureBox1.Cursor = select; activeParcour = new Parcour(); PictureBox1.SetParcour(activeParcour); }
private void btnClear_Click(object sender, EventArgs e) { activeParcour = new Parcour(); PictureBox1.SetParcour(activeParcour); SetHoverLine(null); SetSelectedLine(null); fldName.Text = ""; PictureBox1.Invalidate(); }
public void SetParcour(Parcour 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 listBox1_SelectedIndexChanged(object sender, EventArgs e) { ListItem li = listBox1.SelectedItem as ListItem; if (li != null) { deleteToolStripMenuItem.Enabled = true; Map map = li.getParcour().Map; MemoryStream ms = new MemoryStream(map.Picture.Data); PictureBox1.Image = System.Drawing.Image.FromStream(ms); c = new Converter(map); PictureBox1.SetConverter(c); PictureBox1.SetParcour(li.getParcour()); activeParcour = li.getParcour(); PictureBox1.Invalidate(); } }
public ListItem(Parcour iparcour) { parcour = iparcour; }
private void loadMaps() { comboBoxParcours.Items.Clear(); List<Parcour> parcours = Client.SelectedCompetition.Parcour.ToList(); Parcour newParcour = new Parcour(); newParcour.Name = "New Parcour"; newParcour.Line.Clear(); newParcour.Line.Add(new Line()); comboBoxParcours.Items.Add(new ListItem(newParcour)); foreach (Parcour p in parcours) { if (p.Line.Count(pp => pp.Type == (int)LineType.START_B || pp.Type == (int)LineType.START_C || pp.Type == (int)LineType.START_D) == 0) { comboBoxParcours.Items.Add(new ListItem(p)); } } comboBoxMaps.Items.Clear(); List<Map> maps = Client.SelectedCompetition.Map.ToList(); foreach (Map m in maps) { comboBoxMaps.Items.Add(new ListItemMap(m)); } }
private static LineP getStartLine(Parcour parcour, NetworkObjects.Route type) { Line nl = null; try { switch (type) { case NetworkObjects.Route.A: { nl = parcour.Line.Single(p => p.Type == (int)LineType.START_A); break; } case NetworkObjects.Route.B: { nl = parcour.Line.Single(p => p.Type == (int)LineType.START_B); break; } case NetworkObjects.Route.C: { nl = parcour.Line.Single(p => p.Type == (int)LineType.START_C); break; } case NetworkObjects.Route.D: { nl = parcour.Line.Single(p => p.Type == (int)LineType.START_D); break; } } } catch { } LineP l=null; if (nl != null) { l = new LineP(); l.start = new Vector(nl.A.longitude, nl.A.latitude, 0); l.end = new Vector(nl.B.longitude, nl.B.latitude, 0); l.orientation = new Vector(nl.O.longitude, nl.O.latitude, 0); } return l; }
private void comboBoxMaps_SelectedIndexChanged(object sender, EventArgs e) { ListItemMap limm = comboBoxMaps.SelectedItem as ListItemMap; if (limm != null) { activeParcour = new Parcour(); CurrentMap = limm.getMap(); MemoryStream ms = new MemoryStream(CurrentMap.Picture.Data); PictureBox1.Image = System.Drawing.Image.FromStream(ms); c = new Converter(CurrentMap); PictureBox1.SetParcour(activeParcour); PictureBox1.SetConverter(c); } }
private void comboBoxParcours_SelectedIndexChanged(object sender, EventArgs e) { ListItem li = comboBoxParcours.SelectedItem as ListItem; if (li != null) { Parcour p = li.getParcour(); Map m = null; comboBoxMaps.SelectedItem = null; if (p.Map!=null) { m = p.Map; MemoryStream ms = new MemoryStream(m.Picture.Data); PictureBox1.Image = System.Drawing.Image.FromStream(ms); c = new Converter(m); PictureBox1.SetConverter(c); CurrentMap = m; foreach (Object lim in comboBoxMaps.Items) { ListItemMap limm = lim as ListItemMap; if (limm.getMap() == m) { comboBoxMaps.SelectedItem = lim; break; } } } else { p = new Parcour(); } 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); generatedParcour = activeParcour.Line.Count(pp => pp.Type == (int)LineType.Point) > 0; } }
public void SetParcour(Parcour iParcour) { Parcour = iParcour; Brush = new SolidBrush(Color.FromArgb((255*iParcour.Alpha)/100, 255, 0, 0)); }
private void btnSave_Click(object sender, EventArgs e) { if (CurrentMap == null) { MessageBox.Show("No Map selected", "Incomplete Data"); } else { Parcour p = new Parcour(); p.Name = fldName.Text; foreach(Line l in activeParcour.Line) { p.Line.Add(l); } p.Map = CurrentMap; p.Competition = Client.SelectedCompetition; Client.DBContext.ParcourSet.Add(p); Client.DBContext.SaveChanges(); MessageBox.Show("Successfully saved"); } }
private void loadParcours() { deleteToolStripMenuItem.Enabled = false; PictureBox1.SetConverter(c); PictureBox1.Image = null; activeParcour = new Parcour(); PictureBox1.SetParcour(activeParcour); PictureBox1.Invalidate(); listBox1.Items.Clear(); List<Parcour> parcours = Client.SelectedCompetition.Parcour.ToList(); foreach (Parcour p in parcours) { listBox1.Items.Add(new ListItem(p)); } }
public ParcourModel(Parcour 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); }
public Item(Parcour p) { this.p = p; }
private void comboBoxParcours_SelectedIndexChanged(object sender, EventArgs e) { ListItem li = comboBoxParcours.SelectedItem as ListItem; if (li != null) { Parcour p = li.getParcour(); Map m = p.Map; MemoryStream ms = new MemoryStream(m.Picture.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; } }
public ParcourModelSingle(Parcour 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); }
void ofd_FileOkWGSSwitched(object sender, CancelEventArgs e) { OpenFileDialog ofd = sender as OpenFileDialog; try { activeParcour = Importer.importFromDxfWGSSwitched(ofd.FileName); PictureBox1.SetParcour(activeParcour); PictureBox1.Invalidate(); PictureBox1.Refresh(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error while Parsing File"); } }
private void comboBoxMaps_SelectedIndexChanged(object sender, EventArgs e) { ListItem li = comboBoxMaps.SelectedItem as ListItem; if (li != null) { MemoryStream ms = new MemoryStream(li.getMap().Picture.Data); PictureBox1.Image = System.Drawing.Image.FromStream(ms); c = new Converter(li.getMap()); PictureBox1.SetConverter(c); activeParcour = new Parcour(); PictureBox1.SetParcour(activeParcour); SetHoverLine(null); SetSelectedLine(null); CurrentMap = li.getMap(); PictureBox1.Invalidate(); } }