コード例 #1
0
        /// <summary>
        /// Generates a default report for a match.
        /// </summary>
        /// <param name="match">The match to generate the report for.</param>
        /// <returns>The generated report.</returns>
        public Report GenerateReport(Match match)
        {
            var plotStyle = new PlotStyle()
            {
                TextFont = "Calibri",
                TextSize = 10,
                TextColor = OxyColors.Black,
                BorderColor = OxyColors.DarkGray,
                GridlineColor = OxyColors.LightGray,
                FirstPlayerColor = OxyColor.Parse("#4F81BD"),
                SecondPlayerColor = OxyColor.Parse("#C0504D"),
            };

            // TODO: Swap players!
            var report = new Report();
            report.Sections.Add(new MetadataSection()
                {
                    Subject = string.Format(
                         "{0} {1}, {2} vs. {3}",
                         match.Tournament,
                         match.Round.ToString(),
                         match.FirstPlayer.Name,
                         match.SecondPlayer.Name),
                    Title = "Table Tennis Performance Report",
                    Author = "TODO"
                });
            report.Sections.Add(
                 new HeaderSection()
                {
                    Headline = "Table Tennis Performance Report",
                     Tournament = match.Tournament,
                     Category = match.Category.ToString(),
                     DisabilityClass = match.DisabilityClass.ToString(),
                     Round = match.Round.ToString(),                    
                     Date = match.DateTime
                });
            report.Sections.Add(new BasicInformationSection(match));
            report.Sections.Add(new RallyLengthSection(match, plotStyle));
            report.Sections.Add(new ScoringProcessSection(match, plotStyle));
            report.Sections.Add(new MatchDynamicsSection(match, plotStyle));
            var transitionSection = new TransitionsSection(match);
            report.Sections.Add(transitionSection);
            report.Sections.Add(new TechnicalEfficiencySection(transitionSection.Transitions));
            report.Sections.Add(new RelevanceOfStrokeSection(transitionSection.Transitions, plotStyle));

            return report;
        }
コード例 #2
0
        /// <summary>
        /// Generates a customized report for a match.
        /// </summary>
        /// <param name="match">The match to generate the report for.</param>
        /// <returns>The generated report.</returns>
        public Report GenerateReport(Match match)
        {
            var firstPlayerColor  = _matchPlayerToColorConverter.Convert(MatchPlayer.First, typeof(Color), null, System.Globalization.CultureInfo.CurrentCulture);
            var secondPlayerColor = _matchPlayerToColorConverter.Convert(MatchPlayer.Second, typeof(Color), null, System.Globalization.CultureInfo.CurrentCulture);

            var plotStyle = new PlotStyle()
            {
                TextFont          = "Calibri",
                TextSize          = 10,
                TextColor         = OxyColors.Black,
                BorderColor       = OxyColors.DarkGray,
                GridlineColor     = OxyColors.LightGray,
                FirstPlayerColor  = OxyColor.Parse(firstPlayerColor.ToString()),
                SecondPlayerColor = OxyColor.Parse(secondPlayerColor.ToString())
            };

            var report = new Report();

            if (Abort)
            {
                return(null);
            }

            report.Sections.Add(new MetadataSection()
            {
                Subject = $"{match.Tournament} {match.Round.ToString()}, {match.FirstPlayer.Name} vs. {match.SecondPlayer.Name}",
                Title   = Properties.Resources.report_title,
                Author  = "TUM - Fakultät für Sport- und Gesundheitswissenschaft"
            });

            report.Sections.Add(
                new HeaderSection
            {
                Headline        = Properties.Resources.report_header_headline,
                Tournament      = match.Tournament ?? Properties.Resources.report_header_default_tournament,
                Category        = match.Category.ToString() ?? Properties.Resources.report_header_default_tournament,
                DisabilityClass = (match.DisabilityClass.ToString() == null) ? Properties.Resources.report_header_default_tournament : ((match.DisabilityClass.ToString() == "NoClass") ? "" : match.DisabilityClass.ToString()),
                Round           = match.Round.ToString() ?? Properties.Resources.report_header_default_round,
                Date            = match.DateTime
            });

            report.Sections.Add(new PartSection(Properties.Resources.section_part_general, PartSection.PartType.General));

            report.Sections.Add(new BasicInformationSection(match));
            report.Sections.Add(new ScoringProcessSection(match, plotStyle));

            if (Abort)
            {
                return(null);
            }

            var transitionSection = new TransitionsSection(match);

            if (((List <string>)Customization["general"]).Contains("rallylength"))
            {
                report.Sections.Add(new RallyLengthSection(match, plotStyle));
            }
            if (((List <string>)Customization["general"]).Contains("matchdynamics"))
            {
                report.Sections.Add(new MatchDynamicsSection(match, plotStyle));
            }
            if (((List <string>)Customization["general"]).Contains("transitionmatrix"))
            {
                report.Sections.Add(transitionSection);
            }
            if (((List <string>)Customization["general"]).Contains("techefficiency"))
            {
                report.Sections.Add(new TechnicalEfficiencySection(transitionSection.Transitions));
            }

            if (Abort)
            {
                return(null);
            }

            foreach (var p in (List <object>)Customization["players"])
            {
                if (Abort)
                {
                    return(null);
                }
                if (p is Player)
                {
                    // add sections for requested players (1/2)
                    report.Sections.Add(new PartSection(Properties.Resources.section_part_player, PartSection.PartType.Player)
                    {
                        Player = p as Player
                    });
                    var sectionsCount = report.Sections.Count;

                    AddStrokeSections(report, plotStyle, match, p);
                    if (sectionsCount == report.Sections.Count)
                    {
                        report.Sections.Add(new SectionEmptyWarningSection(p as Player));
                    }
                }
                else if (p is List <Player> )
                {
                    // aggregate all stats for both players
                }
            }

            foreach (var sec in report.Sections)
            {
                if (sec is LargeTableSection)
                {
                    report.Sections.Add(new PartSection(Properties.Resources.part_appendix, PartSection.PartType.Appendix));
                    report.Sections.Add(new TableLegendSection());
                    break;
                }
            }

            return(report);
        }