[longomatch] Add team colors to differentiate timeline events
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Add team colors to differentiate timeline events
- Date: Sat, 22 Nov 2014 10:54:41 +0000 (UTC)
commit 56c0871e1623926f626e372c914fc20683d997c1
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Tue Nov 18 20:47:43 2014 +0100
Add team colors to differentiate timeline events
LongoMatch.Drawing/CanvasObjects/PlayObject.cs | 28 ++++++++++++----
LongoMatch.Drawing/CanvasObjects/PositionObject.cs | 35 ++++++++++++++------
LongoMatch.Drawing/CanvasObjects/TimelineObject.cs | 7 +++-
LongoMatch.Drawing/Widgets/PlaysTimeline.cs | 2 +-
LongoMatch.Drawing/Widgets/PositionTagger.cs | 10 +++++-
.../Gui/Component/PlaysPositionViewer.cs | 3 ++
6 files changed, 64 insertions(+), 21 deletions(-)
---
diff --git a/LongoMatch.Drawing/CanvasObjects/PlayObject.cs b/LongoMatch.Drawing/CanvasObjects/PlayObject.cs
index 8afd910..db59968 100644
--- a/LongoMatch.Drawing/CanvasObjects/PlayObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/PlayObject.cs
@@ -18,28 +18,32 @@
using System;
using LongoMatch.Core.Store;
using LongoMatch.Core.Interfaces.Drawing;
-using LongoMatch.Core.Interfaces;
using LongoMatch.Core.Common;
-using LongoMatch.Core.Store.Drawables;
namespace LongoMatch.Drawing.CanvasObjects
{
public class PlayObject: TimeNodeObject
{
- public PlayObject (TimelineEvent play):base (play)
+ public PlayObject (TimelineEvent play, Project project):base (play)
{
+ Project = project;
}
public ISurface SelectionLeft {
get;
set;
}
-
+
public ISurface SelectionRight {
get;
set;
}
-
+
+ public Project Project {
+ get;
+ set;
+ }
+
public override string Description {
get {
return Play.Name;
@@ -79,11 +83,21 @@ namespace LongoMatch.Drawing.CanvasObjects
void DrawBorders (IDrawingToolkit tk, double start, double stop, int lineWidth)
{
+ Team team;
+ Color color;
double y1, y2;
tk.LineWidth = lineWidth;
- tk.FillColor = Config.Style.PaletteWidgets;
- tk.StrokeColor = Config.Style.PaletteWidgets;
+ team = Project.PlayTaggedTeam (Play);
+ if (team == Team.LOCAL) {
+ color = Project.LocalTeamTemplate.Color;
+ } else if (team == Team.VISITOR) {
+ color = Project.VisitorTeamTemplate.Color;
+ } else {
+ color = Config.Style.PaletteWidgets;
+ }
+ tk.FillColor = color;
+ tk.StrokeColor = color;
y1 = OffsetY + 6;
y2 = OffsetY + Height - 6;
tk.DrawLine (new Point (start, y1), new Point (start, y2));
diff --git a/LongoMatch.Drawing/CanvasObjects/PositionObject.cs
b/LongoMatch.Drawing/CanvasObjects/PositionObject.cs
index 2efc5b0..9f53479 100644
--- a/LongoMatch.Drawing/CanvasObjects/PositionObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/PositionObject.cs
@@ -54,6 +54,11 @@ namespace LongoMatch.Drawing.CanvasObjects
set;
}
+ public Project Project {
+ get;
+ set;
+ }
+
public TimelineEvent Play {
get;
set;
@@ -126,7 +131,7 @@ namespace LongoMatch.Drawing.CanvasObjects
public override void Draw (IDrawingToolkit tk, Area area)
{
- Color color;
+ Color fillColor, strokeColor;
double relSize;
relSize = Math.Max (1, (double)Width / 200);
@@ -137,23 +142,33 @@ namespace LongoMatch.Drawing.CanvasObjects
tk.Begin ();
if (Play != null) {
- color = Play.Color;
+ fillColor = Play.Color;
+ strokeColor = fillColor;
+ if (Project != null) {
+ Team team = Project.PlayTaggedTeam (Play);
+ if (team == Team.LOCAL) {
+ strokeColor = Project.LocalTeamTemplate.Color;
+ } else if (team == Team.VISITOR) {
+ strokeColor = Project.VisitorTeamTemplate.Color;
+ }
+ }
} else {
- color = Constants.TAGGER_POINT_COLOR;
+ fillColor = strokeColor = Constants.TAGGER_POINT_COLOR;
}
if (Selected) {
- color = Constants.TAGGER_SELECTION_COLOR;
+ fillColor = Constants.TAGGER_SELECTION_COLOR;
} else if (Highlighted) {
- color = Config.Style.PaletteActive;
+ fillColor = Config.Style.PaletteActive;
}
- tk.FillColor = color;
- tk.StrokeColor = color;
- tk.LineWidth = 0;
- tk.DrawCircle (Start, (int)relSize * 2);
+ tk.FillColor = fillColor;
+ tk.StrokeColor = strokeColor;
+ tk.LineWidth = (int)relSize;
+ tk.DrawCircle (Start, relSize * 1.5);
if (Points.Count == 2) {
- tk.LineWidth = (int)relSize * 2;
+ tk.StrokeColor = fillColor;
+ tk.LineWidth = (int)relSize;
tk.DrawLine (Start, Stop);
tk.DrawArrow (Start, Stop, 10, 0.3, true);
}
diff --git a/LongoMatch.Drawing/CanvasObjects/TimelineObject.cs
b/LongoMatch.Drawing/CanvasObjects/TimelineObject.cs
index 03248fc..63af0db 100644
--- a/LongoMatch.Drawing/CanvasObjects/TimelineObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/TimelineObject.cs
@@ -225,11 +225,14 @@ namespace LongoMatch.Drawing.CanvasObjects
public class CategoryTimeline: TimelineObject
{
EventsFilter filter;
+ Project project;
- public CategoryTimeline (List<TimelineEvent> plays, Time maxTime, double offsetY, Color
background, EventsFilter filter):
+ public CategoryTimeline (Project project, List<TimelineEvent> plays, Time maxTime,
+ double offsetY, Color background, EventsFilter filter):
base (maxTime, offsetY, background)
{
this.filter = filter;
+ this.project = project;
foreach (TimelineEvent p in plays) {
AddPlay (p);
}
@@ -247,7 +250,7 @@ namespace LongoMatch.Drawing.CanvasObjects
public void AddPlay (TimelineEvent play)
{
- PlayObject po = new PlayObject (play);
+ PlayObject po = new PlayObject (play, project);
po.SelectionLeft = selectionBorderL;
po.SelectionRight = selectionBorderR;
po.OffsetY = OffsetY;
diff --git a/LongoMatch.Drawing/Widgets/PlaysTimeline.cs b/LongoMatch.Drawing/Widgets/PlaysTimeline.cs
index 329fc20..cfd4b4b 100644
--- a/LongoMatch.Drawing/Widgets/PlaysTimeline.cs
+++ b/LongoMatch.Drawing/Widgets/PlaysTimeline.cs
@@ -201,7 +201,7 @@ namespace LongoMatch.Drawing.Widgets
}
foreach (EventType type in project.EventTypes) {
- tl = new CategoryTimeline (project.EventsByType (type), duration,
+ tl = new CategoryTimeline (project, project.EventsByType (type), duration,
i * StyleConf.TimelineCategoryHeight,
Utils.ColorForRow (i), playsFilter);
AddTimeline (tl, type);
diff --git a/LongoMatch.Drawing/Widgets/PositionTagger.cs b/LongoMatch.Drawing/Widgets/PositionTagger.cs
index e12943a..3750fc4 100644
--- a/LongoMatch.Drawing/Widgets/PositionTagger.cs
+++ b/LongoMatch.Drawing/Widgets/PositionTagger.cs
@@ -42,13 +42,20 @@ namespace LongoMatch.Drawing.Widgets
SelectionMode = MultiSelectionMode.MultipleWithModifier;
}
- public PositionTagger (IWidget widget, List<TimelineEvent> plays, Image background,
FieldPositionType position): base (widget)
+ public PositionTagger (IWidget widget, Project project, List<TimelineEvent> plays,
+ Image background, FieldPositionType position): base (widget)
{
+ Project = project;
Background = background;
Plays = plays;
FieldPosition = position;
}
+ public Project Project {
+ get;
+ set;
+ }
+
public EventsFilter Filter {
get {
return filter;
@@ -127,6 +134,7 @@ namespace LongoMatch.Drawing.Widgets
po = new PositionObject (coords.Points, Background.Width,
Background.Height);
po.Play = play;
+ po.Project = Project;
if (Filter != null) {
po.Visible = Filter.IsVisible (play);
}
diff --git a/LongoMatch.GUI/Gui/Component/PlaysPositionViewer.cs
b/LongoMatch.GUI/Gui/Component/PlaysPositionViewer.cs
index da84fba..721bb3f 100644
--- a/LongoMatch.GUI/Gui/Component/PlaysPositionViewer.cs
+++ b/LongoMatch.GUI/Gui/Component/PlaysPositionViewer.cs
@@ -46,6 +46,9 @@ namespace LongoMatch.Gui.Component
public void LoadProject (Project project, EventsFilter filter) {
this.project = project;
if (project != null) {
+ field.Tagger.Project = project;
+ hfield.Tagger.Project = project;
+ goal.Tagger.Project = project;
field.Tagger.Background = project.GetBackground (FieldPositionType.Field);
hfield.Tagger.Background = project.GetBackground
(FieldPositionType.HalfField);
goal.Tagger.Background = project.GetBackground (FieldPositionType.Goal);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]