示例#1
0
        /// <summary>
        /// Returns a clone of this fencer.
        /// </summary>
        /// <returns></returns>
        public Object Clone()
        {
            FRCFencer cFencer = new FRCFencer();

            cFencer.Abandoned                = this.Abandoned;
            cFencer.Club                     = this.Club;
            cFencer.Excluded                 = this.Excluded;
            cFencer.ID                       = this.ID;
            cFencer.FencerNumberInPoule      = this.FencerNumberInPoule;
            cFencer.FinalRanking             = this.FinalRanking;
            cFencer.FirstName                = this.FirstName;
            cFencer.Forfait                  = this.Forfait;
            cFencer.HitsGivenInPoule         = this.HitsGivenInPoule;
            cFencer.HitsTakenInPoule         = this.HitsTakenInPoule;
            cFencer.InitialRanking           = this.InitialRanking;
            cFencer.IsStillInTheCompetition  = this.IsStillInTheCompetition;
            cFencer.LastName                 = this.LastName;
            cFencer.Nationality              = this.Nationality;
            cFencer.NumberOfMatchesInPoule   = this.NumberOfMatchesInPoule;
            cFencer.NumberOfVictoriesInPoule = this.NumberOfVictoriesInPoule;
            cFencer.PhaseFinalRanking        = this.PhaseFinalRanking;
            cFencer.PhaseInitialRanking      = this.PhaseInitialRanking;
            cFencer.PouleRanking             = this.PouleRanking;
            cFencer.VM_String                = this.VM_String;

            return(cFencer);
        }
示例#2
0
        /// <summary>
        /// Assigns match results from given match to given strings, and given fencers as fencers in the match.
        /// </summary>
        /// <param name="res1"></param>
        /// <param name="res2"></param>
        /// <param name="fencer1"></param>
        /// <param name="fencer2"></param>
        /// <param name="match"></param>
        private void assignMatchResult(out string res1, out string res2, out FRCFencer fencer1,
                                       out FRCFencer fencer2, FRCMatch match)
        {
            res1    = "";
            res2    = "";
            fencer1 = getFencerMatchingID(match.FencerID1);
            fencer2 = getFencerMatchingID(match.FencerID2);

            if (match.Fencer1Win)
            {
                res1 += "V";
                if (match.ScoreFencer1 < 5)
                {
                    res1 += match.ScoreFencer1.ToString();
                }
                res2 += match.ScoreFencer2.ToString();
            }
            else if (match.Fencer2Win)
            {
                res2 += "V";
                if (match.ScoreFencer2 < 5)
                {
                    res2 += match.ScoreFencer2.ToString();
                }
                res1 += match.ScoreFencer1.ToString();
            }
            else if (match.Fencer1Abandon)
            {
                res1 += "A";
                res2 += "X";
            }
            else if (match.Fencer2Abandon)
            {
                res2 += "A";
                res1 += "X";
            }
            else if (match.Fencer1Forfait)
            {
                res1 += "S";
                res2 += "X";
            }
            else if (match.Fencer2Forfait)
            {
                res2 += "S";
                res1 += "X";
            }
            else if (match.Fencer1Exclusion)
            {
                res1 += "E";
                res2 += "X";
            }
            else if (match.Fencer2Exclusion)
            {
                res2 += "E";
                res1 += "X";
            }
        }
示例#3
0
 /// <summary>
 /// Copying info from given fencer to the fencers in the list of this class.
 /// </summary>
 /// <param name="fencer"></param>
 private void copyFencerInfo(FRCFencer fencer)
 {
     for (int i = 0; i < this.fencer.Count; i++)
     {
         if (this.fencer[i].ID == fencer.ID)
         {
             this.fencer[i] = (FRCFencer)fencer.Clone();
             return;
         }
     }
 }
示例#4
0
        /// <summary>
        /// Registers abandon, forfait, exclusion and IsStillInCompetition from given poule to given fencer.
        /// Since it is not always given in the poule phase.
        /// </summary>
        /// <param name="poule"></param>
        /// <returns></returns>
        private FRCFencer registerFencerStatusInPouleFromMatch(FRCPoule poule, FRCFencer fencer)
        {
            FRCMatch match;

            for (int i = 0; i < poule.amountOfMatches(); i++)
            {
                match = poule.getNextMatch();

                if (fencer.ID == match.FencerID1)
                {
                    if (match.Fencer1Abandon)
                    {
                        fencer.Abandoned = true;
                        fencer.IsStillInTheCompetition = false;
                    }
                    else if (match.Fencer1Forfait)
                    {
                        fencer.Forfait = true;
                        fencer.IsStillInTheCompetition = false;
                    }
                    else if (match.Fencer1Exclusion)
                    {
                        fencer.Excluded = true;
                        fencer.IsStillInTheCompetition = false;
                    }
                    return(fencer);
                }
                else if (fencer.ID == match.FencerID2)
                {
                    if (match.Fencer2Abandon)
                    {
                        fencer.Abandoned = true;
                        fencer.IsStillInTheCompetition = false;
                    }
                    else if (match.Fencer2Forfait)
                    {
                        fencer.Forfait = true;
                        fencer.IsStillInTheCompetition = false;
                    }
                    else if (match.Fencer2Exclusion)
                    {
                        fencer.Excluded = true;
                        fencer.IsStillInTheCompetition = false;
                    }
                    return(fencer);
                }
            }

            return(fencer);
        }
示例#5
0
文件: FRCPoule.cs 项目: RobinK2/FRC
 /// <summary>
 /// Sorts fencer after their fencer number in this poule.
 /// </summary>
 public void sortFencersFencerNumberInPoule()
 {
     for (int i = 0; i < fencer.Count - 1; i++)
     {
         for (int j = i + 1; j < fencer.Count; j++)
         {
             if (fencer[i].FencerNumberInPoule > fencer[j].FencerNumberInPoule)
             {
                 FRCFencer tempFencer = fencer[j];
                 fencer[j] = fencer[i];
                 fencer[i] = tempFencer;
             }
         }
     }
 }
示例#6
0
 /// <summary>
 /// Sorts all fencers after their initial rankings.
 /// </summary>
 private void sortFencerInitialRanking()
 {
     for (int i = 0; i < fencer.Count - 1; i++)
     {
         for (int j = i + 1; j < fencer.Count; j++)
         {
             if (fencer[i].InitialRanking > fencer[j].InitialRanking)
             {
                 FRCFencer tempFencer = fencer[j];
                 fencer[j] = fencer[i];
                 fencer[i] = tempFencer;
             }
         }
     }
 }
示例#7
0
 /// <summary>
 /// Sorts fencer after their ranking after this poule round (PhaseFinalRanking). Lowest number first.
 /// </summary>
 public void sortFencerPouleRanking()
 {
     for (int i = 0; i < fencer.Count - 1; i++)
     {
         for (int j = i + 1; j < fencer.Count; j++)
         {
             if (fencer[i].PhaseFinalRanking > fencer[j].PhaseFinalRanking)
             {
                 FRCFencer tempFencer = fencer[j];
                 fencer[j] = fencer[i];
                 fencer[i] = tempFencer;
             }
         }
     }
 }
示例#8
0
        /// <summary>
        /// Registers result from poule round for given fencer to an internal ranking of all poule rounds.
        /// </summary>
        /// <param name="fencer"></param>
        private void registerPouleResult(FRCFencer fencer)
        {
            for (int i = 0; i < this.rankListAllPouleRounds.Count; i++)
            {
                if (this.rankListAllPouleRounds[i].ID == fencer.ID)
                {
                    this.rankListAllPouleRounds[i].IsStillInTheCompetition = fencer.IsStillInTheCompetition;
                    this.rankListAllPouleRounds[i].Abandoned                 = fencer.Abandoned;
                    this.rankListAllPouleRounds[i].Excluded                  = fencer.Excluded;
                    this.rankListAllPouleRounds[i].Forfait                   = fencer.Forfait;
                    this.rankListAllPouleRounds[i].HitsGivenInPoule         += fencer.HitsGivenInPoule;
                    this.rankListAllPouleRounds[i].HitsTakenInPoule         += fencer.HitsTakenInPoule;
                    this.rankListAllPouleRounds[i].NumberOfMatchesInPoule   += fencer.NumberOfMatchesInPoule;
                    this.rankListAllPouleRounds[i].NumberOfVictoriesInPoule += fencer.NumberOfVictoriesInPoule;

                    return;
                }
            }
        }
示例#9
0
        /*
         * /// <summary>
         * /// Returns fencer at current index.
         * /// </summary>
         * /// <returns></returns>
         * public FRCFencer getCurrentFencer()
         * {
         *  if (fencerIdx >= fencer.Count)
         *      return null;
         *
         *  return fencer[fencerIdx];
         * }
         */

        /// <summary>
        /// Copies poule result information from given fencer to fencer in this poule round.
        /// </summary>
        public void CopyPouleResult(FRCFencer fencer)
        {
            for (int i = 0; i < this.fencer.Count; i++)
            {
                if (fencer.ID == this.fencer[i].ID)
                {
                    this.fencer[i].HitsGivenInPoule         = fencer.HitsGivenInPoule;
                    this.fencer[i].HitsTakenInPoule         = fencer.HitsTakenInPoule;
                    this.fencer[i].NumberOfMatchesInPoule   = fencer.NumberOfMatchesInPoule;
                    this.fencer[i].NumberOfVictoriesInPoule = fencer.NumberOfVictoriesInPoule;
                    this.fencer[i].VM        = fencer.VM;
                    this.fencer[i].Forfait   = fencer.Forfait;
                    this.fencer[i].Abandoned = fencer.Abandoned;
                    this.fencer[i].Excluded  = fencer.Excluded;
                    this.fencer[i].VM_String = fencer.VM_String;
                    break;
                }
            }
        }
示例#10
0
        /// <summary>
        /// Register a fencer.
        /// </summary>
        private void registerFencer()
        {
            int    id          = 0;
            string firstName   = "";
            string lastName    = "";
            string nationality = "";
            string club        = "";
            int    result      = 0;

            while (reader.MoveToNextAttribute()) // Read the attributes.
            {
                if (reader.Name == ID)
                {
                    id = int.Parse(reader.Value);
                }
                else if (reader.Name == PRENOM)
                {
                    firstName = reader.Value;
                }
                else if (reader.Name == NOM)
                {
                    lastName = reader.Value;
                }
                else if (reader.Name == NATION)
                {
                    nationality = reader.Value;
                }
                else if (reader.Name == CLUB)
                {
                    club = reader.Value;
                }
                else if (reader.Name == CLASSEMENT)
                {
                    result = int.Parse(reader.Value);
                }

                //Console.Write(" " + reader.Name + "='" + reader.Value + "'");
            }
            FRCFencer competitor = new FRCFencer(id, firstName, lastName, nationality, club, result);

            fencer.Add(competitor);
        }
示例#11
0
文件: FRCTeam.cs 项目: RobinK2/FRC
 /// <summary>
 /// Add a fencer to the poule.
 /// </summary>
 /// <param name="fenc"></param>
 public void addFencer(FRCFencer fencer)
 {
     this.fencer.Add(fencer);
 }
示例#12
0
        /// <summary>
        /// A method to be called from interpretTableau().
        /// </summary>
        private void interpretTireurOrEquipeInTableau()
        {
            FRCCompetitor athlete;

            if (isIndividualCompetition)
            {
                athlete = new FRCFencer();
            }
            else
            {
                athlete = new FRCTeam();
            }

            int i = 0;

            while (reader.MoveToNextAttribute())
            {
                if (reader.Name == REF)
                {
                    athlete.ID = int.Parse(reader.Value);
                    if (isIndividualCompetition) //Copying info from this.fencer if individual competition.
                    {
                        for (i = 0; i < this.fencer.Count; i++)
                        {
                            if (athlete.ID == this.fencer[i].ID)
                            {
                                athlete = (FRCFencer)this.fencer[i].Clone();
                                break;
                            }
                        }
                    }
                    else
                    {
                        for (i = 0; i < this.team.Count; i++)
                        {
                            if (athlete.ID == this.team[i].ID)
                            {
                                athlete = (FRCTeam)this.team[i].Clone();
                                break;
                            }
                        }
                    }
                }
                else if (reader.Name == RANG_INITIAL)
                {
                    athlete.PhaseInitialRanking = int.Parse(reader.Value);
                }
                else if (reader.Name == RANG_FINAL)
                {
                    athlete.PhaseFinalRanking = int.Parse(reader.Value);
                }
                else if (reader.Name == STATUT)
                {
                    if (reader.Value == "A")
                    {
                        athlete.IsStillInTheCompetition = false;
                        athlete.Abandoned = true;
                        if (isIndividualCompetition)
                        {
                            fencer[i].Abandoned = true;
                        }
                        else
                        {
                            team[i].Abandoned = true;
                        }
                    }
                    else if (reader.Value == "F")
                    {
                        athlete.IsStillInTheCompetition = false;
                        athlete.Forfait = true;
                        if (isIndividualCompetition)
                        {
                            fencer[i].Forfait = true;
                        }
                        else
                        {
                            team[i].Forfait = true;
                        }
                    }
                    else if (reader.Value == "E")
                    {
                        athlete.IsStillInTheCompetition = false;
                        athlete.Excluded = true;
                        if (isIndividualCompetition)
                        {
                            fencer[i].Excluded = true;
                        }
                        else
                        {
                            team[i].Excluded = true;
                        }
                    }
                }

                //Console.Write(" " + reader.Name + "='" + reader.Value + "'");
            }
            if (isIndividualCompetition)
            {
                tableau[tableau.Count - 1].addFencer((FRCFencer)athlete);
            }
            else
            {
                tableau[tableau.Count - 1].addTeam((FRCTeam)athlete);
            }
        }
示例#13
0
        /// <summary>
        /// A method to be called from interpretPoule().
        /// </summary>
        private void interpretTireurOrEquipeInPoule()
        {
            FRCCompetitor athlete;

            if (isIndividualCompetition)
            {
                athlete = new FRCFencer();
            }
            else
            {
                athlete = new FRCTeam();
            }

            while (reader.MoveToNextAttribute())
            {
                if (reader.Name == REF)
                {
                    athlete.ID = int.Parse(reader.Value);

                    if (isIndividualCompetition) //Copying info from this.fencer if individual competition
                    {
                        for (int i = 0; i < this.fencer.Count; i++)
                        {
                            if (athlete.ID == this.fencer[i].ID)
                            {
                                athlete = (FRCFencer)fencer[i].Clone();
                                break;
                            }
                        }
                    }
                    else //Copying info from this.team if team competition
                    {
                        for (int i = 0; i < this.team.Count; i++)
                        {
                            if (athlete.ID == this.team[i].ID)
                            {
                                athlete = (FRCTeam)team[i].Clone();
                                break;
                            }
                        }
                    }
                }
                else if (reader.Name == NO_DANS_LA_POULE)
                {
                    athlete.FencerNumberInPoule = int.Parse(reader.Value);
                }
                else if (reader.Name == NB_VICTOIRES)
                {
                    athlete.NumberOfVictoriesInPoule = int.Parse(reader.Value);
                }
                else if (reader.Name == NB_MATCHES)
                {
                    athlete.NumberOfMatchesInPoule = int.Parse(reader.Value);
                }
                else if (reader.Name == TD)
                {
                    athlete.HitsGivenInPoule = int.Parse(reader.Value);
                }
                else if (reader.Name == TR)
                {
                    athlete.HitsTakenInPoule = int.Parse(reader.Value);
                }
                else if (reader.Name == RANG_POULE)
                {
                    try
                    {
                        athlete.PouleRanking = int.Parse(reader.Value);
                    }
                    catch (Exception)
                    {
                        athlete.PouleRanking = 0;
                    }
                }


                //Console.Write(" " + reader.Name + "='" + reader.Value + "'");
            }
            athlete.VM    = (double)athlete.NumberOfVictoriesInPoule / (double)athlete.NumberOfMatchesInPoule;
            athlete.Index = athlete.HitsGivenInPoule - athlete.HitsTakenInPoule;

            if (isIndividualCompetition)
            {
                pouleRound[pouleRound.Count - 1].getCurrentPoule().addFencer((FRCFencer)athlete);
            }
            else
            {
                pouleRound[pouleRound.Count - 1].getCurrentPoule().addTeam((FRCTeam)athlete);
            }
        }
示例#14
0
        /// <summary>
        /// Intreprets the information of the poule round from the xml file.
        /// </summary>
        private void interpretPouleRound()
        {
            if (reader.Name == TOUR_DE_POULES)
            {
                pouleRoundIntro = true;
                poulePhase      = true;
                FRCPouleRound pr = new FRCPouleRound();
                while (reader.MoveToNextAttribute())
                {
                    if (reader.Name == ID)
                    {
                        pr.RoundNumber = int.Parse(reader.Value);
                    }
                    else if (reader.Name == NB_DE_POULES)
                    {
                        pr.NumOfPoules = int.Parse(reader.Value);
                    }
                    else if (reader.Name == NB_QUALIFIES_PAR_INDICE)
                    {
                        pr.NumOfQualifiers = int.Parse(reader.Value);
                    }

                    //Console.Write(" " + reader.Name + "='" + reader.Value + "'");
                }

                pouleRound.Add(pr);
            } //Checks that TIREUR or EQUIPE appears during the intro of the poule round.
            else if ((reader.Name == TIREUR || reader.Name == EQUIPE) && (pouleRoundIntro))
            {
                FRCCompetitor athlete;
                if (isIndividualCompetition)
                {
                    athlete = new FRCFencer();
                }
                else
                {
                    athlete = new FRCTeam();
                }

                int i = -1;

                while (reader.MoveToNextAttribute())
                {
                    if (reader.Name == REF)
                    {
                        athlete.ID = int.Parse(reader.Value);
                        if (isIndividualCompetition) //Copying info from this.fencer if individual competition
                        {
                            for (i = 0; i < this.fencer.Count; i++)
                            {
                                if (athlete.ID == this.fencer[i].ID)
                                {
                                    athlete = (FRCFencer)this.fencer[i].Clone();
                                    break;
                                }
                            }
                        }
                        else //Copying info from this.team if team competition
                        {
                            for (i = 0; i < this.team.Count; i++)
                            {
                                if (athlete.ID == this.team[i].ID)
                                {
                                    athlete = (FRCTeam)this.team[i].Clone();
                                    break;
                                }
                            }
                        }
                    }
                    else if (reader.Name == RANG_INITIAL)
                    {
                        athlete.PhaseInitialRanking = int.Parse(reader.Value);
                        //Sets initial ranking of the competitor.
                        if (isIndividualCompetition)
                        {
                            if (fencer[i].InitialRanking == -1)
                            {
                                fencer[i].InitialRanking = int.Parse(reader.Value);
                            }
                        }
                        else
                        {
                            if (team[i].InitialRanking == -1)
                            {
                                team[i].InitialRanking = int.Parse(reader.Value);
                            }
                        }
                    }
                    else if (reader.Name == RANG_FINAL)
                    {
                        athlete.PhaseFinalRanking = int.Parse(reader.Value);
                    }
                    else if (reader.Name == STATUT)
                    {
                        athlete.NoStatusException = false;
                        if (reader.Value == "Q")
                        {
                            athlete.IsStillInTheCompetition = true;
                        }
                        else if (reader.Value == "N")
                        {
                            athlete.IsStillInTheCompetition = false;
                        }
                        else if (reader.Value == "A")
                        {
                            athlete.IsStillInTheCompetition = false;
                            athlete.Abandoned = true;
                            if (isIndividualCompetition)
                            {
                                fencer[i].Abandoned = true;
                            }
                            else
                            {
                                team[i].Abandoned = true;
                            }
                        }
                        else if (reader.Value == "F")
                        {
                            athlete.IsStillInTheCompetition = false;
                            athlete.Forfait = true;
                            if (isIndividualCompetition)
                            {
                                fencer[i].Forfait = true;
                            }
                            else
                            {
                                team[i].Forfait = true;
                            }
                        }
                        else if (reader.Value == "E")
                        {
                            athlete.IsStillInTheCompetition = false;
                            athlete.Excluded = true;
                            if (isIndividualCompetition)
                            {
                                fencer[i].Excluded = true;
                            }
                            else
                            {
                                team[i].Excluded = true;
                            }
                        }
                    }
                    //Console.Write(" " + reader.Name + "='" + reader.Value + "'");
                }
                if (isIndividualCompetition)
                {
                    pouleRound[pouleRound.Count - 1].addFencer((FRCFencer)athlete);
                }
                else
                {
                    pouleRound[pouleRound.Count - 1].addTeam((FRCTeam)athlete);
                }
            }
        }
示例#15
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;
        }
示例#16
0
        /// <summary>
        /// Interprets info of all teams.
        /// </summary>
        private void interpretEquipe()
        {
            if (!endOfEquipes)
            {
                if (reader.Name == EQUIPE)
                {
                    FRCTeam tempTeam = new FRCTeam();
                    while (reader.MoveToNextAttribute())
                    {
                        if (reader.Name == ID)
                        {
                            tempTeam.ID = int.Parse(reader.Value);
                        }
                        else if (reader.Name == NOM)
                        {
                            tempTeam.Name = reader.Value;
                        }
                        else if (reader.Name == NATION)
                        {
                            tempTeam.Nationality = reader.Value;
                        }
                        else if (reader.Name == CLUB)
                        {
                            tempTeam.Club = reader.Value;
                        }
                        else if (reader.Name == CLASSEMENT)
                        {
                            tempTeam.FinalRanking = int.Parse(reader.Value);
                        }
                    }

                    team.Add(tempTeam);
                }
                else if (reader.Name == TIREUR)
                {
                    FRCFencer tempFencer = new FRCFencer();
                    while (reader.MoveToNextAttribute())
                    {
                        if (reader.Name == ID)
                        {
                            tempFencer.ID = int.Parse(reader.Value);
                        }
                        else if (reader.Name == NOM)
                        {
                            tempFencer.LastName = reader.Value;
                        }
                        else if (reader.Name == PRENOM)
                        {
                            tempFencer.FirstName = reader.Value;
                        }
                        else if (reader.Name == NATION)
                        {
                            tempFencer.Nationality = reader.Value;
                        }
                        else if (reader.Name == CLUB)
                        {
                            tempFencer.Club = reader.Value;
                        }
                    }

                    team[team.Count - 1].addFencer(tempFencer);
                }
            }
        }
示例#17
0
        /// <summary>
        /// Prints a special ranking if the formula is qualifyLastRankAll.
        /// </summary>
        private void printRankingQualifyLastRankAll()
        {
            //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;
            int       amountOfFencers = rankListAllPouleRounds.Count;

            for (int i = 0; i < rankListAllPouleRounds.Count; i++)
            {
                if (rankListAllPouleRounds[i].Forfait || rankListAllPouleRounds[i].Excluded)
                {
                    amountOfFencers--;
                }
            }

            string title = FRCPrinterConstants.RANKING_AFTER_ALL_POULE_ROUNDS + " (" + 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;

            int rank = 1;

            //Rank all qualified fencers.
            for (int i = 0; i < rankListAllPouleRounds.Count; i++)
            {
                if (rankListAllPouleRounds[i].IsStillInTheCompetition)
                {
                    //Skip the assignment if the next fencer has same ranking.
                    if ((i - 1) >= 0)
                    {
                        if (rankListAllPouleRounds[i].PhaseFinalRanking == rankListAllPouleRounds[i - 1].PhaseFinalRanking)
                        {
                            rank++;
                            continue;
                        }
                    }

                    rankListAllPouleRounds[i].PhaseFinalRanking = rank;
                    rank++;
                }
            }
            //Rank all eliminated fencers.
            for (int i = 0; i < rankListAllPouleRounds.Count; i++)
            {
                if (rankListAllPouleRounds[i].Forfait || rankListAllPouleRounds[i].Excluded)
                {
                    continue;
                }

                if (!rankListAllPouleRounds[i].IsStillInTheCompetition)
                {
                    //Skip the assignment if next fencer has same ranking.
                    if ((i - 1) >= 0)
                    {
                        if (rankListAllPouleRounds[i].PhaseFinalRanking == rankListAllPouleRounds[i - 1].PhaseFinalRanking)
                        {
                            rank++;
                            continue;
                        }
                    }

                    rankListAllPouleRounds[i].PhaseFinalRanking = rank;
                    rank++;
                }
            }
            //Sort the fencers after their PhaseFinalRanking.
            for (int i = 0; i < rankListAllPouleRounds.Count - 1; i++)
            {
                for (int j = i + 1; j < rankListAllPouleRounds.Count; j++)
                {
                    if (rankListAllPouleRounds[i].PhaseFinalRanking > rankListAllPouleRounds[j].PhaseFinalRanking)
                    {
                        FRCFencer tempFencer = rankListAllPouleRounds[j];
                        rankListAllPouleRounds[j] = rankListAllPouleRounds[i];
                        rankListAllPouleRounds[i] = tempFencer;
                    }
                }
            }

            //Print all fencers.
            for (int i = 0; i < rankListAllPouleRounds.Count; i++)
            {
                fencer = rankListAllPouleRounds[i];
                //Skip if the fencer got scratch of exclusion.
                if (fencer.PhaseFinalRanking == 0)
                {
                    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.Index.ToString();
                string hs   = fencer.HitsGivenInPoule.ToString();
                string qe;
                string vm_s = fencer.VM.ToString().Replace(',', '.');
                if (vm_s.Length == 1)
                {
                    vm_s += ".";
                }
                vm_s += "000";
                if (vm_s.Length > 5)
                {
                    vm_s = vm_s.Remove(5);
                }

                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);
                    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 + 377 - (ind.Length - 1) * 5, currentYCoordinate);
                }
                else
                {
                    graphics.DrawString(ind, font2, XBrushes.Black, x + 380 - 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();
        }