Beispiel #1
0
        public static void addPlace(Panel panel, Zone z)
        {
            Point[]      polygon   = Fonction.convertCoordonnee(z.Coordonnee);
            Point[]      rectangle = Fonction.createRectangle(polygon); //le rectangle mcontenir anle polygone
            GraphicsPath path      = new GraphicsPath();

            path.AddPolygon(polygon);
            int   index = 0;
            Point temp  = rectangle[index];

            //mitady anle coins anaky telo amle rectangle conteneur du polygone
            for (int i = 1; i < rectangle.Length; i++)                  // tetezina le points zoronle rectangle
            {
                if (rectangle[i].X < temp.X && rectangle[i].Y < temp.Y) //?
                {
                    index = i;                                          //
                }
            }
            int indexFin = index + 2;

            if (indexFin > 3)
            {
                indexFin = indexFin - 4;
            }
            int indexMil = indexFin - 1;

            if (indexMil < 0)
            {
                indexMil = 3;
            }
            int x = rectangle[index].X;
            int y = rectangle[index].Y;
            //maka ny coin anakroa meme coté (tsy opposé)

            int nbPlace = 0;

            while (x < rectangle[indexFin].X && y < rectangle[indexFin].Y)
            {
                x += (int)z.EspacementCote;
                Point A, B, C, D; //coins anle sieges
                A  = new Point(x, y);
                x += 5;
                B  = new Point(x, y);
                C  = new Point(x, B.Y + 5);
                D  = new Point(x - 5, y + 5);
                Point[] place = { A, B, C, D };
                if (path.IsVisible(A) && path.IsVisible(B) && path.IsVisible(C) && path.IsVisible(D))
                {
                    Fonction.drawFigure(panel, place, "Red");
                    nbPlace++;
                }

                if (x >= rectangle[indexMil].X)
                {
                    x  = rectangle[index].X;
                    y += (int)z.EspacementHaut + 5;
                }
            }
            z.NbPlace = nbPlace;
        }
Beispiel #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     Zone[] z = Stade.Zone;
     if (z != null)
     {
         for (int i = 0; i < z.Length; i++)
         {
             Point[] p = Fonction.convertCoordonnee(z[i].Coordonnee);
             Fonction.drawFigure(panel1, p, z[i].Couleur);
         }
     }
 }
Beispiel #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     label1.Text = "Nom du stade : " + Stade.Nom;
     Point[] coord = Fonction.convertCoordonnee(Stade.Coordonnee);
     Fonction.drawFigure(panel1, coord, "Red");
     Zone[] z = Stade.Zone;
     for (int i = 0; i < z.Length; i++)
     {
         Point[] p = Fonction.convertCoordonnee(z[i].Coordonnee);
         Fonction.drawFigure(panel1, p, z[i].Couleur);
         DataGridViewRow row = (DataGridViewRow)dataGridView1.Rows[0].Clone();
         row.Cells[0].Value           = z[i].Designation;
         row.Cells[1].Style.BackColor = Color.FromName(z[i].Couleur);
         dataGridView1.Rows.Add(row);
     }
 }
Beispiel #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            panel1.Invalidate();
            string coord = Stade.Coordonnee;

            Fonction.drawFigure(this.panel1, Fonction.convertCoordonnee(coord), "Red");
            Zone[] z = Stade.Zone;
            if (z != null)
            {
                for (int i = 0; i < z.Length; i++)
                {
                    Point[] p = Fonction.convertCoordonnee(z[i].Coordonnee);
                    Fonction.drawFigure(panel1, p, z[i].Couleur);
                }
            }
        }
Beispiel #5
0
        public static void addPlaceVerticalementNormale(Panel panel, Zone z)
        {
            Point[]      polygon   = Fonction.convertCoordonnee(z.Coordonnee);
            Point[]      rectangle = Fonction.createRectangle(polygon); //le rectangle mcontenir anle polygone
            GraphicsPath path      = new GraphicsPath();

            path.AddPolygon(polygon);
            int indexFin   = 0;
            int index      = 2;
            int limiteBody = rectangle[1].Y;

            int x = rectangle[index].X;
            int y = rectangle[index].Y;
            //

            int nbPlace = 0;

            while (x < rectangle[indexFin].X && y < rectangle[indexFin].Y)
            {
                y += (int)z.EspacementHaut;

                Point A, B, C, D; //coins anle sieges
                A  = new Point(x, y);
                x += 1;
                B  = new Point(x, y);
                C  = new Point(x, B.Y + 5);
                D  = new Point(x - 5, y + 5);
                Point[] place = { A, B, C, D };
                if (path.IsVisible(A) && path.IsVisible(B) && path.IsVisible(C) && path.IsVisible(D))
                {
                    Fonction.drawFigure(panel, place, "Red");
                    nbPlace++;
                }

                if (y >= limiteBody)
                {
                    y  = rectangle[index].Y;
                    x += (int)z.EspacementCote;
                }
            }
            z.NbPlace = nbPlace;
        }
Beispiel #6
0
 private void Visualiser_Click(object sender, EventArgs e)
 {
     Fonction.drawFigure(this.panel1, listePoint.ToArray <Point>(), "Red");
 }
Beispiel #7
0
        private void AfficherStade_Click(object sender, EventArgs e)
        {
            string coord = Stade.Coordonnee;

            Fonction.drawFigure(this.panel1, Fonction.convertCoordonnee(coord), "Red");
        }