Esempio n. 1
0
        private void RapportView_Load(object sender, EventArgs e)
        {
            Repartiteur repart = Repartiteur.getEngine();
            List<Module> l_mod = new List<Module>();

            l_mod.Add(repart.ModEqu);
            l_mod.Add(repart.ModChange);
            l_mod.Add(repart.ModInt);
            l_mod.Add(repart.ModProp);
            l_mod.Add(repart.ModSpread);
            l_mod.Add(repart.ModConc);

            List<ScrTotal> l_scrtotal = new List<ScrTotal>();
            l_scrtotal.Add(Repartiteur.getEngine().ScrMarket());

            List<Courbe> l_courbe = new List<Courbe>();
            foreach (Tuple<double, double, double, double> point in DataConfig.getDataConfig().L_PointsCourbe)
            {
                Courbe c = new Courbe(point.Item1, point.Item2, point.Item3, point.Item4);
                l_courbe.Add(c);
            }

            EquityBindingSource.DataSource = Engine.getEngine().Portfolio;
            ModuleBindingSource.DataSource = l_mod;
            ScrTotalBindingSource.DataSource = l_scrtotal;
            SwapBindingSource.DataSource = l_courbe;

            this.reportViewer1.RefreshReport();
        }
Esempio n. 2
0
    public override void OnInspectorGUI()
    {
        pteroRotation = target as PteroRotation;

        pteroRotation.Update(ref pteroRotation.ptero, "Ptero");
        pteroRotation.Update(ref pteroRotation.speedPtero, "Speed Ptero");
        pteroRotation.Update(ref pteroRotation.distance, "Distance");
        pteroRotation.Update(ref pteroRotation.penchement, "Penchement");

        EditorGUILayout.BeginVertical("Box");

        EditorGUI.BeginChangeCheck();
        Courbe courbe = (Courbe)EditorGUILayout.EnumPopup("Courbe", pteroRotation.courbe);

        if (EditorGUI.EndChangeCheck())
        {
            pteroRotation.Record("Courbe");
            pteroRotation.courbe = courbe;
        }
        if (courbe != Courbe.Bernouilli && courbe != Courbe.Circle)
        {
            pteroRotation.Update(ref pteroRotation.bigR, "Grand Rayon");
            if (pteroRotation.bigR <= 0f)
            {
                pteroRotation.bigR = 0.1f;
            }
            pteroRotation.Update(ref pteroRotation.littleR, "Petit Rayon", 0f, pteroRotation.bigR);
        }

        EditorGUILayout.EndVertical();
    }
Esempio n. 3
0
        public void StatAnnee()
        {
            StatAnnee statAnnee = new StatAnnee(Variable, Wilaya);

            if (statAnnee.Tableau == null || statAnnee.Tableau.Count < 1)
            {
                MessageBoxAlert.Show("Manque des données", "Il y'a un manque de donnée dans cette wilaya!");
            }
            else
            {
                UserDate.DisplayDateStart = statAnnee.startDate;
                UserDate.DisplayDateEnd   = statAnnee.endDate;
                for (int i = statAnnee.startDate.Year; i <= statAnnee.endDate.Year; i++)
                {
                    System.Windows.Controls.Button bnYear = new System.Windows.Controls.Button {
                        Margin = new Thickness(3, 0, 3, 3), Style = this.FindResource("AccentedSquareButtonStyle") as System.Windows.Style, Content = i.ToString()
                    };
                    bnYear.Click += BnYear_Click;
                    wrapYear.Children.Add(bnYear);
                }
                if (Variable != 1)
                {
                    Diagramme diagramme = new Diagramme(statAnnee.Tableau)
                    {
                        Height = 300, Width = 650
                    };
                    Courbe courbe = new Courbe(statAnnee.Tableau)
                    {
                        Height = 300, Width = 650
                    };
                    TabViewAD.Content = diagramme;
                    TabViewAC.Content = courbe;
                    Moy.Text          = ((int)statAnnee.moyenne).ToString() + " " + UniteMesure;
                    Record2.Text      = "Max  " + statAnnee.Max.Item4 + " " + UniteMesure;
                    Record1.Text      = "Min  " + statAnnee.Min.Item4 + " " + UniteMesure;
                }
                else
                {
                    StatAnnee    statAnnee1 = new StatAnnee(2, Wilaya);
                    Doublecourbe courbe     = new Doublecourbe(statAnnee.Tableau, statAnnee1.Tableau)
                    {
                        Height = 300, Width = 650
                    };
                    TabViewAC.Content = courbe;
                    Moy.Text          = ((int)((statAnnee.moyenne + statAnnee1.moyenne) / 2)).ToString() + " " + UniteMesure;
                    Record2.Text      = "Max  " + statAnnee1.Max.Item4 + " " + UniteMesure + "       " + statAnnee1.Max.Item3 + " " + (Month)(statAnnee1.Max.Item2 - 1) + " " + statAnnee1.Max.Item1;
                    Record1.Text      = "Min  " + statAnnee.Min.Item4 + " " + UniteMesure + "       " + statAnnee.Min.Item3 + " " + (Month)(statAnnee.Min.Item2 - 1) + " " + statAnnee.Min.Item1;
                }
            }
        }
Esempio n. 4
0
        public void StatJour()
        {
            StatJour statJour = new StatJour(Variable, Wilaya, AnneeJour, Mois);

            if (statJour.Tableau == null || statJour.Tableau.Count < 1)
            {
                MessageBoxAlert.Show("Manque des données", "Il y'a un manque de donnée dans ce mois!");
            }
            else
            {
                if (Variable != 1)
                {
                    Diagramme diagramme = new Diagramme(statJour.Tableau)
                    {
                        Height = 300, Width = 650
                    };
                    Courbe courbe = new Courbe(statJour.Tableau)
                    {
                        Height = 300, Width = 650
                    };
                    TabViewJD.Content = diagramme;
                    TabViewJC.Content = courbe;
                    Record2J.Text     = "Max  " + statJour.Max.Item2 + " " + UniteMesure;
                    Record1J.Text     = "Min  " + statJour.Min.Item2 + " " + UniteMesure;
                }
                else
                {
                    StatJour     statJour1 = new StatJour(2, Wilaya, AnneeJour, Mois);
                    Doublecourbe courbe    = new Doublecourbe(statJour.Tableau, statJour1.Tableau)
                    {
                        Height = 300, Width = 650
                    };
                    TabViewJC.Content = courbe;
                    Record2J.Text     = "Max  " + statJour1.Max.Item2 + " " + UniteMesure + "       " + AnneeJour + " " + (Month)(Mois - 1) + " " + statJour1.Max.Item1;
                    Record1J.Text     = "Min  " + statJour.Min.Item2 + " " + UniteMesure + "       " + AnneeJour + " " + (Month)(Mois - 1) + " " + statJour.Min.Item1;
                }

                Grid3text.Text = (Month)(Mois - 1) + "," + AnneeJour;
                Btn3text.Text  = (Month)(Mois - 1) + "," + AnneeJour;
            }
        }
Esempio n. 5
0
        public void StatMois()
        {
            StatMois statMois = new StatMois(Variable, Wilaya, AnneeMon);

            if (statMois.Tableau == null || statMois.Tableau.Count < 1)
            {
                MessageBoxAlert.Show("Manque des données", "Il y'a un manque de donnée dans cet année!");
            }
            else
            {
                if (Variable != 1)
                {
                    Diagramme diagramme = new Diagramme(statMois.Tableau)
                    {
                        Height = 300, Width = 650
                    };
                    Courbe courbe = new Courbe(statMois.Tableau)
                    {
                        Height = 300, Width = 650
                    };
                    TabViewMD.Content = diagramme;
                    TabViewMC.Content = courbe;
                    Record2M.Text     = "Max  " + statMois.Max.Item3 + " " + UniteMesure;
                    Record1M.Text     = "Min  " + statMois.Min.Item3 + " " + UniteMesure;
                }
                else
                {
                    StatMois     statMois1 = new StatMois(2, Wilaya, AnneeMon);
                    Doublecourbe courbe    = new Doublecourbe(statMois.Tableau, statMois1.Tableau)
                    {
                        Height = 300, Width = 650
                    };
                    TabViewMC.Content = courbe;
                    Record2M.Text     = "Max  " + statMois1.Max.Item3 + " " + UniteMesure + "       " + AnneeMon + " " + (Month)(statMois1.Max.Item2 - 1) + " " + statMois1.Max.Item1;
                    Record1M.Text     = "Min  " + statMois.Min.Item3 + " " + UniteMesure + "       " + AnneeMon + " " + (Month)(statMois.Min.Item2 - 1) + " " + statMois.Min.Item1;
                }
                Grid2text.Text   = AnneeMon + "";
                Bouton2text.Text = AnneeMon + "";
            }
        }
 public void recuperation(List <Courbe> courbes)
 {
     for (int j = 0; j < courbes.Count(); j++)
     {
         Point  mousePoint  = new Point();
         Point  mousePoint1 = new Point();
         Courbe c           = new Courbe();
         c = courbes[j];
         double altit   = c.getaltitude();
         int    nbpoint = 0;
         mousePoint1 = c.getpoints(nbpoint);
         nbpoint++;
         Ellipse ell = new Ellipse();
         ell.Width  = 7;
         ell.Height = 7;
         ell.Fill   = Brushes.SkyBlue;
         ell.Stroke = Brushes.Transparent;
         Canvas.SetLeft(ell, mousePoint1.X - 5 / 2);
         Canvas.SetTop(ell, mousePoint1.Y - 10 / 2);
         cnv2.Children.Add(ell);
         this.InvalidateVisual();
         while (nbpoint < c.nbPoints())
         {
             String ag          = mousePoint1.X.ToString();
             Point  mousePoint2 = c.getpoints(nbpoint);
             Line   newLine     = new Line {
                 X1 = mousePoint1.X, Y1 = mousePoint1.Y, X2 = mousePoint2.X, Y2 = mousePoint2.Y
             };
             ToolTip t = new ToolTip();
             t.Content       = c.getaltitude();
             t.Background    = Brushes.AliceBlue;
             newLine.ToolTip = t;
             if ((altit <= 0))
             {
                 newLine.Stroke = Brushes.Blue;
             }
             if ((altit > 0) && (altit <= 50))
             {
                 newLine.Stroke = Brushes.SkyBlue;
             }
             if ((altit > 50) && (altit <= 100))
             {
                 newLine.Stroke = Brushes.AliceBlue;
             }
             if ((altit > 100) && (altit <= 200))
             {
                 newLine.Stroke = Brushes.Green;
             }
             if ((altit > 200) && (altit <= 400))
             {
                 newLine.Stroke = Brushes.GreenYellow;
             }
             if ((altit > 400) && (altit <= 600))
             {
                 newLine.Stroke = Brushes.Yellow;
             }
             if ((altit > 600) && (altit <= 800))
             {
                 newLine.Stroke = Brushes.Orange;
             }
             if ((altit > 800) && (altit <= 1000))
             {
                 newLine.Stroke = Brushes.OrangeRed;
             }
             if (altit > 1000)
             {
                 newLine.Stroke = Brushes.Red;
             }
             newLine.StrokeThickness = 2;
             cnv2.Children.Add(newLine);
             this.InvalidateVisual();
             mousePoint1 = mousePoint2;
             nbpoint++;
             Ellipse ell2 = new Ellipse();
             ell2.Width  = 7;
             ell2.Height = 7;
             ell2.Fill   = Brushes.SkyBlue;
             ell2.Stroke = Brushes.Transparent;
             Canvas.SetLeft(ell2, mousePoint1.X - 5 / 2);
             Canvas.SetTop(ell2, mousePoint1.Y - 10 / 2);
             cnv2.Children.Add(ell2);
         }
         this.InvalidateVisual();
     }
 }
Esempio n. 7
0
        //----------------------------------------------------------------------------------------------------------
        private void next_Click(object sender, RoutedEventArgs e)
        {
            List <Point> Points1 = new List <Point>();

            cnx.Open();
            string     readString3  = "select * from Trace  where nom ='" + nomtr + "'";
            SqlCommand readCommand3 = new SqlCommand(readString3, cnx);
            int        nbs          = 1000;

            using (SqlDataReader dataRead3 = readCommand3.ExecuteReader())
            {
                if (dataRead3 != null)
                {
                    while (dataRead3.Read())
                    {
                        string xas = dataRead3["Id"].ToString();
                        nbs = int.Parse(xas);
                    }
                }
            }
            cnx.Close();
            cnx.Open();
            string        readString  = "select * from Point  where  Id =" + nbs;
            SqlCommand    readCommand = new SqlCommand(readString, cnx);
            List <Courbe> courbes12   = new List <Courbe>();
            double        cris1p      = 0;
            int           ik10        = 0;
            double        alts1p      = 0;
            Courbe        fg          = new Courbe();

            using (SqlDataReader dataRead = readCommand.ExecuteReader())
            {
                if (dataRead != null)
                {
                    while (dataRead.Read())
                    {
                        string xs    = dataRead["x"].ToString();
                        string ys    = dataRead["y"].ToString();
                        string alts  = dataRead["altitude"].ToString();
                        string cris  = dataRead["critere"].ToString();
                        double xs1   = (double)int.Parse(xs);
                        double ys1   = (double)int.Parse(ys);
                        double alts1 = Double.Parse(alts);
                        double cris1 = (double)int.Parse(cris);
                        if (cris1 == cris1p)
                        {
                            Point ab = new Point(xs1, ys1);
                            fg.setpoints(ab, ik10);
                            ik10++;
                        }
                        else
                        {
                            fg.setaltitude(alts1p);
                            courbes12.Add(fg);
                            fg   = new Courbe();
                            ik10 = 0;
                            Point ab = new Point(xs1, ys1);
                            fg.setpoints(ab, ik10);
                            ik10++;
                        }
                        cris1p = cris1;
                        alts1p = alts1;
                    }
                }
                fg.setaltitude(alts1p);
                courbes12.Add(fg);
            }
            cnx.Close();
            for (int ml = 0; ml < courbes12.Count(); ml++)
            {
                Courbe pap = new Courbe();
                pap = courbes12[ml];
                for (int dml = 0; dml < pap.nbPoints(); dml++)
                {
                    double jaj = pap.getpoints(dml).X;
                    string dak = jaj.ToString();
                }
            }
            trace_apres_recup imp = new trace_apres_recup(kak, courbes12, nbs);
            var parent            = (Grid)this.Parent;

            parent.Children.Clear();
            parent.Children.Add(imp);
        }
Esempio n. 8
0
        //------------------------------------------------------------------------------------------------------
        private void cnv_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                int    ok = 0; int cpt = 5; int trouve = 0; int l = 0;
                Courbe c1 = courbes[0];
                while ((ok == 0) && (l < courbes.Count))
                {
                    trouve = 0;
                    while ((ok == 0) && (trouve < courbes[l].nbPoints()))
                    {
                        if ((courbes[l].getpoints(trouve).X - cpt <= e.GetPosition(this).X) && (e.GetPosition(this).X <= courbes[l].getpoints(trouve).X + cpt) && (courbes[l].getpoints(trouve).Y - cpt <= e.GetPosition(this).Y) && (e.GetPosition(this).Y <= courbes[l].getpoints(trouve).Y + cpt))
                        {
                            ok = 1;
                        }
                        else
                        {
                            trouve++;
                        }
                    }
                    l++;
                }
                l = l - 1;
                if (ok == 1)
                {
                    Console.WriteLine(courbes[l].getpoints(trouve).X + " " + courbes[l].getpoints(trouve).Y);
                    dep = true;
                    cnv.Children.Remove(courbes[l].getshownPts(trouve));
                    base.OnMouseDoubleClick(e);
                    Point   p   = e.GetPosition(this);
                    Ellipse ell = new Ellipse();
                    ell.Width  = 7;
                    ell.Height = 7;
                    ell.Fill   = Brushes.SkyBlue;
                    ell.Stroke = Brushes.Transparent;
                    courbes[l].setpoints(p, trouve);
                    Canvas.SetLeft(ell, courbes[l].getpoints(trouve).X - 5 / 2);
                    Canvas.SetTop(ell, courbes[l].getpoints(trouve).Y - 10 / 2);
                    courbes[l].setshownPts(ell, trouve);
                    cnv.Children.Add(ell);
                    if (trouve > 0)
                    {
                        cnv.Children.Remove(courbes[l].getlignes(trouve - 1));
                    }
                    Line newLine, line;
                    if (((trouve - 1) >= 0) && ((trouve) < courbes[l].nbPoints()))
                    {
                        cnv.Children.Remove(courbes[l].getlignes(trouve - 1));
                        newLine = new Line {
                            X1 = courbes[l].getpoints(trouve - 1).X, Y1 = courbes[l].getpoints(trouve - 1).Y, X2 = p.X, Y2 = p.Y
                        };
                        if ((courbes[l].getaltitude() <= 0))
                        {
                            newLine.Stroke = Brushes.Blue;
                        }
                        if ((courbes[l].getaltitude() > 0) && (courbes[l].getaltitude() <= 50))
                        {
                            newLine.Stroke = Brushes.SkyBlue;
                        }
                        if ((courbes[l].getaltitude() > 50) && (courbes[l].getaltitude() <= 100))
                        {
                            newLine.Stroke = Brushes.AliceBlue;
                        }
                        if ((courbes[l].getaltitude() > 100) && (courbes[l].getaltitude() <= 200))
                        {
                            newLine.Stroke = Brushes.Green;
                        }
                        if ((courbes[l].getaltitude() > 200) && (courbes[l].getaltitude() <= 400))
                        {
                            newLine.Stroke = Brushes.GreenYellow;
                        }
                        if ((courbes[l].getaltitude() > 400) && (courbes[l].getaltitude() <= 600))
                        {
                            newLine.Stroke = Brushes.Yellow;
                        }
                        if ((courbes[l].getaltitude() > 600) && (courbes[l].getaltitude() <= 800))
                        {
                            newLine.Stroke = Brushes.Orange;
                        }
                        if ((courbes[l].getaltitude() > 800) && (courbes[l].getaltitude() <= 1000))
                        {
                            newLine.Stroke = Brushes.OrangeRed;
                        }
                        if (courbes[l].getaltitude() > 1000)
                        {
                            newLine.Stroke = Brushes.Red;
                        }

                        newLine.StrokeThickness = 2;
                        cnv.Children.Add(newLine);
                        courbes[l].setlignes(newLine, trouve - 1);
                    }
                    if ((trouve + 1) < courbes[l].nbPoints())
                    {
                        line = new Line {
                            X1 = courbes[l].getpoints(trouve + 1).X, Y1 = courbes[l].getpoints(trouve + 1).Y, X2 = p.X, Y2 = p.Y
                        };
                        cnv.Children.Remove(courbes[l].getlignes(trouve));
                        if ((courbes[l].getaltitude() <= 0))
                        {
                            line.Stroke = Brushes.Blue;
                        }
                        if ((courbes[l].getaltitude() > 0) && (courbes[l].getaltitude() <= 50))
                        {
                            line.Stroke = Brushes.SkyBlue;
                        }
                        if ((courbes[l].getaltitude() > 50) && (courbes[l].getaltitude() <= 100))
                        {
                            line.Stroke = Brushes.AliceBlue;
                        }
                        if ((courbes[l].getaltitude() > 100) && (courbes[l].getaltitude() <= 200))
                        {
                            line.Stroke = Brushes.Green;
                        }
                        if ((courbes[l].getaltitude() > 200) && (courbes[l].getaltitude() <= 400))
                        {
                            line.Stroke = Brushes.GreenYellow;
                        }
                        if ((courbes[l].getaltitude() > 400) && (courbes[l].getaltitude() <= 600))
                        {
                            line.Stroke = Brushes.Yellow;
                        }
                        if ((courbes[l].getaltitude() > 600) && (courbes[l].getaltitude() <= 800))
                        {
                            line.Stroke = Brushes.Orange;
                        }
                        if ((courbes[l].getaltitude() > 800) && (courbes[l].getaltitude() <= 1000))
                        {
                            line.Stroke = Brushes.OrangeRed;
                        }
                        if (courbes[l].getaltitude() > 1000)
                        {
                            line.Stroke = Brushes.Red;
                        }
                        line.StrokeThickness = 2;
                        cnv.Children.Add(line);
                        courbes[l].setlignes(line, trouve);
                    }
                    if (k == 1)
                    {
                        this.lineStarted = false; k = 0;
                    }
                }
                this.InvalidateVisual();
            }
            catch (Exception exp) { MessageBox.Show("Veuillez dessiner au moins une ligne afin de pouvoir modifier des points ", "Erreur"); }
        }
Esempio n. 9
0
        private void next_Click(object sender, RoutedEventArgs e)
        {
            cnx.Open();
            String     date          = DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss");
            string     readString35  = "UPDATE Trace SET  modification='" + date + "' where Id =" + mika;
            SqlCommand readCommand35 = new SqlCommand(readString35, cnx);

            readCommand35.ExecuteNonQuery();
            cnx.Close();
            List <Point> Points1 = new List <Point>();
            int          cr = 0, jk1 = 0;
            int          ik4 = -1, ik3;

            cnx.Open();
            string     readString3  = " DELETE FROM Point  WHERE Id =" + mika;
            SqlCommand readCommand3 = new SqlCommand(readString3, cnx);

            readCommand3.ExecuteNonQuery();
            int nbs = 1000;

            cnx.Close();
            for (int ik = 0; ik < courbes.Count; ik++)
            {
                int jk = 0;
                for (int ik2 = 0; ik2 < courbes[ik].nbPoints(); ik2++)
                {
                    Points1.Add(courbes[ik].getpoints(ik2));
                }
                double ab  = courbes[ik].getaltitude();
                String ab1 = ab.ToString();
                for (ik3 = ik4 + 1; ik3 < (ik4 + 1 + courbes[ik].nbPoints()); ik3++)
                {
                    double a;
                    double b;
                    a = Points1[ik3].X;
                    b = Points1[ik3].Y;
                    cnx.Open();
                    SqlCommand cmd = cnx.CreateCommand();
                    cmd.CommandType = CommandType.Text;
                    int a1 = (int)a;
                    int b1 = (int)b;
                    cmd.CommandText = "insert into [Point] (x,y,altitude,critere,Id) values ('" + a1 + "','" + b1 + "','" + ab1 + "','" + cr + "','" + mika + "')";
                    cmd.ExecuteNonQuery();
                    cnx.Close();
                    jk1 = ik3;
                }
                ik4 = jk1;
                cr++;
            }
            Ss = 1;
            cnx.Open();
            string        readString  = "select * from Point  where  Id =" + mika;
            SqlCommand    readCommand = new SqlCommand(readString, cnx);
            List <Courbe> courbes12   = new List <Courbe>();
            double        cris1p      = 0;
            int           ik10        = 0;
            double        alts1p      = 0;
            Courbe        fg          = new Courbe();

            using (SqlDataReader dataRead = readCommand.ExecuteReader())
            {
                if (dataRead != null)
                {
                    while (dataRead.Read())
                    {
                        string xs    = dataRead["x"].ToString();
                        string ys    = dataRead["y"].ToString();
                        string alts  = dataRead["altitude"].ToString();
                        string cris  = dataRead["critere"].ToString();
                        double xs1   = (double)int.Parse(xs);
                        double ys1   = (double)int.Parse(ys);
                        double alts1 = Double.Parse(alts);
                        double cris1 = (double)int.Parse(cris);
                        if (cris1 == cris1p)
                        {
                            Point ab = new Point(xs1, ys1);
                            fg.setpoints(ab, ik10);
                            ik10++;
                        }
                        else
                        {
                            fg.setaltitude(alts1p);
                            courbes12.Add(fg);
                            fg   = new Courbe();
                            ik10 = 0;
                            Point ab = new Point(xs1, ys1);
                            fg.setpoints(ab, ik10);
                            ik10++;
                        }
                        cris1p = cris1;
                        alts1p = alts1;
                    }
                }
                fg.setaltitude(alts1p);
                courbes12.Add(fg);
            }
            cnx.Close();
            tracesegment imp    = new tracesegment(kak, courbes12, mika);
            var          parent = (Grid)this.Parent;

            parent.Children.Clear();
            parent.Children.Add(imp);
        }
Esempio n. 10
0
        private void cnv_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (Ss == 0)
            {
                if (suppp == 1)
                {
                    suppp = 0;
                    sup   = 1;
                    int trouve = 0, l = 0;
                    int ok  = 0;
                    int cpt = 10;
                    while ((ok == 0) && (l < courbes.Count))
                    {
                        trouve = 0;
                        while ((ok == 0) && (trouve < courbes[l].nbPoints()))
                        {
                            if ((courbes[l].getpoints(trouve).X - cpt <= e.GetPosition(this).X) &&
                                (e.GetPosition(this).X <= courbes[l].getpoints(trouve).X + cpt) &&
                                (courbes[l].getpoints(trouve).Y - cpt <= e.GetPosition(this).Y) &&
                                (e.GetPosition(this).Y <= courbes[l].getpoints(trouve).Y + cpt))
                            {
                                ok = 1;
                            }
                            else
                            {
                                trouve++;
                            }
                        }
                        l++;
                    }
                    l = l - 1;
                    cnv.Children.Remove(courbes[l].getshownPts(trouve));
                    try { shownPts.Remove(shownPts[trouve]); } catch (Exception exp) { }
                    courbes[l].removeshownPts(courbes[l].getshownPts(trouve));
                    if (trouve > 0)
                    {
                        cnv.Children.Remove(courbes[l].getlignes(trouve - 1)); courbes[l].removeligne(courbes[l].getlignes(trouve - 1));
                    }
                    Line newLine;
                    if (trouve == 0)
                    {
                        cnv.Children.Remove(courbes[l].getlignes(trouve));
                        courbes[l].removeligne(courbes[l].getlignes(trouve));
                    }
                    if (((trouve - 1) >= 0) && ((trouve + 1) < courbes[l].nbPoints()))
                    {
                        cnv.Children.Remove(courbes[l].getlignes(trouve - 1));
                        newLine = new Line
                        {
                            X1 = courbes[l].getpoints(trouve - 1).X,
                            Y1 = courbes[l].getpoints(trouve - 1).Y,
                            X2 = courbes[l].getpoints(trouve + 1).X,
                            Y2 = courbes[l].getpoints(trouve + 1).Y
                        };
                        if ((courbes[l].getaltitude() <= 0))
                        {
                            newLine.Stroke = Brushes.Blue;
                        }
                        if ((courbes[l].getaltitude() > 0) && (courbes[l].getaltitude() <= 50))
                        {
                            newLine.Stroke = Brushes.SkyBlue;
                        }
                        if ((courbes[l].getaltitude() > 50) && (courbes[l].getaltitude() <= 100))
                        {
                            newLine.Stroke = Brushes.AliceBlue;
                        }
                        if ((courbes[l].getaltitude() > 100) && (courbes[l].getaltitude() <= 200))
                        {
                            newLine.Stroke = Brushes.Green;
                        }
                        if ((courbes[l].getaltitude() > 200) && (courbes[l].getaltitude() <= 400))
                        {
                            newLine.Stroke = Brushes.GreenYellow;
                        }
                        if ((courbes[l].getaltitude() > 400) && (courbes[l].getaltitude() <= 600))
                        {
                            newLine.Stroke = Brushes.Yellow;
                        }
                        if ((courbes[l].getaltitude() > 600) && (courbes[l].getaltitude() <= 800))
                        {
                            newLine.Stroke = Brushes.Orange;
                        }
                        if ((courbes[l].getaltitude() > 800) && (courbes[l].getaltitude() <= 1000))
                        {
                            newLine.Stroke = Brushes.OrangeRed;
                        }
                        if (courbes[l].getaltitude() > 1000)
                        {
                            newLine.Stroke = Brushes.Red;
                        }
                        newLine.StrokeThickness = 2;
                        cnv.Children.Add(newLine);

                        courbes[l].remplacer(newLine, trouve - 1);
                    }
                    courbes[l].removePoint(courbes[l].getpoints(trouve));
                }
                else
                {
                    base.OnMouseDown(e);
                    if (!lineStarted)
                    {
                        s           = 0;
                        u           = 0;
                        v           = 0;
                        lineStarted = true;
                        c           = new Courbe();
                        courbes.Add(c);
                        mousePoint1 = e.GetPosition(this);
                        Points.Add(mousePoint1);
                        courbes.Last().setpoints(mousePoint1, s); s++;
                        Ellipse ell = new Ellipse();
                        ell.Width  = 7;
                        ell.Height = 7;
                        ell.Fill   = Brushes.SkyBlue;
                        ell.Stroke = Brushes.Transparent;
                        Canvas.SetLeft(ell, mousePoint1.X - 5 / 2);
                        Canvas.SetTop(ell, mousePoint1.Y - 10 / 2);
                        shownPts.Add(ell);
                        courbes.Last().setshownPts(ell, u); u++;
                        cnv.Children.Add(ell);
                        int    ex    = 0;
                        double altit = 0;
                        while (ex == 0)
                        {
                            try
                            {
                                do
                                {
                                    Alt alt = new Alt();
                                    alt.ShowDialog();
                                    altit = Double.Parse(alt.altitude.Text);
                                    if (altit >= min1 && altit <= max1)
                                    {
                                        if (altit % equi1 == 0 || altit == max1 || altit == min1)
                                        {
                                            courbes.Last().setaltitude(altit);
                                            ex = 1;
                                        }
                                        else
                                        {
                                            MessageBox.Show($"L'altitude doit être multiplie de l'équidistance :{equi1} ");
                                        }
                                    }
                                    else
                                    {
                                        MessageBox.Show($"L'altitude doit être comprise entre {min1} et {max1}");
                                    }
                                } while (altit < min1 || altit > max1);
                            }
                            catch (Exception exp)
                            {
                                MessageBox.Show("Veuillez entrer l'altitude de la courbe", "Erreur");
                                ex = 0;
                            }
                        }
                    }
                    else
                    {
                        Point mousePoint2 = e.GetPosition(this);
                        if (sup == 1)
                        {
                            mousePoint1 = courbes.Last().getpoints(courbes.Last().nbPoints() - 1); sup = 0;
                        }
                        Line newLine = new Line {
                            X1 = mousePoint1.X, Y1 = mousePoint1.Y, X2 = mousePoint2.X, Y2 = mousePoint2.Y
                        };
                        ToolTip t = new ToolTip();
                        t.Content       = courbes.Last().getaltitude();
                        t.Background    = Brushes.AliceBlue;
                        newLine.ToolTip = t;
                        if ((courbes.Last().getaltitude() <= 0))
                        {
                            newLine.Stroke = Brushes.Blue;
                        }
                        if ((courbes.Last().getaltitude() > 0) && (courbes.Last().getaltitude() <= 50))
                        {
                            newLine.Stroke = Brushes.SkyBlue;
                        }
                        if ((courbes.Last().getaltitude() > 50) && (courbes.Last().getaltitude() <= 100))
                        {
                            newLine.Stroke = Brushes.AliceBlue;
                        }
                        if ((courbes.Last().getaltitude() > 100) && (courbes.Last().getaltitude() <= 200))
                        {
                            newLine.Stroke = Brushes.Green;
                        }
                        if ((courbes.Last().getaltitude() > 200) && (courbes.Last().getaltitude() <= 400))
                        {
                            newLine.Stroke = Brushes.GreenYellow;
                        }
                        if ((courbes.Last().getaltitude() > 400) && (courbes.Last().getaltitude() <= 600))
                        {
                            newLine.Stroke = Brushes.Yellow;
                        }
                        if ((courbes.Last().getaltitude() > 600) && (courbes.Last().getaltitude() <= 800))
                        {
                            newLine.Stroke = Brushes.Orange;
                        }
                        if ((courbes.Last().getaltitude() > 800) && (courbes.Last().getaltitude() <= 1000))
                        {
                            newLine.Stroke = Brushes.OrangeRed;
                        }
                        if (courbes.Last().getaltitude() > 1000)
                        {
                            newLine.Stroke = Brushes.Red;
                        }
                        newLine.StrokeThickness = 2;
                        lignes.Add(newLine);
                        courbes.Last().setlignes(newLine, v); v++;
                        cnv.Children.Add(newLine);
                        mousePoint1 = e.GetPosition(this);
                        Points.Add(mousePoint1);
                        courbes.Last().setpoints(mousePoint1, s); s++;
                        Ellipse ell = new Ellipse();
                        ell.Width  = 7;
                        ell.Height = 7;
                        ell.Fill   = Brushes.SkyBlue;
                        ell.Stroke = Brushes.Transparent;
                        Canvas.SetLeft(ell, mousePoint1.X - 5 / 2);
                        Canvas.SetTop(ell, mousePoint1.Y - 10 / 2);
                        shownPts.Add(ell);
                        courbes.Last().setshownPts(ell, u); u++;
                        cnv.Children.Add(ell);
                        if (k == 1)
                        {
                            this.lineStarted = false; k = 0;
                        }
                    }
                    this.InvalidateVisual();
                }
            }
            else
            {
                if (Fin < 2)
                {
                    base.OnMouseDown(e);
                    if (!lineStarted0)
                    {
                        lineStarted0 = true;
                        mousePoint   = e.GetPosition(this);
                    }
                    else
                    {
                        Point mousePoint2 = e.GetPosition(this);
                        Line  newLine0    = new Line {
                            X1 = mousePoint.X, Y1 = mousePoint.Y, X2 = mousePoint2.X, Y2 = mousePoint2.Y
                        };
                        newLine0.Stroke          = Brushes.Black;
                        newLine0.StrokeThickness = 2;
                        cnv.Children.Add(newLine0);
                        this.lineStarted0 = false;
                    }
                    this.InvalidateVisual();
                    Fin++;
                }
            }
        }