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 btnRecalc_Click(object sender, EventArgs e) { if (btnRecalc.Enabled) { btnRecalc.Enabled = false; try { double channel = Decimal.ToDouble(channelWide.Value); t = new Timer(); t.Tick += new EventHandler(t_Tick); t.Interval = 100; t.Start(); pc = new ParcourGenerator(); lock (activeParcour) { pc.RecalcParcour(activeParcour, c, channel); } PictureBox1.Invalidate(); } catch (Exception ex) { btnRecalc.Enabled = true; MessageBox.Show(ex.Message, "Error while generating Parcour"); } } }
private void btCurvas_Click(object sender, EventArgs e) { // Superficie de dibujo if (g == null) { g = ObtenerObjetoGraphics(); } // Crear lápices Pen lápizRojo = new Pen(Color.Red, 3); Pen lápizVerde = new Pen(Color.Green, 3); // Puntos que definen la curva flexible cardinal Point[] puntos = new Point[] { new Point(25, 25), new Point(50, 15), new Point(100, 5), new Point(120, 25), new Point(150, 50), new Point(220, 200), new Point(120, 120) }; // Dibujar líneas entre los puntos g.DrawLines(lápizRojo, puntos); // Dibujar la curva g.DrawCurve(lápizVerde, puntos); // Crear lápiz Pen lápizNegro = new Pen(Color.Black, 3); // Puntos que definen la curva flexible de Bézier Point p1 = new Point(30, 120); Point p2 = new Point(150, 200); Point c1 = new Point(75, 10); Point c2 = new Point(50, 210); // Dibujar la curva g.DrawBezier(lápizNegro, p1, c1, c2, p2); PictureBox1.Invalidate(); }
private void SetHoverLine(Line l) { bool change = hoverLine != l; if (change) { hoverLine = l; PictureBox1.SetHoverLine(l); PictureBox1.Invalidate(); if (selectedLine == null) { lineBox.Enabled = l != null; if (l != null) { numLatA.Value = (decimal)l.A.latitude; numLatB.Value = (decimal)l.B.latitude; numLatO.Value = (decimal)l.O.latitude; numLongA.Value = (decimal)l.A.longitude; numLongB.Value = (decimal)l.B.longitude; numLongO.Value = (decimal)l.O.longitude; fldLineTyp.Text = ((LineType)l.Type).ToString(); } else { numLatA.Value = 0; numLatB.Value = 0; numLatO.Value = 0; numLongA.Value = 0; numLongB.Value = 0; numLongO.Value = 0; fldLineTyp.Text = ""; } } } }
private void btnApply_Click(object sender, EventArgs e) { if (activeParcour != null && comboBoxPoint.SelectedItem != null) { if (activeParcour.Line.Count(p => p.Type == (int)comboBoxPoint.SelectedItem) == 1) { Line l = activeParcour.Line.First(p => p.Type == (int)comboBoxPoint.SelectedItem); Vector a = new Vector(l.A.longitude, l.A.latitude, 0); Vector b = new Vector(l.B.longitude, l.B.latitude, 0); Vector m = Vector.Middle(a, b); Vector neu = new Vector((double)manualPointLongitude.Value, (double)manualPointLatitude.Value, 0); Vector diff = neu - m; l.A.longitude += diff.X; l.A.latitude += diff.Y; l.O.longitude += diff.X; l.O.latitude += diff.Y; l.B.longitude += diff.X; l.B.latitude += diff.Y; List <PointTempExtension> connectedPoints = findConnectedPoints(activeParcour.Line, l.A, l); foreach (Point p in connectedPoints) { if (p != l.A && p != l.B && p != l.O) { p.longitude += diff.X; p.latitude += diff.Y; } } PictureBox1.Invalidate(); } } }
private void numLongO_ValueChanged(object sender, EventArgs e) { if (selectedLine != null) { (selectedLine.O as Point).longitude = Decimal.ToDouble(numLongO.Value); PictureBox1.Invalidate(); } }
private void PictureBox1_MouseUp(object sender, MouseEventArgs e) { botonPulsado = false; // Borrar el cursor Rectangle rect = new Rectangle(e.X, 0, 1, PictureBox1.Height); PictureBox1.Invalidate(rect); }
private void numLongA_ValueChanged(object sender, EventArgs e) { if (selectedPoint != null) { selectedPoint.longitude = Decimal.ToDouble(numLongA.Value); PictureBox1.Invalidate(); } }
//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(); }
private void btLimpiar_Click(object sender, EventArgs e) { // Limpiar la superficie de dibujo if (g == null) { g = ObtenerObjetoGraphics(); } g.Clear(Color.White); PictureBox1.Invalidate(); }
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 SetHoverPoint(PointTempExtension p, Line l) { bool change = hoverPoint != p; if (change) { hoverPoint = p; PictureBox1.SetHoverLine(l); PictureBox1.Invalidate(); } }
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 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 numericUpDownAlpha_ValueChanged(object sender, EventArgs e) { if (listBox1.SelectedItems.Count == 1) { ListItem li = listBox1.SelectedItems[0] as ListItem; ParcourSet p = li.getParcour(); p.Alpha = (int)numericUpDownAlpha.Value; Client.DBContext.SaveChanges(); PictureBox1.SetParcour(p); PictureBox1.Invalidate(); } }
private void btTarta_Click(object sender, EventArgs e) { if (g == null) { g = ObtenerObjetoGraphics(); } Pen lápiz = new Pen(Color.Black, 3); Rectangle rect = new Rectangle(10, 60, 230, 90); g.DrawPie(lápiz, rect, 30, 150); 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(); } }
private void props_propertiesChanged(propertiesChangedEventArgs e) { propertiesDictionary[e.propName] = e.newValue; if (propertiesDictionary["Общая прибыль"] != 0) { propertiesDictionary["Остаток"] = propertiesDictionary["Общая прибыль"] - propertiesDictionary.Values.Skip(1).Take(8).Sum(); } else { propertiesDictionary["Остаток"] = 0; } PictureBox1.Invalidate(); }
private void props_propertiesChanged(propertiesChangedEventArgs e) { propertiesDictionary[e.propName] = e.newValue; if (propertiesDictionary["Total Income"] != 0) { propertiesDictionary["Remaining"] = propertiesDictionary["Total Income"] - propertiesDictionary.Values.Skip(1).Take(8).Sum(); } else { propertiesDictionary["Remaining"] = 0; } PictureBox1.Invalidate(); }
private void PictureBox1_MouseMove(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { botonPulsado = true; // Coordenadas del cursor a dibujar x1 = e.X; y1 = 0; x2 = e.X; y2 = PictureBox1.Height; 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); } }
private void btTrazados_Click(object sender, EventArgs e) { if (g == null) { g = ObtenerObjetoGraphics(); } GraphicsPath trazado = new GraphicsPath(); Rectangle rect = new Rectangle(10, 10, 200, 100); trazado.AddArc(rect, 45, 135); trazado.AddLine(80, 100, 160, 200); trazado.CloseFigure(); g.DrawPath(Pens.Blue, trazado); PictureBox1.Invalidate(); }
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 btPoligonos_Click(object sender, EventArgs e) { if (g == null) { g = ObtenerObjetoGraphics(); } GraphicsPath trazado = new GraphicsPath(); Pen lápiz = new Pen(Color.Black, 3); PointF[] triángulo = new PointF[] { new Point(20, 80), new Point(110, 10), new Point(230, 90) }; g.DrawPolygon(lápiz, triángulo); PointF[] pentágono = new PointF[] { new Point(20, 150), new Point(130, 120), new Point(230, 155), new Point(190, 200), new Point(45, 195) }; g.DrawPolygon(lápiz, pentágono); 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 btLineasRect_Click(object sender, EventArgs e) { if (g == null) { g = ObtenerObjetoGraphics(); } Pen lápiz = new Pen(Color.Black, 3); g.DrawLine(lápiz, 10, 10, 240, 100); Rectangle rect = new Rectangle(10, 120, 230, 90); g.DrawRectangle(lápiz, rect); // Para superponer gráficos es necesario repintar 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; Client.DBContext.SaveChanges(); PictureBox1.ColorGates = cd.Color; PictureBox1.SetParcour(p); PictureBox1.Invalidate(); }
void t_Tick(object sender, EventArgs e) { try { PictureBox1.Invalidate(); if (pc.finished) { t.Stop(); btnRecalc.Enabled = true; } } catch { t.Stop(); btnRecalc.Enabled = true; } }
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); } }