Esempio n. 1
0
        /// <summary>
        /// Fills a poule protocole with given poule at given coordinates.
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="font"></param>
        /// <param name="poule"></param>
        /// <param name="x">The x coordinate where a poule is already drawn.</param>
        /// <param name="y">The y coordinate where a poule is already drawn.</param>
        private void fillPouleProtocole(XGraphics graphics, XFont font, FRCPoule poule, double x, double y)
        {
            int       length = poule.amountOfFencers();
            double    fontHeight = font.GetHeight();
            double    pouleRectWidth = POULE_TOTAL_WIDTH / length;
            FRCFencer fencer1, fencer2;
            FRCMatch  match;
            string    res1, res2;
            double    x1, y1, x2, y2;

            y += fontHeight;

            for (int i = 0; i < poule.amountOfMatches(); i++)
            {
                match = poule.getNextMatch();
                assignMatchResult(out res1, out res2, out fencer1, out fencer2, match);

                y1 = y + (fencer1.FencerNumberInPoule - 1) * fontHeight * 1.25;
                y2 = y + (fencer2.FencerNumberInPoule - 1) * fontHeight * 1.25;
                x1 = x + pouleRectWidth * (fencer2.FencerNumberInPoule - 1);
                x2 = x + pouleRectWidth * (fencer1.FencerNumberInPoule - 1);
                if (res1.Length == 1)
                {
                    x1 += pouleRectWidth * 0.3;
                }
                else if (res1.Length == 2)
                {
                    x1 += pouleRectWidth * 0.2;
                }

                if (res2.Length == 1)
                {
                    x2 += pouleRectWidth * 0.3;
                }
                else if (res2.Length == 2)
                {
                    x2 += pouleRectWidth * 0.2;
                }

                graphics.DrawString(res1, font, XBrushes.Black, x1, y1);
                graphics.DrawString(res2, font, XBrushes.Black, x2, y2);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Prints the poule with given number.
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="poule">The poule to be printed.</param>
        /// <param name="pouleNumber">The poule number.</param>
        private void printPoule(XGraphics graphics, FRCPoule poule, int pouleNumber)
        {
            XFont  font       = new XFont(FONT_TYPE, 10);
            double fontHeight = font.GetHeight();
            double x          = DEFAULT_START_X;

            string s1 = FRCPrinterConstants.POULE + " " + FRCPrinterConstants.NUMBER + " " + pouleNumber + "  " +
                        poule.StartTime + "  " + FRCPrinterConstants.PISTE + " " + FRCPrinterConstants.NUMBER + " " + poule.PisteNumber;
            string s2 = FRCPrinterConstants.REFEREE + ": ";

            for (int i = 0; i < poule.amountOfReferees(); i++)
            {
                FRCReferee referee = poule.getNextReferee();
                s2 += referee.LastName.ToUpper() + " " + referee.FirstName + " " + referee.Club;
                if (poule.hasNextReferee())
                {
                    s2 += ", ";
                }
            }
            graphics.DrawString(s1, font, XBrushes.Black, x, currentYCoordinate);
            currentYCoordinate += fontHeight * 1.3;
            graphics.DrawString(s2, font, XBrushes.Black, x, currentYCoordinate);
            currentYCoordinate += fontHeight * 1.3;
            graphics.DrawString(FRCPrinterConstants.V_M, font, XBrushes.Black, x + 400, currentYCoordinate);
            graphics.DrawString(FRCPrinterConstants.HS_HR, font, XBrushes.Black, x + 435, currentYCoordinate);
            graphics.DrawString(FRCPrinterConstants.HS, font, XBrushes.Black, x + 470, currentYCoordinate);
            graphics.DrawString(FRCPrinterConstants.RANK, font, XBrushes.Black, x + 495, currentYCoordinate);
            currentYCoordinate += fontHeight * 1.3;

            drawPouleGraph(graphics, x + 250, currentYCoordinate, poule.amountOfFencers());
            double savedY = currentYCoordinate;

            currentYCoordinate += fontHeight;
            poule.sortFencersFencerNumberInPoule();

            for (int i = 0; i < poule.amountOfFencers(); i++)
            {
                FRCFencer fencer = poule.getNextFencer();
                fencer = registerFencerStatusInPouleFromMatch(poule, fencer);
                copyFencerInfo(fencer);
                registerPouleResult(fencer);
                string name = fencer.LastName.ToUpper() + " " + fencer.FirstName;
                string club = fencer.Club;
                double vm   = fencer.VM;
                string vm_s = vm.ToString().Replace(',', '.');
                string ind  = fencer.Index.ToString();
                string hs   = fencer.HitsGivenInPoule.ToString();
                string rank = fencer.PouleRanking.ToString();
                if (vm_s.Length == 1)
                {
                    vm_s += ".";
                }
                vm_s += "000";
                if (vm_s.Length > 5)
                {
                    vm_s = vm_s.Remove(5);
                }
                //Saving the value for fencer list in this class.
                getFencerMatchingID(fencer.ID).VM_String = vm_s;

                if (name.Length > 30)
                {
                    name = name.Remove(30);
                }
                if (club.Length > 15)
                {
                    club = club.Remove(15);
                }

                if (fencer.Abandoned || fencer.Forfait || fencer.Excluded)
                {
                    vm_s = "";
                    ind  = " ";
                    hs   = "";
                    rank = "";
                }

                graphics.DrawString(name, font, XBrushes.Black, x + 5, currentYCoordinate);
                graphics.DrawString(club, font, XBrushes.Black, x + 160, currentYCoordinate);
                graphics.DrawString(vm_s, font, XBrushes.Black, x + 400, currentYCoordinate);
                if (ind[0] == '-')
                {
                    graphics.DrawString(ind, font, XBrushes.Black, x + 447 - (ind.Length - 1) * 5, currentYCoordinate);
                }
                else
                {
                    graphics.DrawString(ind, font, XBrushes.Black, x + 450 - ind.Length * 5, currentYCoordinate);
                }
                graphics.DrawString(hs, font, XBrushes.Black, x + 482 - hs.Length * 5, currentYCoordinate);
                graphics.DrawString(rank, font, XBrushes.Black, x + 513 - rank.Length * 5, currentYCoordinate);

                currentYCoordinate += fontHeight * 1.25;
            }
            fillPouleProtocole(graphics, font, poule, x + 250, savedY);
            currentYCoordinate += fontHeight * 2;
        }
Esempio n. 3
0
        /// <summary>
        /// Prints all poule rounds. And ranking after each poule round as well.
        /// </summary>
        private void printPouleRounds()
        {
            XGraphics graphics   = null;
            XFont     font       = new XFont(FONT_TYPE, 11, XFontStyle.Bold);
            double    fontHeight = font.GetHeight();
            double    x          = DEFAULT_START_X;

            for (int i = 0; i < pouleRound.Count; i++)
            {
                //Starting on a new page if the given page is not empty.
                if (currentYCoordinate > pageTopSize)
                {
                    currentYCoordinate = 810;
                }

                graphics = XGraphics.FromPdfPage(getCurrentPage());
                string title = FRCPrinterConstants.POULES_ROUND + " " + (i + 1).ToString();
                graphics.DrawString(title, font, XBrushes.Black, x, currentYCoordinate);
                currentYCoordinate += fontHeight * 3;

                for (int j = 0; j < pouleRound[i].NumOfPoules; j++)
                {
                    XFont    tempFont = new XFont(FONT_TYPE, 10);
                    FRCPoule poule    = pouleRound[i].getNextPoule();
                    double   totalY   = currentYCoordinate + tempFont.GetHeight() * (4.9 + 1.25 * poule.amountOfFencers());
                    graphics = checkYCoordinate(graphics, totalY);
                    printPoule(graphics, poule, j + 1);
                }

                registerEliminationOnRankList(pouleRound[i]);

                if (i == pouleRound.Count - 1)
                {
                    checkTableauRankFormat(pouleRound[i]);

                    /*
                     * if (qualifyAllRankAll)
                     *  Console.WriteLine("d");
                     * if (qualifyLastRankAll)
                     *  Console.WriteLine("b");
                     * if (qualifyLastRankLast)
                     *  Console.WriteLine("a");
                     */

                    //Different competition formats.
                    if (qualifyLastRankLast)
                    {
                        //Do nothing.
                    }
                    else if (qualifyAllRankAll)
                    {
                        //Print summing ranking after all poule rounds and skip the ranking of the last poule.
                        printRankingAfterAllPouleRounds();
                        break;
                    }
                    else if (qualifyLastRankAll)
                    {
                        //Do nothing. Print summing ranking later.
                    }
                }
                printRankingAfterPouleRound(pouleRound[i]);
            }
        }