[longomatch] Add CameraObject and CameraTimeLine objects.



commit f2e4377eab2cb0592c7a3e40e078b21e0284990e
Author: Julien Moutte <julien fluendo com>
Date:   Tue Mar 10 19:34:09 2015 +0100

    Add CameraObject and CameraTimeLine objects.
    
    We will use them in our future video synchronisation widget.

 LongoMatch.Drawing/CanvasObjects/CameraObject.cs   |   43 ++++++++++++++
 LongoMatch.Drawing/CanvasObjects/TimelineObject.cs |   62 ++++++++++++++++++++
 LongoMatch.Drawing/Makefile.am                     |    1 +
 3 files changed, 106 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch.Drawing/CanvasObjects/CameraObject.cs 
b/LongoMatch.Drawing/CanvasObjects/CameraObject.cs
new file mode 100644
index 0000000..7f07458
--- /dev/null
+++ b/LongoMatch.Drawing/CanvasObjects/CameraObject.cs
@@ -0,0 +1,43 @@
+//
+//  Copyright (C) 2014 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 LongoMatch.Core.Store;
+using LongoMatch.Core.Interfaces.Drawing;
+using LongoMatch.Core.Common;
+
+namespace LongoMatch.Drawing.CanvasObjects
+{
+       public class CameraObject: TimeNodeObject
+       {
+               MediaFile mediaFile;
+
+               public CameraObject (MediaFile mf) : 
+                       base (new TimeNode () { Start = mf.Offset, Stop = mf.Duration + mf.Offset, Name = 
mf.Name })
+               {
+                       mediaFile = mf;
+                       SelectionMode = NodeSelectionMode.Segment;
+               }
+
+               public override string Description {
+                       get {
+                               return mediaFile.Name;
+                       }
+               }
+       }
+}
+
diff --git a/LongoMatch.Drawing/CanvasObjects/TimelineObject.cs 
b/LongoMatch.Drawing/CanvasObjects/TimelineObject.cs
index b910cfe..170de19 100644
--- a/LongoMatch.Drawing/CanvasObjects/TimelineObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/TimelineObject.cs
@@ -366,5 +366,67 @@ namespace LongoMatch.Drawing.CanvasObjects
                        }
                }
        }
+
+       public class CameraTimeline: TimelineObject
+       {
+               public CameraTimeline (MediaFile mediaFile, bool showName, NodeSelectionMode selectionMode, 
bool showLine,
+                       Time maxTime, double offsetY, Color background, Color lineColor):
+               base (maxTime, offsetY, background)
+               {
+                       ShowName = showName;
+                       SelectionMode = selectionMode;
+                       ShowLine = showLine;
+                       LineColor = lineColor;
+
+                       AddMediaFile (mediaFile);
+               }
+
+               Color LineColor {
+                       get;
+                       set;
+               }
+
+               bool ShowLine {
+                       get;
+                       set;
+               }
+
+               bool ShowName {
+                       get;
+                       set;
+               }
+
+               NodeSelectionMode SelectionMode {
+                       get;
+                       set;
+               }
+
+               public void AddMediaFile (MediaFile mediaFile)
+               {
+                       CameraObject co = new CameraObject (mediaFile);
+                       co.OffsetY = OffsetY;
+                       co.SecondsPerPixel = SecondsPerPixel;
+                       co.MaxTime = maxTime;
+                       co.SelectionMode = SelectionMode;
+                       co.ShowName = ShowName;
+                       co.LineColor = LineColor;
+                       AddNode (co);
+               }
+
+               protected override void DrawBackground (IDrawingToolkit tk, Area area)
+               {
+                       double linepos;
+                       base.DrawBackground (tk, area);
+
+                       if (ShowLine) {
+                               linepos = OffsetY + Height - StyleConf.TimelineLineSize;
+                               tk.FillColor = Config.Style.PaletteBackgroundDark;
+                               tk.StrokeColor = Config.Style.PaletteBackgroundDark;
+                               tk.LineWidth = 4;
+                               tk.DrawLine (new Point (0, linepos),
+                                       new Point (Width, linepos));
+                       }
+               }
+       }
 }
 
diff --git a/LongoMatch.Drawing/Makefile.am b/LongoMatch.Drawing/Makefile.am
index 21ca964..5010017 100644
--- a/LongoMatch.Drawing/Makefile.am
+++ b/LongoMatch.Drawing/Makefile.am
@@ -7,6 +7,7 @@ LINK = $(REF_DEP_LONGOMATCH_DRAWING)
 SOURCES = Canvas.cs \
        CanvasObjects/BenchObject.cs \
        CanvasObjects/ButtonObject.cs \
+       CanvasObjects/CameraObject.cs \
        CanvasObjects/CanvasObject.cs \
        CanvasObjects/CardObject.cs \
        CanvasObjects/CategoryObject.cs \


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