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");
            }
        }
Example #2
0
        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;
            }
        }
Example #3
0
 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();
        }
 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 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 btnClear_Click(object sender, EventArgs e)
 {
     loadMaps();
     activeParcour = new ParcourSet();
     PictureBox1.SetParcour(activeParcour);
     SetHoverLine(null);
     SetSelectedLine(null);
     fldName.Text = "";
     PictureBox1.Invalidate();
     checkValidationErrors();
 }
 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 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 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 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 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();
        }
        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 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();
        }
        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 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 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 comboBoxMaps_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListItem li = comboBoxMaps.SelectedItem as ListItem;

            if (li != null)
            {
                MemoryStream ms = new MemoryStream(li.getMap().PictureSet.Data);
                PictureBox1.Image = System.Drawing.Image.FromStream(ms);
                c = new Converter(li.getMap());
                PictureBox1.SetConverter(c);
                activeParcour = new ParcourSet();
                PictureBox1.SetParcour(activeParcour);
                SetHoverLine(null);
                SetSelectedLine(null);
                CurrentMap = li.getMap();
                PictureBox1.Invalidate();
                checkValidationErrors();
            }
        }
        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();
            }
        }
        private void loadParcours()
        {
            lblCompetition.Text             = Client.SelectedCompetition.Name + " - parcours";
            deleteToolStripMenuItem.Enabled = false;
            PictureBox1.SetConverter(c);
            PictureBox1.Image = null;
            activeParcour     = new ParcourSet();
            PictureBox1.SetParcour(activeParcour);
            SetHoverLine(null);
            SetSelectedLine(null);
            PictureBox1.Invalidate();

            listBox1.Items.Clear();
            //CompetitionSet cs = Client.SelectedCompetition;
            //List<ParcourSet> ods = cs.ParcourSet.ToList<ParcourSet>();
            List <ParcourSet> parcours = Client.SelectedCompetition.ParcourSet.ToList <ParcourSet>();

            foreach (ParcourSet p in parcours)
            {
                listBox1.Items.Add(new ListItem(p));
            }
        }