[longomatch] Add missing file and update makefiles
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Add missing file and update makefiles
- Date: Wed, 24 Sep 2014 20:26:21 +0000 (UTC)
commit 076096bd2f7f592cbd83319d4ee5a6800f39f54c
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Mon Sep 8 12:31:49 2014 +0200
Add missing file and update makefiles
LongoMatch.Core/LongoMatch.Core.mdp | 2 +-
LongoMatch.Core/Makefile.am | 2 +-
LongoMatch.Core/Stats/EventTypeStats.cs | 92 +++++++++++++++++++++++++++++++
3 files changed, 94 insertions(+), 2 deletions(-)
---
diff --git a/LongoMatch.Core/LongoMatch.Core.mdp b/LongoMatch.Core/LongoMatch.Core.mdp
index 8527449..04e2f8e 100644
--- a/LongoMatch.Core/LongoMatch.Core.mdp
+++ b/LongoMatch.Core/LongoMatch.Core.mdp
@@ -74,7 +74,6 @@
<File subtype="Code" buildaction="Compile" name="Common/Color.cs" />
<File subtype="Directory" buildaction="Compile" name="Stats" />
<File subtype="Code" buildaction="Compile" name="Stats/ProjectStats.cs" />
- <File subtype="Code" buildaction="Compile" name="Stats/CategoryStats.cs" />
<File subtype="Code" buildaction="Compile" name="Stats/PercentualStat.cs" />
<File subtype="Code" buildaction="Compile" name="Stats/Stat.cs" />
<File subtype="Code" buildaction="Compile" name="Stats/PlayersStats.cs" />
@@ -143,6 +142,7 @@
<File subtype="Code" buildaction="Compile" name="StyleConf.cs" />
<File subtype="Code" buildaction="Compile" name="Store/EventType.cs" />
<File subtype="Code" buildaction="Compile" name="Store/TimelineEvent.cs" />
+ <File subtype="Code" buildaction="Compile" name="Stats/EventTypeStats.cs" />
</Contents>
<References>
<ProjectReference type="Package" localcopy="True" refto="System, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
diff --git a/LongoMatch.Core/Makefile.am b/LongoMatch.Core/Makefile.am
index b3173d3..4245352 100644
--- a/LongoMatch.Core/Makefile.am
+++ b/LongoMatch.Core/Makefile.am
@@ -57,7 +57,7 @@ SOURCES = Common/Area.cs \
Interfaces/Multimedia/IRemuxer.cs \
Interfaces/Multimedia/IVideoConverter.cs \
Interfaces/Multimedia/IVideoEditor.cs \
- Stats/CategoryStats.cs \
+ Stats/EventTypeStats.cs \
Stats/PercentualStat.cs \
Stats/PlayersStats.cs \
Stats/ProjectStats.cs \
diff --git a/LongoMatch.Core/Stats/EventTypeStats.cs b/LongoMatch.Core/Stats/EventTypeStats.cs
new file mode 100644
index 0000000..6d57c69
--- /dev/null
+++ b/LongoMatch.Core/Stats/EventTypeStats.cs
@@ -0,0 +1,92 @@
+//
+// Copyright (C) 2012 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+using System;
+using System.Linq;
+using System.Collections.Generic;
+
+using LongoMatch.Core.Interfaces;
+using LongoMatch.Core.Store;
+using LongoMatch.Core.Common;
+
+namespace LongoMatch.Core.Stats
+{
+ public class EventTypeStats: Stat
+ {
+ List<TimelineEvent> events, homeEvents, awayEvents;
+ EventType eventType;
+ Project project;
+ EventsFilter filter;
+
+ public EventTypeStats (Project project, EventsFilter filter, EventType evType)
+ {
+ Name = evType.Name;
+ events = new List<TimelineEvent>();
+ this.project = project;
+ this.filter = filter;
+ this.eventType = evType;
+ }
+
+ public void Update ()
+ {
+ events = project.EventsByType (eventType).Where (filter.IsVisible).ToList ();
+ homeEvents = events.Where (e => project.PlayTaggedTeam (e) == Team.LOCAL).ToList ();
+ awayEvents = events.Where (e => project.PlayTaggedTeam (e) == Team.LOCAL).ToList ();
+ TotalCount = events.Count;
+ LocalTeamCount = homeEvents.Count;
+ VisitorTeamCount = homeEvents.Count;
+ List<Tag> tags = events.SelectMany (e => e.Tags).Distinct ().ToList ();
+ }
+
+ public List<SubCategoryStat> SubcategoriesStats {
+ get;
+ protected set;
+ }
+
+ public EventType Category {
+ get {
+ return eventType;
+ }
+ }
+
+ public List<Coordinates> GetFieldCoordinates (Team team, FieldPositionType pos)
+ {
+ List<TimelineEvent> evts;
+
+ switch (team) {
+ case Team.LOCAL:
+ evts = homeEvents;
+ break;
+ case Team.VISITOR:
+ evts = awayEvents;
+ break;
+ default:
+ evts = events;
+ break;
+ }
+ switch (pos) {
+ case FieldPositionType.Field:
+ return evts.Select (e=>e.FieldPosition).ToList();
+ case FieldPositionType.HalfField:
+ return evts.Select (e=>e.HalfFieldPosition).ToList();
+ default:
+ return evts.Select (e=>e.GoalPosition).ToList();
+ }
+ }
+ }
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]