Ejemplo n.º 1
0
        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;
        }