[longomatch] Add helpers to get the play position tags



commit 8dcf7865f341e49b856bab5afc27986e0a7ea673
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue Jun 17 18:46:31 2014 +0200

    Add helpers to get the play position tags

 LongoMatch.Core/Common/Enums.cs  |    6 ++++++
 LongoMatch.Core/Store/Play.cs    |   30 ++++++++++++++++++++++++++++++
 LongoMatch.Core/Store/Project.cs |   14 +++++++++++++-
 3 files changed, 49 insertions(+), 1 deletions(-)
---
diff --git a/LongoMatch.Core/Common/Enums.cs b/LongoMatch.Core/Common/Enums.cs
index 7b2f4f5..4274ad7 100644
--- a/LongoMatch.Core/Common/Enums.cs
+++ b/LongoMatch.Core/Common/Enums.cs
@@ -221,5 +221,11 @@ namespace LongoMatch.Common
                Large = 50,
                ExtraLarge = 60
        }
+       
+       public enum FieldPositionType {
+               Field,
+               HalfField,
+               Goal
+       }
 }
 
diff --git a/LongoMatch.Core/Store/Play.cs b/LongoMatch.Core/Store/Play.cs
index edf87c1..27265fe 100644
--- a/LongoMatch.Core/Store/Play.cs
+++ b/LongoMatch.Core/Store/Play.cs
@@ -181,6 +181,36 @@ namespace LongoMatch.Store
                #endregion
 
                #region Public methods
+               
+               public Coordinates CoordinatesInFieldPosition (FieldPositionType pos) {
+                       switch (pos) {
+                       case FieldPositionType.Field:
+                               return FieldPosition;
+                       case FieldPositionType.HalfField:
+                               return HalfFieldPosition;
+                       case FieldPositionType.Goal:
+                               return GoalPosition;
+                       }
+                       return null;
+               }
+               
+               public void UpdateCoordinates (FieldPositionType pos, List<Point> points) {
+                       Coordinates co = new Coordinates ();
+                       co.Points = points;
+                       
+                       switch (pos) {
+                       case FieldPositionType.Field:
+                               FieldPosition = co;
+                               break;
+                       case FieldPositionType.HalfField:
+                               HalfFieldPosition = co;
+                               break;
+                       case FieldPositionType.Goal:
+                               GoalPosition = co;
+                               break;
+                       }
+               }
+               
                public override string ToString()
                {
                        return Name + "\n" + Start.ToMSecondsString() + " - " + Stop.ToMSecondsString();
diff --git a/LongoMatch.Core/Store/Project.cs b/LongoMatch.Core/Store/Project.cs
index a795060..761b368 100644
--- a/LongoMatch.Core/Store/Project.cs
+++ b/LongoMatch.Core/Store/Project.cs
@@ -236,7 +236,19 @@ namespace LongoMatch.Store
                public List<Play> PlaysInCategory(Category category) {
                        return Timeline.Where(p => p.Category.ID == category.ID).ToList();
                }
-
+               
+               public Image GetBackground (FieldPositionType pos) {
+                       switch (pos) {
+                       case FieldPositionType.Field:
+                               return Categories.FieldBackground;
+                       case FieldPositionType.HalfField:
+                               return Categories.HalfFieldBackground;
+                       case FieldPositionType.Goal:
+                               return Categories.GoalBackground;
+                       }
+                       return null;
+               }
+               
                public bool Equals(Project project) {
                        if(project == null)
                                return false;


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