Exemplo n.º 1
0
 public override void delete(Forme_simple entry)
 {
     Type t = typeof(Polygone);
     Type t2 = entry.GetType();
     if (t.Equals(t2))
     {
         base.delete(entry);
     }
     else if (successor != null)
     {
         successor.delete(entry);
     }
 }
Exemplo n.º 2
0
 public override void createorupdate(Forme_simple entry)
 {
     Type t = typeof(Segment);
     Type t2 = entry.GetType();
     if (t.Equals(t2))
     {
         base.createorupdate(entry);
     }
     else if (successor != null)
     {
         successor.createorupdate(entry);
     }
 }
Exemplo n.º 3
0
        public override void createorupdate(Forme_simple entry)
        {
            Type t  = typeof(Triangle);
            Type t2 = entry.GetType();

            if (t.Equals(t2))
            {
                base.createorupdate(entry);
            }
            else if (successor != null)
            {
                successor.createorupdate(entry);
            }
        }
Exemplo n.º 4
0
        public override void delete(Forme_simple entry)
        {
            Type t  = typeof(Polygone);
            Type t2 = entry.GetType();

            if (t.Equals(t2))
            {
                base.delete(entry);
            }
            else if (successor != null)
            {
                successor.delete(entry);
            }
        }
Exemplo n.º 5
0
 public override void dessiner(Forme_simple entry, Graphics g)
 {
     Type t = typeof(Segment);
     Type t2 = entry.GetType();
     if (t.Equals(t2))
     {
         Segment s = (Segment)entry;
         Pen pen = new Pen(Color.FromArgb(entry.Couleur), 4);
         g.DrawLine(pen, s.Point1.X, s.Point1.Y, s.Point2.X, s.Point2.Y);
     }
     else if (successor != null)
     {
         successor.dessiner(entry, g);
     }
 }
 public override void dessiner(Forme_simple entry, Graphics g)
 {
     Type t = typeof(Triangle);
     Type t2 = entry.GetType();
     if (t.Equals(t2))
     {
         Triangle tr = (Triangle)entry;
         SolidBrush brush = new SolidBrush(Color.FromArgb(entry.Couleur));
         g.FillPolygon(brush, tr.Tableau_points);
     }
     else if (successor != null)
     {
         successor.dessiner(entry, g);
     }
 }
 public override void contourSelection(Forme_simple forme, Graphics g, Color couleur)
 {
     Type t = typeof(Triangle);
     Type t2 = forme.GetType();
     if (t.Equals(t2))
     {
         Triangle tr = (Triangle)forme;
         Pen pen = new Pen(couleur, 10); //Couleur de selection
         g.DrawPolygon(pen, tr.Tableau_points);
     }
     else if (successor != null)
     {
         successor.contourSelection(forme, g, couleur);
     }
 }
 public override void contourSelection(Forme_simple forme, Graphics g, Color couleur)
 {
     Type t = typeof(Rectangle);
     Type t2 = forme.GetType();
     if (t.Equals(t2))
     {
         Rectangle e = (Rectangle)forme;
         Pen pen = new Pen(couleur, 10); //Couleur de selection
         g.DrawRectangle(pen, e.Point1.X, e.Point1.Y, e.Largeur, e.Hauteur);
     }
     else if (successor != null)
     {
         successor.contourSelection(forme, g, couleur);
     }
 }
 public override void dessiner(Forme_simple entry, Graphics g)
 {
     Type t = typeof(Rectangle);
     Type t2 = entry.GetType();
     if (t.Equals(t2))
     {
         Rectangle r = (Rectangle)entry;
         SolidBrush brush = new SolidBrush(Color.FromArgb(entry.Couleur));
         g.FillRectangle(brush, r.Point1.X, r.Point1.Y, r.Largeur, r.Hauteur);
     }
     else if (successor != null)
     {
         successor.dessiner(entry, g);
     }
 }
Exemplo n.º 10
0
 public override void contourSelection(Forme_simple forme, Graphics g, Color couleur)
 {
     Type t = typeof(Segment);
     Type t2 = forme.GetType();
     if (t.Equals(t2))
     {
         Segment s = (Segment)forme;
         Pen pen = new Pen(couleur, 10); //Couleur de selection
         g.DrawLine(pen, s.Point1.X, s.Point1.Y, s.Point2.X, s.Point2.Y);
     }
     else if (successor != null)
     {
         successor.contourSelection(forme, g, couleur);
     }
 }
Exemplo n.º 11
0
 public override void contourSelection(Forme_simple forme, Graphics g, Color couleur)
 {
     Type t = typeof(Ellipse);
     Type t2 = forme.GetType();
     if (t.Equals(t2))
     {
         Ellipse e = (Ellipse)forme;
         //Pen pen = new Pen(Color.FromArgb(255, 0, 255, 0), 10); //Couleur de selection
         Pen pen = new Pen(couleur, 10); //Couleur de selection
         g.DrawEllipse(pen, e.Point1.X, e.Point1.Y, e.Largeur, e.Hauteur);
     }
     else if (successor != null)
     {
         successor.contourSelection(forme, g, couleur);
     }
 }
Exemplo n.º 12
0
        public override void contourSelection(Forme_simple forme, Graphics g, Color couleur)
        {
            Type t  = typeof(Rectangle);
            Type t2 = forme.GetType();

            if (t.Equals(t2))
            {
                Rectangle e   = (Rectangle)forme;
                Pen       pen = new Pen(couleur, 10); //Couleur de selection
                g.DrawRectangle(pen, e.Point1.X, e.Point1.Y, e.Largeur, e.Hauteur);
            }
            else if (successor != null)
            {
                successor.contourSelection(forme, g, couleur);
            }
        }
Exemplo n.º 13
0
        public override void dessiner(Forme_simple entry, Graphics g)
        {
            Type t  = typeof(Rectangle);
            Type t2 = entry.GetType();

            if (t.Equals(t2))
            {
                Rectangle  r     = (Rectangle)entry;
                SolidBrush brush = new SolidBrush(Color.FromArgb(entry.Couleur));
                g.FillRectangle(brush, r.Point1.X, r.Point1.Y, r.Largeur, r.Hauteur);
            }
            else if (successor != null)
            {
                successor.dessiner(entry, g);
            }
        }
Exemplo n.º 14
0
        public override void contourSelection(Forme_simple forme, Graphics g, Color couleur)
        {
            Type t  = typeof(Polygone);
            Type t2 = forme.GetType();

            if (t.Equals(t2))
            {
                Polygone e   = (Polygone)forme;
                Pen      pen = new Pen(couleur, 10); //Couleur de selection
                g.DrawPolygon(pen, e.Tableau_points);
            }
            else if (successor != null)
            {
                successor.contourSelection(forme, g, couleur);
            }
        }
Exemplo n.º 15
0
        public override void dessiner(Forme_simple entry, Graphics g)
        {
            Type t  = typeof(Polygone);
            Type t2 = entry.GetType();

            if (t.Equals(t2))
            {
                Polygone   p     = (Polygone)entry;
                SolidBrush brush = new SolidBrush(Color.FromArgb(entry.Couleur));
                g.FillPolygon(brush, p.Tableau_points);
            }
            else if (successor != null)
            {
                successor.dessiner(entry, g);
            }
        }
Exemplo n.º 16
0
        public override void contourSelection(Forme_simple forme, Graphics g, Color couleur)
        {
            Type t  = typeof(Segment);
            Type t2 = forme.GetType();

            if (t.Equals(t2))
            {
                Segment s   = (Segment)forme;
                Pen     pen = new Pen(couleur, 10); //Couleur de selection
                g.DrawLine(pen, s.Point1.X, s.Point1.Y, s.Point2.X, s.Point2.Y);
            }
            else if (successor != null)
            {
                successor.contourSelection(forme, g, couleur);
            }
        }
Exemplo n.º 17
0
        public override void dessiner(Forme_simple entry, Graphics g)
        {
            Type t  = typeof(Segment);
            Type t2 = entry.GetType();

            if (t.Equals(t2))
            {
                Segment s   = (Segment)entry;
                Pen     pen = new Pen(Color.FromArgb(entry.Couleur), 4);
                g.DrawLine(pen, s.Point1.X, s.Point1.Y, s.Point2.X, s.Point2.Y);
            }
            else if (successor != null)
            {
                successor.dessiner(entry, g);
            }
        }
Exemplo n.º 18
0
        public override void create(Forme_simple entry)
        {
            Type t  = typeof(Ellipse);
            Type t2 = entry.GetType();

            if (t.Equals(t2))
            {
                base.create(entry);
                Ellipse e = (Ellipse)entry;

                //Données membres
                this._command.Parameters.AddWithValue("@x1", e.Point1.X);
                this._command.Parameters.AddWithValue("@y1", e.Point1.Y);
                this._command.Parameters.AddWithValue("@hauteur", e.Hauteur);
                this._command.Parameters.AddWithValue("@largeur", e.Largeur);

                //Définition des requetes
                String[] tabRequete = new String[] {
                    //ellipse
                    @"INSERT INTO ellipse(id, hauteur, largeur) VALUES (@id, @hauteur, @largeur);",
                    //point
                    @"INSERT INTO point(id, ordre, x, y) VALUES (@id, 1, @x1, @y1);"
                };


                foreach (String r in tabRequete)
                {
                    //Définition de la requete
                    this._command.CommandText = r;

                    try
                    {
                        //Execution de la requete
                        this._command.ExecuteNonQuery();
                    }
                    catch (MySqlException ex)
                    {
                        Console.WriteLine("Error: {0}", ex.ToString());
                        throw ex;
                    }
                }
            }
            else if (successor != null)
            {
                successor.create(entry);
            }
        }
Exemplo n.º 19
0
        public override void create(Forme_simple entry)
        {
            Type t  = typeof(Segment);
            Type t2 = entry.GetType();

            if (t.Equals(t2))
            {
                base.create(entry);
                Segment s = (Segment)entry;
                this._command.Parameters.AddWithValue("@x1", s.Point1.X);
                this._command.Parameters.AddWithValue("@y1", s.Point1.Y);
                this._command.Parameters.AddWithValue("@x2", s.Point2.X);
                this._command.Parameters.AddWithValue("@y2", s.Point2.Y);

                //Définition des requetes
                String[] tabRequete = new String[] {
                    //segment
                    @"INSERT INTO segment(id) VALUES (@id);",
                    //point
                    @"INSERT INTO point(id, ordre, x, y) VALUES (@id, 1, @x1, @y1);",
                    @"INSERT INTO point(id, ordre, x, y) VALUES (@id, 2, @x2, @y2);"
                };


                foreach (String r in tabRequete)
                {
                    //Définition de la requete
                    this._command.CommandText = r;

                    try
                    {
                        //Execution de la requete
                        this._command.ExecuteNonQuery();
                    }
                    catch (MySqlException ex)
                    {
                        Console.WriteLine("Error: {0}", ex.ToString());
                        throw ex;
                    }
                }
            }
            else if (successor != null)
            {
                successor.create(entry);
            }
        }
Exemplo n.º 20
0
        public override void contourSelection(Forme_simple forme, Graphics g, Color couleur)
        {
            Type t  = typeof(Ellipse);
            Type t2 = forme.GetType();

            if (t.Equals(t2))
            {
                Ellipse e = (Ellipse)forme;
                //Pen pen = new Pen(Color.FromArgb(255, 0, 255, 0), 10); //Couleur de selection
                Pen pen = new Pen(couleur, 10); //Couleur de selection
                g.DrawEllipse(pen, e.Point1.X, e.Point1.Y, e.Largeur, e.Hauteur);
            }
            else if (successor != null)
            {
                successor.contourSelection(forme, g, couleur);
            }
        }
Exemplo n.º 21
0
        public override void update(Forme_simple entry)
        {
            Type t  = typeof(Ellipse);
            Type t2 = entry.GetType();

            if (t.Equals(t2))
            {
                base.update(entry);
                Ellipse e = (Ellipse)entry;
                //Données membres
                this._command.Parameters.AddWithValue("@x1", e.Point1.X);
                this._command.Parameters.AddWithValue("@y1", e.Point1.Y);
                this._command.Parameters.AddWithValue("@hauteur", e.Hauteur);
                this._command.Parameters.AddWithValue("@largeur", e.Largeur);

                //Définition des requetes
                String[] tabRequete = new String[] {
                    //ellipse
                    @"UPDATE ellipse SET hauteur = @hauteur, largeur = @largeur WHERE id = @id;",
                    //point
                    @"UPDATE point SET x = @x1, y = @y1 WHERE id = @id AND ordre = 1;"
                };


                foreach (String r in tabRequete)
                {
                    //Définition de la requete
                    this._command.CommandText = r;

                    try
                    {
                        //Execution de la requete
                        this._command.ExecuteNonQuery();
                    }
                    catch (MySqlException ex)
                    {
                        Console.WriteLine("Error: {0}", ex.ToString());
                        throw ex;
                    }
                }
            }
            else if (successor != null)
            {
                successor.update(entry);
            }
        }
Exemplo n.º 22
0
        public override void create(Forme_simple entry)
        {
            Type t = typeof(Ellipse);
            Type t2 = entry.GetType();
            if (t.Equals(t2))
            {
                base.create(entry);
                Ellipse e = (Ellipse)entry;

                //Données membres
                this._command.Parameters.AddWithValue("@x1", e.Point1.X);
                this._command.Parameters.AddWithValue("@y1", e.Point1.Y);
                this._command.Parameters.AddWithValue("@hauteur", e.Hauteur);
                this._command.Parameters.AddWithValue("@largeur", e.Largeur);

                //Définition des requetes
                String[] tabRequete = new String[] {
                    //ellipse
                    @"INSERT INTO ellipse(id, hauteur, largeur) VALUES (@id, @hauteur, @largeur);",
                    //point
                    @"INSERT INTO point(id, ordre, x, y) VALUES (@id, 1, @x1, @y1);"
                };

                foreach (String r in tabRequete)
                {
                    //Définition de la requete
                    this._command.CommandText = r;

                    try
                    {
                        //Execution de la requete
                        this._command.ExecuteNonQuery();
                    }
                    catch (MySqlException ex)
                    {
                        Console.WriteLine("Error: {0}", ex.ToString());
                        throw ex;
                    }
                }
            }
            else if (successor != null)
            {
                successor.create(entry);
            }
        }
Exemplo n.º 23
0
        public override void update(Forme_simple entry)
        {
            Type t  = typeof(Segment);
            Type t2 = entry.GetType();

            if (t.Equals(t2))
            {
                base.update(entry);
                Segment s = (Segment)entry;
                this._command.Parameters.AddWithValue("@x1", s.Point1.X);
                this._command.Parameters.AddWithValue("@y1", s.Point1.Y);
                this._command.Parameters.AddWithValue("@x2", s.Point2.X);
                this._command.Parameters.AddWithValue("@y2", s.Point2.Y);

                //Définition des requetes
                String[] tabRequete = new String[] {
                    //point
                    @"UPDATE point SET x = @x1, y = @y1 WHERE id = @id AND ordre = 1;",
                    @"UPDATE point SET x = @x2, y = @y2 WHERE id = @id AND ordre = 2;"
                };


                foreach (String r in tabRequete)
                {
                    //Définition de la requete
                    this._command.CommandText = r;

                    try
                    {
                        //Execution de la requete
                        this._command.ExecuteNonQuery();
                    }
                    catch (MySqlException ex)
                    {
                        Console.WriteLine("Error: {0}", ex.ToString());
                        throw ex;
                    }
                }
            }
            else if (successor != null)
            {
                successor.update(entry);
            }
        }
Exemplo n.º 24
0
        public override void create(Forme_simple entry)
        {
            Type t = typeof(Segment);
            Type t2 = entry.GetType();
            if (t.Equals(t2))
            {
                base.create(entry);
                Segment s = (Segment)entry;
                this._command.Parameters.AddWithValue("@x1", s.Point1.X);
                this._command.Parameters.AddWithValue("@y1", s.Point1.Y);
                this._command.Parameters.AddWithValue("@x2", s.Point2.X);
                this._command.Parameters.AddWithValue("@y2", s.Point2.Y);

                //Définition des requetes
                String[] tabRequete = new String[] {
                    //segment
                    @"INSERT INTO segment(id) VALUES (@id);",
                    //point
                    @"INSERT INTO point(id, ordre, x, y) VALUES (@id, 1, @x1, @y1);",
                    @"INSERT INTO point(id, ordre, x, y) VALUES (@id, 2, @x2, @y2);"
                };

                foreach (String r in tabRequete)
                {
                    //Définition de la requete
                    this._command.CommandText = r;

                    try
                    {
                        //Execution de la requete
                        this._command.ExecuteNonQuery();
                    }
                    catch (MySqlException ex)
                    {
                        Console.WriteLine("Error: {0}", ex.ToString());
                        throw ex;
                    }
                }
            }
            else if (successor != null)
            {
                successor.create(entry);
            }
        }
Exemplo n.º 25
0
        public override void create(Forme_simple entry)
        {
            Type t  = typeof(Polygone);
            Type t2 = entry.GetType();

            if (t.Equals(t2))
            {
                base.create(entry);
                Polygone p = (Polygone)entry;

                //Définition des requetes
                List <String> tabRequete_poly = new List <String>();
                //polygone
                tabRequete_poly.Add(@"INSERT INTO polygone(id) VALUES (@id);");
                //point
                for (int i = 1; i <= p.Tableau_points.Length; i++)
                {
                    tabRequete_poly.Add(@"INSERT INTO point(id, ordre, x, y) VALUES (@id, " + i + ", " + p.Tableau_points[i - 1].X + ", " + p.Tableau_points[i - 1].Y + ");");
                }

                foreach (String r in tabRequete_poly)
                {
                    //Définition de la requete
                    this._command.CommandText = r;

                    try
                    {
                        //Execution de la requete
                        this._command.ExecuteNonQuery();
                    }
                    catch (MySqlException ex)
                    {
                        Console.WriteLine("Error: {0}", ex.ToString());
                        throw ex;
                    }
                }
            }
            else if (successor != null)
            {
                successor.create(entry);
            }
        }
Exemplo n.º 26
0
        public override void create(Forme_simple entry)
        {
            Type t = typeof(Polygone);
            Type t2 = entry.GetType();
            if (t.Equals(t2))
            {
                base.create(entry);
                Polygone p = (Polygone)entry;

                //Définition des requetes
                List<String> tabRequete_poly = new List<String>();
                //polygone
                tabRequete_poly.Add(@"INSERT INTO polygone(id) VALUES (@id);");
                //point
                for (int i = 1; i <= p.Tableau_points.Length; i++)
                {
                    tabRequete_poly.Add(@"INSERT INTO point(id, ordre, x, y) VALUES (@id, " + i + ", " + p.Tableau_points[i - 1].X + ", " + p.Tableau_points[i - 1].Y + ");");
                }

                foreach (String r in tabRequete_poly)
                {
                    //Définition de la requete
                    this._command.CommandText = r;

                    try
                    {
                        //Execution de la requete
                        this._command.ExecuteNonQuery();
                    }
                    catch (MySqlException ex)
                    {
                        Console.WriteLine("Error: {0}", ex.ToString());
                        throw ex;
                    }
                }
            }
            else if (successor != null)
            {
                successor.create(entry);
            }
        }
Exemplo n.º 27
0
        public override void update(Forme_simple entry)
        {
            Type t  = typeof(Triangle);
            Type t2 = entry.GetType();

            if (t.Equals(t2))
            {
                base.update(entry);
                Triangle tr = (Triangle)entry;

                //Définition des requetes
                List <String> tabRequete_triangle = new List <String>();

                //point
                for (int i = 1; i <= tr.Tableau_points.Length; i++)
                {
                    tabRequete_triangle.Add(@"UPDATE point SET x = " + tr.Tableau_points[i - 1].X + ", y = " + tr.Tableau_points[i - 1].Y + " WHERE id = @id AND ordre = " + i + ";");
                }

                foreach (String r in tabRequete_triangle)
                {
                    //Définition de la requete
                    this._command.CommandText = r;

                    try
                    {
                        //Execution de la requete
                        this._command.ExecuteNonQuery();
                    }
                    catch (MySqlException ex)
                    {
                        Console.WriteLine("Error: {0}", ex.ToString());
                        throw ex;
                    }
                }
            }
            else if (successor != null)
            {
                successor.update(entry);
            }
        }
Exemplo n.º 28
0
        public override void update(Forme_simple entry)
        {
            Type t = typeof(Segment);
            Type t2 = entry.GetType();
            if (t.Equals(t2))
            {
                base.update(entry);
                Segment s = (Segment)entry;
                this._command.Parameters.AddWithValue("@x1", s.Point1.X);
                this._command.Parameters.AddWithValue("@y1", s.Point1.Y);
                this._command.Parameters.AddWithValue("@x2", s.Point2.X);
                this._command.Parameters.AddWithValue("@y2", s.Point2.Y);

                //Définition des requetes
                String[] tabRequete = new String[] {
                    //point
                    @"UPDATE point SET x = @x1, y = @y1 WHERE id = @id AND ordre = 1;",
                    @"UPDATE point SET x = @x2, y = @y2 WHERE id = @id AND ordre = 2;"
                };

                foreach (String r in tabRequete)
                {
                    //Définition de la requete
                    this._command.CommandText = r;

                    try
                    {
                        //Execution de la requete
                        this._command.ExecuteNonQuery();
                    }
                    catch (MySqlException ex)
                    {
                        Console.WriteLine("Error: {0}", ex.ToString());
                        throw ex;
                    }
                }
            }
            else if (successor != null)
            {
                successor.update(entry);
            }
        }
Exemplo n.º 29
0
        public override void update(Forme_simple entry)
        {
            Type t = typeof(Triangle);
            Type t2 = entry.GetType();
            if (t.Equals(t2))
            {
                base.update(entry);
                Triangle tr = (Triangle)entry;

                //Définition des requetes
                List<String> tabRequete_triangle = new List<String>();

                //point
                for (int i = 1; i <= tr.Tableau_points.Length; i++)
                {
                    tabRequete_triangle.Add(@"UPDATE point SET x = " + tr.Tableau_points[i - 1].X + ", y = " + tr.Tableau_points[i - 1].Y + " WHERE id = @id AND ordre = " + i + ";");
                }

                foreach (String r in tabRequete_triangle)
                {
                    //Définition de la requete
                    this._command.CommandText = r;

                    try
                    {
                        //Execution de la requete
                        this._command.ExecuteNonQuery();
                    }
                    catch (MySqlException ex)
                    {
                        Console.WriteLine("Error: {0}", ex.ToString());
                        throw ex;
                    }
                }
            }
            else if (successor != null)
            {
                successor.update(entry);
            }
        }
Exemplo n.º 30
0
        public override void update(Forme_simple entry)
        {
            Type t = typeof(Ellipse);
            Type t2 = entry.GetType();
            if (t.Equals(t2))
            {
                base.update(entry);
                Ellipse e = (Ellipse)entry;
                //Données membres
                this._command.Parameters.AddWithValue("@x1", e.Point1.X);
                this._command.Parameters.AddWithValue("@y1", e.Point1.Y);
                this._command.Parameters.AddWithValue("@hauteur", e.Hauteur);
                this._command.Parameters.AddWithValue("@largeur", e.Largeur);

                //Définition des requetes
                String[] tabRequete = new String[] {
                    //ellipse
                    @"UPDATE ellipse SET hauteur = @hauteur, largeur = @largeur WHERE id = @id;",
                    //point
                    @"UPDATE point SET x = @x1, y = @y1 WHERE id = @id AND ordre = 1;"
                };

                foreach (String r in tabRequete)
                {
                    //Définition de la requete
                    this._command.CommandText = r;

                    try
                    {
                        //Execution de la requete
                        this._command.ExecuteNonQuery();
                    }
                    catch (MySqlException ex)
                    {
                        Console.WriteLine("Error: {0}", ex.ToString());
                        throw ex;
                    }
                }
            }
            else if (successor != null)
            {
                successor.update(entry);
            }
        }