[longomatch] Set backrounds at project level in stats



commit a8d36a6978921f962c8353ba7fcd49818a0d115d
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Aug 7 19:02:46 2013 +0200

    Set backrounds at project level in stats

 LongoMatch.Core/Stats/CategoryStats.cs             |   12 ------------
 LongoMatch.Core/Stats/ProjectStats.cs              |   19 ++++++++++++++++---
 .../Gui/Component/Stats/CategoriesViewer.cs        |    6 ++----
 3 files changed, 18 insertions(+), 19 deletions(-)
---
diff --git a/LongoMatch.Core/Stats/CategoryStats.cs b/LongoMatch.Core/Stats/CategoryStats.cs
index 943e16b..c25971f 100644
--- a/LongoMatch.Core/Stats/CategoryStats.cs
+++ b/LongoMatch.Core/Stats/CategoryStats.cs
@@ -48,18 +48,6 @@ namespace LongoMatch.Stats
                        }
                }
                
-               public Image Field {
-                       get; set;
-               }
-               
-               public Image HalfField {
-                       get; set;
-               }
-               
-               public Image Goal {
-                       get; set;
-               }
-               
                public List<Coordinates> FieldCoordinates {
                        get; set;
                }
diff --git a/LongoMatch.Core/Stats/ProjectStats.cs b/LongoMatch.Core/Stats/ProjectStats.cs
index a85543a..47802c1 100644
--- a/LongoMatch.Core/Stats/ProjectStats.cs
+++ b/LongoMatch.Core/Stats/ProjectStats.cs
@@ -81,6 +81,18 @@ namespace LongoMatch.Stats
                        set;
                }
                
+               public Image Field {
+                       get; set;
+               }
+               
+               public Image HalfField {
+                       get; set;
+               }
+               
+               public Image Goal {
+                       get; set;
+               }
+       
                public List<CategoryStats> CategoriesStats {
                        get {
                                return catStats;
@@ -105,6 +117,10 @@ namespace LongoMatch.Stats
                void UpdateStats (Project project) {
                        catStats.Clear();
                        
+                       Field = project.Categories.FieldBackground;
+                       HalfField = project.Categories.HalfFieldBackground;
+                       Goal = project.Categories.GoalBackground;
+                       
                        foreach (Category cat in project.Categories) {
                                CategoryStats stats;
                                List<Play> plays, homePlays, awayPlays;
@@ -115,9 +131,6 @@ namespace LongoMatch.Stats
                                awayPlays =plays.Where(p => p.Team == Team.VISITOR || p.Team == 
Team.BOTH).ToList();
                                stats = new CategoryStats(cat, plays.Count, homePlays.Count(), 
awayPlays.Count());
                                /* Fill zonal tagging stats */
-                               stats.Field = project.Categories.FieldBackground;
-                               stats.HalfField = project.Categories.HalfFieldBackground;
-                               stats.Goal = project.Categories.GoalBackground;
                                stats.FieldCoordinates = plays.Select (p => p.FieldPosition).Where(p =>p != 
null).ToList();
                                stats.HalfFieldCoordinates = plays.Select (p => p.HalfFieldPosition).Where(p 
=>p != null).ToList();
                                stats.GoalCoordinates = plays.Select (p => p.GoalPosition).Where(p =>p != 
null).ToList();
diff --git a/LongoMatch.GUI/Gui/Component/Stats/CategoriesViewer.cs 
b/LongoMatch.GUI/Gui/Component/Stats/CategoriesViewer.cs
index 3255f0d..a14cccf 100644
--- a/LongoMatch.GUI/Gui/Component/Stats/CategoriesViewer.cs
+++ b/LongoMatch.GUI/Gui/Component/Stats/CategoriesViewer.cs
@@ -43,7 +43,6 @@ namespace LongoMatch.Gui.Component.Stats
                
                public void LoadStats (ProjectStats pstats) {
                        TreeIter iter;
-                       CategoryStats st;
                        
                        store.Clear();
                        foreach (CategoryStats cstats in pstats.CategoriesStats) {
@@ -53,9 +52,8 @@ namespace LongoMatch.Gui.Component.Stats
                        treeview.Selection.SelectIter(iter);
                        categoryviewer1.HomeName = pstats.LocalTeam;
                        categoryviewer1.AwayName = pstats.VisitorTeam;
-                       st = store.GetValue (iter, 0) as CategoryStats;
-                       categoryviewer1.LoadBackgrounds (st.Field, st.HalfField, st.Goal);
-                       categoryviewer1.LoadStats (st);
+                       categoryviewer1.LoadBackgrounds (pstats.Field, pstats.HalfField, pstats.Goal);
+                       categoryviewer1.LoadStats (store.GetValue (iter, 0) as CategoryStats);
                }
                
                void HandleCursorChanged (object sender, EventArgs e)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]