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; }
public static void addPlaceHorizontalementInverse(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 = 1; int index = 3; int limiteBody = rectangle[2].X; int x = rectangle[index].X; int y = rectangle[index].Y; //maka ny coin anakroa meme coté (tsy opposé) int nbPlace = z.NumDepart; //atao numero depart z.Sieges = new List <Seza>(); 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 -= (int)z.TailleSeza; B = new Point(x, y); C = new Point(x, B.Y + (int)z.TailleSeza); D = new Point(x + (int)z.TailleSeza, y + (int)z.TailleSeza); Point[] place = { A, B, C, D }; String numStr = "" + nbPlace; if (path.IsVisible(A) && path.IsVisible(B) && path.IsVisible(C) && path.IsVisible(D)) { Seza temp = new Seza(nbPlace, Fonction.convertString(place), 0); z.Sieges.Add(temp); Fonction.drawSeza(panel, place, "Red", numStr); nbPlace++; } if (x <= limiteBody) { x = rectangle[index].X; y += (int)z.EspacementHaut + (int)z.TailleSeza; ; } } //ETO NO MI-INSERT NY SEZA reetra anle zone ANATY BASE (VITA) Fonction f = new Fonction(); DBConnect dbc = new DBConnect(); f.insertSeza(dbc, z.Sieges, z.Id); z.NbPlace = nbPlace; }
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); } } }
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); } }
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); } } }
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; }
private void AfficherStade_Click(object sender, EventArgs e) { string coord = Stade.Coordonnee; Fonction.drawFigure(this.panel1, Fonction.convertCoordonnee(coord), "Red"); }