[longomatch] Start documention and fix code style
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [longomatch] Start documention and fix code style
- Date: Wed, 18 Nov 2009 20:53:27 +0000 (UTC)
commit 6034ae8d83ab32afb6dcd2d8cc5893c6643bceae
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Wed Nov 18 21:45:46 2009 +0100
Start documention and fix code style
LongoMatch/Time/Drawing.cs | 44 +++--
LongoMatch/Time/DrawingsList.cs | 80 +++++++++
LongoMatch/Time/HotKey.cs | 102 +++++++----
LongoMatch/Time/MediaTimeNode.cs | 312 ++++++++++++++++++++++++----------
LongoMatch/Time/PixbufTimeNode.cs | 60 +++++---
LongoMatch/Time/PlayListTimeNode.cs | 74 ++++++---
LongoMatch/Time/Player.cs | 97 ++++++++---
LongoMatch/Time/SectionsTimeNode.cs | 64 ++++++--
LongoMatch/Time/Time.cs | 136 +++++++++------
LongoMatch/Time/TimeNode.cs | 124 ++++++++-------
10 files changed, 750 insertions(+), 343 deletions(-)
---
diff --git a/LongoMatch/Time/Drawing.cs b/LongoMatch/Time/Drawing.cs
index a6a0aca..6b8ffb9 100644
--- a/LongoMatch/Time/Drawing.cs
+++ b/LongoMatch/Time/Drawing.cs
@@ -1,58 +1,66 @@
-//
+//
// Copyright (C) 2009 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
+//
using System;
using Gdk;
namespace LongoMatch.TimeNodes
{
+ /* Represent a drawing in the database using a { Gdk Pixbuf} stored
+ in a bytes array in PNG format for serialization. { Drawings}
+ are used by { MediaTimeNodes} to store the key frame drawing
+ which stop time time is stored in a int value
+ */
+
[Serializable]
public class Drawing
{
private byte[] drawingBuf;
private readonly int stopTime;
-
-
- public Drawing(){
+
+
+ public Drawing() {
}
-
+
public Drawing(Pixbuf drawing,int stopTime)
{
Pixbuf = drawing;
this.stopTime = stopTime;
}
-
- public Pixbuf Pixbuf{
- get{
+
+ public Pixbuf Pixbuf {
+ get {
if (drawingBuf != null)
return new Pixbuf(drawingBuf);
else return null;
}
set {
- if(value != null)
+ if (value != null)
drawingBuf = value.SaveToBuffer("png");
else
drawingBuf = null;
}
- }
-
- public int StopTime{
- get{return stopTime;}
- }
+ }
+
+ public int StopTime {
+ get {
+ return stopTime;
+ }
+ }
}
}
diff --git a/LongoMatch/Time/DrawingsList.cs b/LongoMatch/Time/DrawingsList.cs
new file mode 100644
index 0000000..8bb0cba
--- /dev/null
+++ b/LongoMatch/Time/DrawingsList.cs
@@ -0,0 +1,80 @@
+//
+// Copyright (C) 2009 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+
+using System;
+using System.Collections.Generic;
+
+namespace LongoMatch.TimeNodes
+{
+
+
+ public class DrawingsList
+ {
+ private SortedList<int,Drawing> drawingsList;
+
+ public DrawingsList()
+ {
+ drawingsList = new SortedList<int,Drawing>();
+ }
+
+ public bool Add(Drawing drawing) {
+ int stopTime = drawing.StopTime;
+ if (!drawingsList.ContainsKey(stopTime)) {
+ drawingsList.Add(stopTime,drawing);
+ return true;
+ }
+ else return false;
+ }
+
+ public bool Remove(Drawing drawing) {
+ int stopTime = drawing.StopTime;
+ return drawingsList.Remove(stopTime);
+ }
+
+ protected void Clear() {
+ drawingsList.Clear();
+ }
+
+ public int Count {
+ get {
+ return drawingsList.Count;
+ }
+ }
+
+ public IList<int> StopTimes {
+ get {
+ return drawingsList.Keys;
+ }
+ }
+
+ public int GetStopTime(int index) {
+ return drawingsList.Keys[index];
+ }
+
+ public Drawing GetStopDrawing(int index) {
+ return drawingsList.Values[index];
+ }
+
+ public SortedList<int,Drawing> List {
+ get {
+ return drawingsList;
+ }
+ }
+
+ }
+}
diff --git a/LongoMatch/Time/HotKey.cs b/LongoMatch/Time/HotKey.cs
index 9f666d2..f9cf29a 100644
--- a/LongoMatch/Time/HotKey.cs
+++ b/LongoMatch/Time/HotKey.cs
@@ -12,7 +12,7 @@
// 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.
@@ -28,66 +28,95 @@ using Mono.Unix;
namespace LongoMatch.TimeNodes
{
-
+
+ /// <summary>
+ /// I am key combination used to tag plays using the keyboard. <see cref="LongoMatch.TimeNodes.SectionsTimeNodes"/>
+ /// uses me to create plays without using the mouse. I can only be used with Shith and Alt
+ /// modifiers to avoid interfering with ohter shortcuts. In case I'am not associated to any
+ /// key combinatio 'key' and 'modifier' will be set to -1
+ /// </summary>
public class HotKey : IEquatable<HotKey>
{
private int key;
private int modifier;
-
-#region Constructors
+
+ #region Constructors
+ /// <summary>
+ /// Creates a new undefined HotKey
+ /// </summary>
public HotKey()
{
this.key = -1;
this.modifier = -1;
}
-#endregion
-
-
-#region Properties
- public Gdk.Key Key{
- get{return (Gdk.Key)key;}
- set{key = (int)value;}
+ #endregion
+
+ #region Properties
+ /// <value>
+ /// My keyboard key
+ /// </value>
+ public Gdk.Key Key {
+ get {
+ return (Gdk.Key)key;
+ }
+ set {
+ key = (int)value;
+ }
}
-
- public Gdk.ModifierType Modifier{
- get{return (Gdk.ModifierType)modifier;}
- set{modifier= (int)value; }
+
+ /// <value>
+ /// My keyboard modifier. Only Alt and Shift can be used
+ /// </value>
+ public Gdk.ModifierType Modifier {
+ get {
+ return (Gdk.ModifierType)modifier;
+ }
+ set {
+ modifier= (int)value;
+ }
}
-
- public Boolean Defined{
- get{return (key!=-1 && modifier != -1);}
+
+ /// <value>
+ /// Whether I am defined or not
+ /// </value>
+ public Boolean Defined {
+ get {
+ return (key!=-1 && modifier != -1);
+ }
}
-
- public bool Equals(HotKey hotkeyComp){
+ #endregion
+
+ #region Public Methods
+ public bool Equals(HotKey hotkeyComp) {
return (this.Key == hotkeyComp.Key && this.Modifier == hotkeyComp.Modifier);
}
-
- static public bool operator == (HotKey hk1, HotKey hk2){
+ #endregion
+
+ #region Operators
+ static public bool operator == (HotKey hk1, HotKey hk2) {
return hk1.Equals(hk2);
}
-
- static public bool operator != (HotKey hk1, HotKey hk2){
+
+ static public bool operator != (HotKey hk1, HotKey hk2) {
return !hk1.Equals(hk2);
}
-
-#endregion
-
-#region Override
+ #endregion
+
+ #region Overrides
public override bool Equals (object obj)
{
HotKey hotkey= obj as HotKey;
- if (hotkey != null)
- return Equals(hotkey);
- else
- return false;
+ if (hotkey != null)
+ return Equals(hotkey);
+ else
+ return false;
}
-
+
public override int GetHashCode ()
{
return key ^ modifier;
}
-
public override string ToString ()
{
string modifierS = Catalog.GetString("none");
@@ -97,10 +126,9 @@ namespace LongoMatch.TimeNodes
modifierS = "Alt";
else if (Modifier == ModifierType.ShiftMask)
modifierS = "Shift";
-
+
return string.Format("<{0}>+{1}", modifierS,(Key.ToString()).ToLower());
}
-
-#endregion
+ #endregion
}
}
diff --git a/LongoMatch/Time/MediaTimeNode.cs b/LongoMatch/Time/MediaTimeNode.cs
index 2aa0a11..df20f8c 100644
--- a/LongoMatch/Time/MediaTimeNode.cs
+++ b/LongoMatch/Time/MediaTimeNode.cs
@@ -11,7 +11,7 @@
// 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.
@@ -24,44 +24,66 @@ using Gdk;
namespace LongoMatch.TimeNodes
{
- public enum Team{
+ public enum Team {
NONE = 0,
LOCAL = 1,
VISITOR = 2,
}
-
- /* MediaTimeNode is the main object of the database for { LongoMatch} It' s used to
- store the name of each reference point we want to remind with its start time
- and its stop time, and the data type it belowns to. When we mark a segment in the
- video, this object contains all the information we need to reproduce the
- video sequence again.
- */
+
+ /// <summary>
+ /// I represent a Play in the game, that's why I'm probably the most
+ /// important object of the database.
+ /// I have a name to describe the play as well as a start and a stop { LongoMatch TimeNode Time},
+ /// which sets the play's position in the game's time line.
+ /// I also stores a list a { LongoMatch TimeNode Player} tagged to this play.
+ /// </summary>
+
[Serializable]
public class MediaTimeNode : PixbufTimeNode
{
-
-
+
+
private Team team;
-
+
private uint fps;
-
+
private bool selected;
-
+
private uint startFrame;
-
+
private uint stopFrame;
-
+
private string notes;
-
- private List<int> localPlayersList; //Used to multitag: one play and several players
- // We use the int index of the player in the template,
+
+ private List<int> localPlayersList; //Used for multitagging: one play and several players
+ // We use the int index of the player in the template,
private List<int> visitorPlayersList;// because it's the only unmutable variable
-
+
private Drawing keyFrame;
-
-
-#region Constructors
+
+ /// <summary>
+ /// Creates a new play
+ /// </summary>
+ /// <param name="name">
+ /// A <see cref="System.String"/> with the play's name
+ /// </param>
+ /// <param name="start">
+ /// A <see cref="Time"/> with the play's start time
+ /// </param>
+ /// <param name="stop">
+ /// A <see cref="Time"/> with the play's stop time
+ /// </param>
+ /// <param name="notes">
+ /// A <see cref="System.String"/> with the play's notes
+ /// </param>
+ /// <param name="fps">
+ /// A <see cref="System.UInt32"/> with the frame rate in frames per second
+ /// </param>
+ /// <param name="thumbnail">
+ /// A <see cref="Pixbuf"/> with the play's preview
+ /// </param>
+ #region Constructors
public MediaTimeNode(String name, Time start, Time stop,string notes, uint fps,Pixbuf thumbnail):base (name,start,stop,thumbnail) {
this.notes = notes;
this.team = Team.NONE;
@@ -72,106 +94,212 @@ namespace LongoMatch.TimeNodes
visitorPlayersList = new List<int>();
}
#endregion
-
- #region Properties
-
+
+ #region Properties
+ /// <value>
+ /// Play's notes
+ /// </value>
public string Notes {
- get{return notes;}
- set{notes = value;}
+ get {
+ return notes;
+ }
+ set {
+ notes = value;
+ }
}
-
- public Team Team{
- get{return this.team;}
- set{this.team = value;}
+
+ /// <value>
+ /// The <see cref="LongoMatch.TimeNode.Team"/> associated to this play
+ /// </value>
+ public Team Team {
+ get {
+ return this.team;
+ }
+ set {
+ this.team = value;
+ }
}
-
- public uint Fps{
- get{return this.fps;}
- set{this.fps = value;}
+
+ /// <value>
+ /// Video frameratein frames per second. This value is taken from the
+ /// video file properties and used to translate from seconds
+ /// to frames: second 100 is equivalent to frame 100*fps
+ /// </value>
+ public uint Fps {
+ get {
+ return this.fps;
+ }
+ set {
+ this.fps = value;
+ }
}
-
- public uint CentralFrame{
- get{ return this.StopFrame-((this.TotalFrames)/2);}
+
+ /// <value>
+ /// Central frame number using (stopFrame-startFrame)/2
+ /// </value>
+ public uint CentralFrame {
+ get {
+ return this.StopFrame-((this.TotalFrames)/2);
+ }
}
-
- public uint TotalFrames{
- get{return this.StopFrame-this.StartFrame;}
+
+ /// <value>
+ /// Number of frames inside the play's boundaries
+ /// </value>
+ public uint TotalFrames {
+ get {
+ return this.StopFrame-this.StartFrame;
+ }
}
-
+
+ /// <value>
+ /// Start frame number
+ /// </value>
public uint StartFrame {
- get {return startFrame;}
- set {
+ get {
+ return startFrame;
+ }
+ set {
this.startFrame = value;
this.Start = new Time((int)(1000*value/fps));
}
}
-
- public uint StopFrame {
- get {return stopFrame;}
- set {
+
+ /// <value>
+ /// Stop frame number
+ /// </value>
+ public uint StopFrame {
+ get {
+ return stopFrame;
+ }
+ set {
this.stopFrame = value;
this.Stop = new Time((int)(1000*value/fps));
}
}
-
- public uint KeyFrame{
+
+ /// <value>
+ /// Get the key frame number if this play as key frame drawing or 0
+ /// </value>
+ public uint KeyFrame {
get {
if (HasKeyFrame)
return (uint) KeyFrameDrawing.StopTime*fps/1000;
else return 0;
}
}
-
+
+ /// <value>
+ /// Get/Set wheter this play is actually loaded. Used in { LongoMatch Gui Component TimeScale}
+ /// </value>
public bool Selected {
- get {return selected;}
- set{this.selected = value;}
- }
-
- public List<int> LocalPlayers{
- set {localPlayersList = value;}
- get{return localPlayersList;}
- }
-
- public List<int> VisitorPlayers{
- set {visitorPlayersList = value;}
- get{return visitorPlayersList;}
- }
-
- public Drawing KeyFrameDrawing{
- set{keyFrame = value;}
- get{return keyFrame;}
- }
-
- public bool HasKeyFrame{
- get{return keyFrame != null;}
- }
-
-
-
+ get {
+ return selected;
+ }
+ set {
+ this.selected = value;
+ }
+ }
+
+ /// <value>
+ /// Get/Set a list of local players tagged to this play
+ /// </value>
+ public List<int> LocalPlayers {
+ set {
+ localPlayersList = value;
+ }
+ get {
+ return localPlayersList;
+ }
+ }
+
+ /// <value>
+ /// Get/Set a list of visitor players tagged to this play
+ /// </value>
+ public List<int> VisitorPlayers {
+ set {
+ visitorPlayersList = value;
+ }
+ get {
+ return visitorPlayersList;
+ }
+ }
+
+ /// <value>
+ /// Get/Set the key frame's <see cref="LongoMatch.TimeNodes.Drawing"/>
+ /// </value>
+ public Drawing KeyFrameDrawing {
+ set {
+ keyFrame = value;
+ }
+ get {
+ return keyFrame;
+ }
+ }
+
+ /// <value>
+ /// Get wether the play has as defined a key frame
+ /// </value>
+ public bool HasKeyFrame {
+ get {
+ return keyFrame != null;
+ }
+ }
#endregion
-
+
#region Public methods
-
- public bool HasFrame(int frame){
+ /// <summary>
+ /// Check the frame number is inside the play boundaries
+ /// </summary>
+ /// <param name="frame">
+ /// A <see cref="System.Int32"/> with the frame number
+ /// </param>
+ /// <returns>
+ /// A <see cref="System.Boolean"/>
+ /// </returns>
+ public bool HasFrame(int frame) {
return (frame>=startFrame && frame<stopFrame);
}
-
- public void AddLocalPlayer(int index){
+
+ /// <summary>
+ /// Adds a player to the local team player's list
+ /// </summary>
+ /// <param name="index">
+ /// A <see cref="System.Int32"/> with the <see cref="LongoMatch.TimeNode.Player"/> index
+ /// </param>
+ public void AddLocalPlayer(int index) {
localPlayersList.Add(index);
}
-
- public void AddVisitorPlayer(int index){
- visitorPlayersList.Add(index);
+
+ /// <summary>
+ /// Adds a player to the visitor team player's list
+ /// </summary>
+ /// <param name="index">
+ /// A <see cref="System.Int32"/> with the <see cref="LongoMatch.TimeNode.Player"/> index
+ /// </param>
+ public void AddVisitorPlayer(int index) {
+ visitorPlayersList.Add(index);
}
-
- public void RemoveLocalPlayer(int index){
+
+ /// <summary>
+ /// Removes a player from the local team player's list
+ /// </summary>
+ /// <param name="index">
+ /// A <see cref="System.Int32"/> with the <see cref="LongoMatch.TimeNode.Player"/> index
+ /// </param>
+ public void RemoveLocalPlayer(int index) {
localPlayersList.Remove(index);
}
-
- public void RemoveVisitorPlayer(int index){
- visitorPlayersList.Remove(index);
+
+ /// <summary>
+ /// Removes a player from the visitor team player's list
+ /// </summary>
+ /// <param name="index">
+ /// A <see cref="System.Int32"/> with the <see cref="LongoMatch.TimeNode.Player"/> index
+ /// </param>
+ public void RemoveVisitorPlayer(int index) {
+ visitorPlayersList.Remove(index);
}
-
#endregion
- }
+ }
}
diff --git a/LongoMatch/Time/PixbufTimeNode.cs b/LongoMatch/Time/PixbufTimeNode.cs
index 4acc84f..064e1b9 100644
--- a/LongoMatch/Time/PixbufTimeNode.cs
+++ b/LongoMatch/Time/PixbufTimeNode.cs
@@ -11,7 +11,7 @@
// 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.
@@ -23,60 +23,80 @@ using Gdk;
namespace LongoMatch.TimeNodes
{
-
-
+
+ /// <summary>
+ /// I am the base class for all the video segments.
+ /// I have a <see cref="Pixbuf"/> with a thumbnail of the video segment I represent
+ /// </summary>
public class PixbufTimeNode : TimeNode
{
private byte[] thumbnailBuf;
private const int MAX_WIDTH=100;
private const int MAX_HEIGHT=75;
#region Contructors
- public PixbufTimeNode(){
- }
-
+ public PixbufTimeNode() {
+ }
+
+ /// <summary>
+ /// Creates a new PixbufTimeNode object
+ /// </summary>
+ /// <param name="name">
+ /// A <see cref="System.String"/> with my name
+ /// </param>
+ /// <param name="start">
+ /// A <see cref="Time"/> with my start time
+ /// </param>
+ /// <param name="stop">
+ /// A <see cref="Time"/> with my stop time
+ /// </param>
+ /// <param name="thumbnail">
+ /// A <see cref="Pixbuf"/> with my preview
+ /// </param>
public PixbufTimeNode(string name, Time start, Time stop, Pixbuf thumbnail): base (name,start,stop)
{
- if (thumbnail != null){
+ if (thumbnail != null) {
this.thumbnailBuf = thumbnail.SaveToBuffer("png");
thumbnail.Dispose();
}
else thumbnailBuf = null;
}
#endregion
-
+
#region Properties
-
- public Pixbuf Miniature{
- get{
+ /// <value>
+ /// Segment thumbnail
+ /// </value>
+ public Pixbuf Miniature {
+ get {
if (thumbnailBuf != null)
return new Pixbuf(thumbnailBuf);
else return null;
- }set{
+ }set {
if (value != null)
ScaleAndSave(value);
else thumbnailBuf = null;
- }
- }
-
+ }
+ }
+
#endregion
-
+
private void ScaleAndSave(Pixbuf pixbuf) {
int ow,oh,h,w;
-
+
h = ow = pixbuf.Height;
w = oh = pixbuf.Width;
ow = MAX_WIDTH;
oh = MAX_HEIGHT;
- if (w>MAX_WIDTH || h>MAX_HEIGHT){
- double rate = (double)w/(double)h;
+ if (w>MAX_WIDTH || h>MAX_HEIGHT) {
+ double rate = (double)w/(double)h;
if (h>w)
ow = (int) (oh * rate);
else
oh = (int) (ow / rate);
thumbnailBuf = pixbuf.ScaleSimple(ow,oh,Gdk.InterpType.Bilinear).SaveToBuffer("png");
pixbuf.Dispose();
- }
+ }
else thumbnailBuf = pixbuf.SaveToBuffer("png");
}
}
diff --git a/LongoMatch/Time/PlayListTimeNode.cs b/LongoMatch/Time/PlayListTimeNode.cs
index b272b79..37d6170 100644
--- a/LongoMatch/Time/PlayListTimeNode.cs
+++ b/LongoMatch/Time/PlayListTimeNode.cs
@@ -1,4 +1,4 @@
-// PlayListTimeNode.cs
+// PlayListTimeNode.cs
//
// Copyright (C) 2007-2009 Andoni Morales Alastruey
//
@@ -11,7 +11,7 @@
// 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.
@@ -24,7 +24,10 @@ using LongoMatch.Video.Utils;
namespace LongoMatch.TimeNodes
{
-
+ /// <summary>
+ /// I am a special video segment used by <see cref="LongoMatch.Playlist.Playlist"/>.
+ /// I stores the information of the video file I belong to and that's why I am independent of any context.
+ /// </summary>
[Serializable]
public class PlayListTimeNode : TimeNode
{
@@ -33,43 +36,70 @@ namespace LongoMatch.TimeNodes
private bool valid=true; //True if the file exists
#region Constructors
- public PlayListTimeNode(){
+ public PlayListTimeNode() {
}
-
+
+ /// <summary>
+ /// Creates a new playlist element
+ /// </summary>
+ /// <param name="mediaFile">
+ /// A <see cref="MediaFile"/> with my video file's information
+ /// </param>
+ /// <param name="tNode">
+ /// A <see cref="MediaTimeNode"/> with the play I come from
+ /// </param>
public PlayListTimeNode(MediaFile mediaFile, MediaTimeNode tNode) : base(tNode.Name,tNode.Start,tNode.Stop)
{
MediaFile = mediaFile;
-
+
}
#endregion
+
#region Properties
-
- public MediaFile MediaFile{
- set{
+ /// <value>
+ /// My video file
+ /// </value>
+ public MediaFile MediaFile {
+ set {
//PlayListTimeNode is serializable and only primary classes
//can be serialiazed. In case it's a PreviewMidaFile we create
//a new MediaFile object.
- if (value is PreviewMediaFile){
+ if (value is PreviewMediaFile) {
MediaFile mf = new MediaFile(value.FilePath,value.Length,value.Fps,
- value.HasAudio,value.HasVideo,value.VideoCodec,
- value.AudioCodec,value.VideoWidth,value.VideoHeight);
+ value.HasAudio,value.HasVideo,value.VideoCodec,
+ value.AudioCodec,value.VideoWidth,value.VideoHeight);
this.mediaFile= mf;
}
else this.mediaFile = value;
}
- get{ return this.mediaFile;}
+ get {
+ return this.mediaFile;
+ }
}
-
- public float Rate{
- set{ this.rate = value;}
- get{ return this.rate;}
+
+ /// <value>
+ /// My play rate
+ /// </value>
+ public float Rate {
+ set {
+ this.rate = value;
+ }
+ get {
+ return this.rate;
+ }
}
-
- public bool Valid{
- get{return this.valid;}
- set{this.valid = value;}
+ //// <value>
+ /// I wont't be valid if my file doesn't exists
+ /// </value>
+ public bool Valid {
+ get {
+ return this.valid;
+ }
+ set {
+ this.valid = value;
+ }
}
- #endregion
+ #endregion
}
}
diff --git a/LongoMatch/Time/Player.cs b/LongoMatch/Time/Player.cs
index cc1f10e..495ee4f 100644
--- a/LongoMatch/Time/Player.cs
+++ b/LongoMatch/Time/Player.cs
@@ -1,27 +1,29 @@
-//
+//
// Copyright (C) 2007-2009 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 Gdk;
namespace LongoMatch.TimeNodes
{
-
+ /// <summary>
+ /// I am a player from a team
+ /// </summary>
[Serializable]
public class Player
{
@@ -29,7 +31,23 @@ namespace LongoMatch.TimeNodes
private string position;
private int number;
private byte[] photo;
-
+
+ /// <summary>
+ /// Creates a new player
+ /// </summary>
+ /// <param name="name">
+ /// A <see cref="System.String"/> with my name
+ /// </param>
+ /// <param name="position">
+ /// A <see cref="System.String"/> with my position in the field
+ /// </param>
+ /// <param name="number">
+ /// A <see cref="System.Int32"/> with my number
+ /// </param>
+ /// <param name="photo">
+ /// A <see cref="Pixbuf"/> with my photo
+ /// </param>
+ #region Constructors
public Player(string name, string position, int number, Pixbuf photo)
{
this.name = name;
@@ -37,35 +55,62 @@ namespace LongoMatch.TimeNodes
this.number = number;
Photo = photo;
}
-
- public string Name{
- get{return name;}
- set{name=value;}
+ #endregion
+
+ #region Properties
+ /// <value>
+ /// My name
+ /// </value>
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name=value;
+ }
}
-
- public string Position{
- get{return position;}
- set{position=value;}
+
+ /// <value>
+ /// My position in the field
+ /// </value>
+ public string Position {
+ get {
+ return position;
+ }
+ set {
+ position=value;
+ }
}
-
- public int Number{
- get{return number;}
- set{number=value;}
+
+ /// <value>
+ /// My shirt number
+ /// </value>
+ public int Number {
+ get {
+ return number;
+ }
+ set {
+ number=value;
+ }
}
-
- public Pixbuf Photo{
- get{
- if(photo != null)
+
+ /// <value>
+ /// My photo
+ /// </value>
+ public Pixbuf Photo {
+ get {
+ if (photo != null)
return new Pixbuf(photo);
else
return null;
}
- set{
- if(value != null)
+ set {
+ if (value != null)
photo=value.SaveToBuffer("png");
- else
+ else
photo=null;
}
}
+ #endregion
}
}
diff --git a/LongoMatch/Time/SectionsTimeNode.cs b/LongoMatch/Time/SectionsTimeNode.cs
index 386d0ac..bdd82d4 100644
--- a/LongoMatch/Time/SectionsTimeNode.cs
+++ b/LongoMatch/Time/SectionsTimeNode.cs
@@ -11,7 +11,7 @@
// 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.
@@ -23,31 +23,65 @@ using Gdk;
namespace LongoMatch.TimeNodes
{
-
-
+
+ /// <summary>
+ /// I am a tagging category for the analysis. I contain the default values to creates plays
+ /// tagged in my category
+ /// </summary>
public class SectionsTimeNode:TimeNode
{
- HotKey hotkey;
+ HotKey hotkey;
Gdk.Color color;
-
+
#region Constructors
+ /// <summary>
+ /// Creates a new category
+ /// </summary>
+ /// <param name="name">
+ /// A <see cref="System.String"/> with the category's name
+ /// </param>
+ /// <param name="start">
+ /// A <see cref="Time"/> with the default lead time
+ /// </param>
+ /// <param name="stop">
+ /// A <see cref="Time"/> with the default lag time
+ /// </param>
+ /// <param name="hotkey">
+ /// A <see cref="HotKey"/> with the hotkey to create new plays in my category
+ /// </param>
+ /// <param name="color">
+ /// A <see cref="Color"/> that will be shared among plays tagged in my category
+ /// </param>
public SectionsTimeNode(String name,Time start, Time stop, HotKey hotkey, Color color):base (name,start,stop)
{
this.hotkey = hotkey;
this.color = color;
}
#endregion
- #region Properties
-
-
- public HotKey HotKey{
- get{return this.hotkey;}
- set{this.hotkey = value;}
+ #region Properties
+
+ /// <value>
+ /// A key combination to create plays in my category
+ /// </value>
+ public HotKey HotKey {
+ get {
+ return this.hotkey;
+ }
+ set {
+ this.hotkey = value;
+ }
}
-
- public Color Color{
- get{return this.color;}
- set{this.color=value;}
+
+ /// <value>
+ /// A color to draw plays from my category
+ /// </value>
+ public Color Color {
+ get {
+ return this.color;
+ }
+ set {
+ this.color=value;
+ }
}
#endregion
}
diff --git a/LongoMatch/Time/Time.cs b/LongoMatch/Time/Time.cs
index 08a73a6..420af4f 100644
--- a/LongoMatch/Time/Time.cs
+++ b/LongoMatch/Time/Time.cs
@@ -11,7 +11,7 @@
// 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.
@@ -22,53 +22,85 @@ using System;
namespace LongoMatch.TimeNodes
{
-
-
+
+ /// <summary>
+ /// I represent a time instant. Other objects uses me to maintain time units consitency.
+ /// I am expressed in miliseconds and I provide some helper methods for time conversion and representation
+ /// </summary>
public class Time : IComparable
{
private int time;
- private const int MS = 1000000 ;
+ private const int MS = 1000000 ;
public const int SECONDS_TO_TIME = 1000;
-
+
#region Constructors
- public Time(){
+ public Time() {
this.time = 0;
}
-
+
+ /// <summary>
+ /// Creates a new time instant
+ /// </summary>
+ /// <param name="time">
+ /// A <see cref="System.Int32"/> with the time expressed in miliseconds
+ /// </param>
public Time(int time)
{
this.time = time;
}
#endregion
+
+ //// <value>
+ /// Time in miliseconds
+ /// </value>
#region Properties
-
public int MSeconds {
- get { return time;}
- set { time = value;}
+ get {
+ return time;
+ }
+ set {
+ time = value;
+ }
}
-
+
+ /// <value>
+ /// Time in seconds
+ /// </value>
public int Seconds {
- get { return time/SECONDS_TO_TIME;}
+ get {
+ return time/SECONDS_TO_TIME;
+ }
}
-
#endregion
+
#region Public methods
-
+ /// <summary>
+ /// String representation in seconds
+ /// </summary>
+ /// <returns>
+ /// A <see cref="System.String"/>
+ /// </returns>
public string ToSecondsString ()
{
int _h, _m, _s;
-
+
_h = (time / 3600);
_m = ((time % 3600) / 60);
_s = ((time % 3600) % 60);
-
+
if (_h > 0)
- return String.Format ("{0}:{1}:{2}", _h, _m.ToString ("d2"),
+ return String.Format ("{0}:{1}:{2}", _h, _m.ToString ("d2"),
_s.ToString ("d2"));
-
+
return String.Format ("{0}:{1}", _m, _s.ToString ("d2"));
}
-
+
+ /// <summary>
+ /// String representation including the milisenconds information
+ /// </summary>
+ /// <returns>
+ /// A <see cref="System.String"/>
+ /// </returns>
public string ToMSecondsString ()
{
int _h, _m, _s,_ms,_time;
@@ -77,75 +109,69 @@ namespace LongoMatch.TimeNodes
_m = ((_time % 3600) / 60);
_s = ((_time % 3600) % 60);
_ms = ((time % 3600000)%60000)%1000;
-
+
//if (_h > 0)
- return String.Format ("{0}:{1}:{2},{3}", _h, _m.ToString ("d2"),
- _s.ToString ("d2"),_ms.ToString("d3"));
-
+ return String.Format ("{0}:{1}:{2},{3}", _h, _m.ToString ("d2"),
+ _s.ToString ("d2"),_ms.ToString("d3"));
+
//return String.Format ("{0}:{1},{2}", _m, _s.ToString ("d2"),_ms.ToString("d3"));
}
-
+
public override bool Equals (object o)
{
- if (o is Time){
+ if (o is Time) {
return ((Time)o).MSeconds == MSeconds;
}
else return false;
}
-
+
public override int GetHashCode ()
{
return base.GetHashCode ();
}
-
-
public int CompareTo(object obj) {
- if(obj is Time)
+ if (obj is Time)
{
Time otherTime = (Time) obj;
return MSeconds.CompareTo(otherTime.MSeconds);
}
-
- else
- {
- throw new ArgumentException("Object is not a Temperature");
- }
+ else throw new ArgumentException("Object is not a Temperature");
}
-
#endregion
#region Operators
-
- public static bool operator < (Time t1,Time t2){
+ public static bool operator < (Time t1,Time t2) {
return t1.MSeconds < t2.MSeconds;
}
- public static bool operator > (Time t1,Time t2){
+
+ public static bool operator > (Time t1,Time t2) {
return t1.MSeconds > t2.MSeconds;
}
- public static bool operator <= (Time t1,Time t2){
+
+ public static bool operator <= (Time t1,Time t2) {
return t1.MSeconds <= t2.MSeconds;
}
- public static bool operator >= (Time t1,Time t2){
+
+ public static bool operator >= (Time t1,Time t2) {
return t1.MSeconds >= t2.MSeconds;
}
- public static Time operator +(Time t1,int t2){
- return new Time(t1.MSeconds+t2);
- }
-
- public static Time operator +(Time t1,Time t2){
- return new Time(t1.MSeconds+t2.MSeconds);
+
+ public static Time operator +(Time t1,int t2) {
+ return new Time(t1.MSeconds+t2);
}
-
- public static Time operator -(Time t1,Time t2){
- return new Time(t1.MSeconds-t2.MSeconds);
+
+ public static Time operator +(Time t1,Time t2) {
+ return new Time(t1.MSeconds+t2.MSeconds);
}
-
- public static Time operator -(Time t1,int t2){
- return new Time(t1.MSeconds-t2);
+
+ public static Time operator -(Time t1,Time t2) {
+ return new Time(t1.MSeconds-t2.MSeconds);
}
-
- #endregion
+ public static Time operator -(Time t1,int t2) {
+ return new Time(t1.MSeconds-t2);
+ }
+ #endregion
}
-}
+}
\ No newline at end of file
diff --git a/LongoMatch/Time/TimeNode.cs b/LongoMatch/Time/TimeNode.cs
index 3139d3f..08b8197 100644
--- a/LongoMatch/Time/TimeNode.cs
+++ b/LongoMatch/Time/TimeNode.cs
@@ -11,7 +11,7 @@
// 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.
@@ -24,98 +24,106 @@ using LongoMatch.TimeNodes;
namespace LongoMatch.TimeNodes
{
-
+
+ /// <summary>
+ /// I am the base class for the time span related objects in the database.
+ /// I have a name that describe me and a start and stop <see cref="LongoMatch.TimeNodes.Time"/>
+ /// </summary>
[Serializable]
public class TimeNode
{
- //Stores the name of the refenrence point
private string name;
- //Stores the start time
private Time start;
- //Stores the stop time
private Time stop;
-
- public TimeNode(){
+ #region Constructors
+ public TimeNode() {
}
-
+
+ /// <summary>
+ /// Creates a TimeNode object
+ /// </summary>
+ /// <param name="name">
+ /// A <see cref="System.String"/> with my name
+ /// </param>
+ /// <param name="start">
+ /// A <see cref="Time"/> with my start time
+ /// </param>
+ /// <param name="stop">
+ /// A <see cref="Time"/> with my stop time
+ /// </param>
public TimeNode(String name,Time start, Time stop)
{
this.name = name;
this.start = start;
- this.stop = stop;
+ this.stop = stop;
}
-
- /**
- * Returns a String object that represents the name of the reference point
- *
- * @returns name Name of the reference point
- */
+ #endregion
+
+ #region Properties
+ /// <value>
+ /// A short description of myself
+ /// </value>
public string Name {
- get{
- return this.name;
+ get {
+ return this.name;
}
- set{
- this.name=value;
-
+ set {
+ this.name=value;
}
}
-
-
- /**
- * Returns a Time object representing the start time of the video sequence
- *
- * @returns Start time
- */
- public Time Start{
- get{
- return this.start;
+ //// <value>
+ /// My start time
+ /// </value>
+ public Time Start {
+ get {
+ return this.start;
}
-
- set{
+ set {
this.start=value;
}
-
}
- /**
- * Returns a Time object representing the stop time of the video sequence
- *
- * @returns Stop time
- */
+ /// <value>
+ /// My stop time
+ /// </value>
public Time Stop {
- get{
- return stop;
+ get {
+ return stop;
}
- set{
+ set {
this.stop = value;
}
}
-
+
+ /// <value>
+ /// My duration
+ /// </value>
public Time Duration {
- get {return Stop-Start;}
+ get {
+ return Stop-Start;
+ }
}
-
-
+ #endregion
- /**
- * Returns a String object that represents the name of the reference point
- *
- * @returns name Name of the reference point
- */
- public string toString() {
- return name;
- }
-
- public void changeStartStop(Time start, Time stop) {
+ #region Public methods
+
+ /// <summary>
+ /// Change my boundaries
+ /// </summary>
+ /// <param name="start">
+ /// My new start <see cref="Time"/>
+ /// </param>
+ /// <param name="stop">
+ /// My new stop <see cref="Time"/>
+ /// </param>
+ public void ChangeStartStop(Time start, Time stop) {
this.start = start;
this.stop = stop;
}
-
-
-
+ #endregion
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]