Esempio n. 1
0
        /// <summary>
        /// Copies the IsStillInCompetition, Abandoned, Forfait and Excluded values from all fencers in given poule round
        /// to the internal ranking.
        /// </summary>
        /// <param name="pouleRound"></param>
        private void registerEliminationOnRankList(FRCPouleRound pouleRound)
        {
            FRCFencer fencer;

            pouleRound.resetFencerIndex();

            for (int i = 0; i < pouleRound.amountOfFencers(); i++)
            {
                fencer = pouleRound.getNextFencer();
                for (int j = 0; j < rankListAllPouleRounds.Count; j++)
                {
                    if (fencer.ID == rankListAllPouleRounds[j].ID)
                    {
                        if (rankListAllPouleRounds[j].IsStillInTheCompetition)
                        {
                            rankListAllPouleRounds[j].IsStillInTheCompetition = fencer.IsStillInTheCompetition;
                        }

                        //These abandoned, excluded, forfait assignments are probably unnecessary, but they are not wrong and it works.
                        if (!rankListAllPouleRounds[j].Abandoned)
                        {
                            rankListAllPouleRounds[j].Abandoned = fencer.Abandoned;
                        }
                        if (!rankListAllPouleRounds[j].Excluded)
                        {
                            rankListAllPouleRounds[j].Excluded = fencer.Excluded;
                        }
                        if (!rankListAllPouleRounds[j].Forfait)
                        {
                            rankListAllPouleRounds[j].Forfait = fencer.Forfait;
                        }
                        break;
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Prints the result of given poule round.
        /// </summary>
        /// <param name="pouleRound"></param>
        private void printRankingAfterPouleRound(FRCPouleRound pouleRound)
        {
            //Starting on a new page if the given page is not empty.
            if (currentYCoordinate > pageTopSize)
            {
                currentYCoordinate = 810;
            }

            XGraphics graphics = XGraphics.FromPdfPage(getCurrentPage());
            XFont     font1 = new XFont(FONT_TYPE, 11, XFontStyle.Bold);
            XFont     font2 = new XFont(FONT_TYPE, 10);
            double    font1Height = font1.GetHeight();
            double    font2Height = font2.GetHeight();
            double    x = DEFAULT_START_X;
            FRCFencer fencer, fencerInList;
            int       amountOfFencers = pouleRound.amountOfFencers();

            for (int i = 0; i < pouleRound.amountOfFencers(); i++)
            {
                fencer       = pouleRound.getNextFencer();
                fencerInList = getFencerMatchingID(fencer.ID);
                if (fencerInList.Forfait || fencerInList.Excluded)
                {
                    amountOfFencers--;
                }
            }
            string title = FRCPrinterConstants.RANKING_OF_POULES + ", " + FRCPrinterConstants.ROUND + " " + FRCPrinterConstants.NUMBER +
                           " " + pouleRound.RoundNumber.ToString() + " (" + amountOfFencers.ToString() + " " + FRCPrinterConstants.FENCERS_LOWER + ")";

            graphics.DrawString(title, font1, XBrushes.Black, x, currentYCoordinate);
            currentYCoordinate += font1Height * 2;
            x += 5;
            graphics.DrawString(FRCPrinterConstants.RANK, font2, XBrushes.Black, x, currentYCoordinate);
            graphics.DrawString(FRCPrinterConstants.NAME, font2, XBrushes.Black, x + 45, currentYCoordinate);
            graphics.DrawString(FRCPrinterConstants.CLUB, font2, XBrushes.Black, x + 235, currentYCoordinate);
            graphics.DrawString(FRCPrinterConstants.V_M, font2, XBrushes.Black, x + 330, currentYCoordinate);
            graphics.DrawString(FRCPrinterConstants.HS_HR, font2, XBrushes.Black, x + 365, currentYCoordinate);
            graphics.DrawString(FRCPrinterConstants.HS, font2, XBrushes.Black, x + 400, currentYCoordinate);
            graphics.DrawString(FRCPrinterConstants.Q_E, font2, XBrushes.Black, x + 425, currentYCoordinate);
            currentYCoordinate += font2Height * 2;

            //Added since the meaning of RangFinal is not consistent for all versions of EnGarde
            for (int i = 0; i < pouleRound.amountOfFencers(); i++)
            {
                fencer       = pouleRound.getNextFencer();
                fencerInList = getFencerMatchingID(fencer.ID);
                pouleRound.CopyPouleResult(fencerInList);
            }
            pouleRound.calculateFencerPouleRanking();

            pouleRound.sortFencerPouleRanking();
            for (int i = 0; i < pouleRound.amountOfFencers(); i++)
            {
                fencer = pouleRound.getNextFencer();
                //fencerInList = getFencerMatchingID(fencer.ID);
                //Skip if the fencer got scratch or exclusion.
                if (fencer.Forfait || fencer.Excluded)
                {
                    continue;
                }
                //Skip if the fencer does not have a status, since that is odd and happens sometime.
                if (fencer.NoStatusException == true)
                {
                    continue;
                }

                double totalY = currentYCoordinate + font2Height * 1.3;
                graphics = checkYCoordinate(graphics, totalY);

                string pr   = fencer.PhaseFinalRanking.ToString();
                string name = fencer.LastName.ToUpper() + " " + fencer.FirstName;
                string club = fencer.Club;
                string ind  = (fencer.HitsGivenInPoule - fencer.HitsTakenInPoule).ToString();
                string hs   = fencer.HitsGivenInPoule.ToString();
                string qe;
                string vm_s = fencer.VM_String;
                if (fencer.IsStillInTheCompetition)
                {
                    qe = FRCPrinterConstants.QUALIFIED;
                }
                else if (fencer.Abandoned)
                {
                    qe   = FRCPrinterConstants.ABANDONED;
                    ind  = " ";
                    hs   = "";
                    vm_s = "";
                }
                else
                {
                    qe           = FRCPrinterConstants.ELIMINATED;
                    qualifiedEnd = true;
                }

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

                if (qualifiedEnd && !eliminatedStarted)
                {
                    XPen pen = new XPen(XColors.Black, 0.5);
                    graphics = checkYCoordinate(graphics, totalY + font2Height * 0.5);
                    //currentYCoordinate += font2Height * 0.25;
                    graphics.DrawLine(pen, x, currentYCoordinate - font2Height * 0.7, x + 470, currentYCoordinate - font2Height * 0.7);
                    currentYCoordinate += font2Height * 0.5;
                    eliminatedStarted   = true;
                }

                graphics.DrawString(pr, font2, XBrushes.Black, x + 15 - pr.Length * 5, currentYCoordinate);
                graphics.DrawString(name, font2, XBrushes.Black, x + 45, currentYCoordinate);
                graphics.DrawString(club, font2, XBrushes.Black, x + 235, currentYCoordinate);
                graphics.DrawString(vm_s, font2, XBrushes.Black, x + 330, currentYCoordinate);
                if (ind[0] == '-')
                {
                    graphics.DrawString(ind, font2, XBrushes.Black, x + 374 - (ind.Length - 1) * 5, currentYCoordinate);
                }
                else
                {
                    graphics.DrawString(ind, font2, XBrushes.Black, x + 377 - ind.Length * 5, currentYCoordinate);
                }
                graphics.DrawString(hs, font2, XBrushes.Black, x + 412 - hs.Length * 5, currentYCoordinate);
                graphics.DrawString(qe, font2, XBrushes.Black, x + 425, currentYCoordinate);

                currentYCoordinate += font2Height * 1.3;
            }

            qualifiedEnd      = false;
            eliminatedStarted = false;
            graphics.Dispose();
        }
Esempio n. 3
0
        /// <summary>
        /// Checks which format is used for tableau ranking.
        /// </summary>
        /// <param name="lastPouleRound">The last poule round.</param>
        private void checkTableauRankFormat(FRCPouleRound lastPouleRound)
        {
            lastPouleRound.sortFencerPouleRanking();
            interpreter.Tableau.sortFencerInitialRanking();
            sortRankListAllPouleRounds();
            FRCFencer pouleFencer, tableauFencer;

            //Compare ranking from last poule round with initial ranking for the tableau.
            for (int i = 0; i < lastPouleRound.amountOfFencers(); i++)
            {
                pouleFencer = lastPouleRound.getNextFencer();
                //Skips all eliminated, excluded, abandoned and scratched fencers.
                if (!pouleFencer.IsStillInTheCompetition)
                {
                    continue;
                }

                tableauFencer = interpreter.Tableau.getNextFencer();
                if (tableauFencer.ID != pouleFencer.ID)
                {
                    lastPouleRound.resetFencerIndex();
                    interpreter.Tableau.resetFencerIndex();
                    qualifyLastRankAll = true;
                    return;
                }
            }

            int  lastPhaseFinalRanking = -1;
            bool different             = false;

            //Compare ranking from last poule round with internal summing ranking of all poule rounds.
            for (int i = 0; i < rankListAllPouleRounds.Count; i++)
            {
                pouleFencer = lastPouleRound.getNextFencer();

                if (different)
                {
                    if (pouleFencer.PhaseFinalRanking == lastPhaseFinalRanking)
                    {
                        different = false;
                        continue;
                    }
                    lastPouleRound.resetFencerIndex();
                    qualifyLastRankLast = true;
                    return;
                }

                //Skips all eliminated, excluded, abandoned and scratched fencers.
                if (pouleFencer.IsStillInTheCompetition && rankListAllPouleRounds[i].IsStillInTheCompetition)
                {
                    if (rankListAllPouleRounds[i].ID != pouleFencer.ID)
                    {
                        different = true;
                    }
                }
                lastPhaseFinalRanking = pouleFencer.PhaseFinalRanking;
            }

            //If the last fencer is different.
            if (different)
            {
                qualifyLastRankLast = true;
                return;
            }

            lastPouleRound.resetFencerIndex();
            qualifyAllRankAll = true;
        }