public void TestStrings() { Time t = new Time (2323456); Assert.AreEqual (t.ToMSecondsString (false), "38:43,456"); Assert.AreEqual (t.ToMSecondsString (true), "0:38:43,456"); Assert.AreEqual (t.ToSecondsString (false), "38:43"); Assert.AreEqual (t.ToSecondsString (true), "0:38:43"); }
public void TestProperties() { Time t = new Time (12323456); Assert.AreEqual (t.NSeconds, 12323456000000); Assert.AreEqual (t.TotalSeconds, 12323); Assert.AreEqual (t.Hours, 3); Assert.AreEqual (t.Minutes, 25); Assert.AreEqual (t.Seconds, 23); }
public SportDashboardCanvas(IWidget widget) : base(widget) { Accuracy = 5; Mode = DashboardMode.Edit; FitMode = FitMode.Fit; CurrentTime = new Time (0); AddTag = new Tag ("", ""); BackgroundColor = App.Current.Style.PaletteBackground; }
public void ShowMenu(Project project, Timer timer, Time time, TimerTimeline timertimeline) { this.timer = timer; this.time = time; this.project = project; this.timertimeline = timertimeline; delitem.Visible = project != null && timer != null; Popup (); }
public CameraTimeline(MediaFile mediaFile, bool showName, bool showLine, Time maxTime, double offsetY, Color background, Color lineColor) : base(maxTime, StyleConf.TimelineCameraHeight, offsetY, background) { ShowName = showName; ShowLine = showLine; LineColor = lineColor; Height = StyleConf.TimelineCameraHeight; AddMediaFile (mediaFile); }
public PlaysTimeline(IWidget widget) : base(widget) { eventsTimelines = new Dictionary<EventType, CategoryTimeline> (); timelineToFilter = new Dictionary<TimelineObject, object> (); secondsPerPixel = 0.1; Accuracy = Constants.TIMELINE_ACCURACY; SelectionMode = MultiSelectionMode.MultipleWithModifier; SingleSelectionObjects.Add (typeof(TimerTimeNodeObject)); currentTime = new Time (0); }
public FramesSeriesCapturer(MediaFileSet fileSet, TimelineEvent evt, uint interval, string outputDir) { this.capturer = Config.MultimediaToolkit.GetFramesCapturer (); this.fileSet = fileSet; this.evt = evt; this.start = evt.Start; this.stop = evt.Stop; this.interval = interval; this.outputDir = outputDir; this.seriesName = System.IO.Path.GetFileName (outputDir); this.totalFrames = ((int)Math.Floor ((double)((stop - start).MSeconds / interval)) + 1) * evt.CamerasConfig.Count; this.cancel = false; }
public void Seek(SeekType seekType, Time start = null, float rate = 1) { this.seekType = seekType; this.start = start; this.rate = rate; pendingSeek = true; if (waiting) { return; } HandleSeekTimeout (this); waiting = true; timer.Change (timeout, Timeout.Infinite); }
public PlayersTaggerObject() { Position = new Point (0, 0); homeBench = new BenchObject (); awayBench = new BenchObject (); offset = new Point (0, 0); scaleX = scaleY = 1; homePlayerToPlayerObject = new Dictionary<PlayerLongoMatch, SportsPlayerObject> (); awayPlayerToPlayerObject = new Dictionary<PlayerLongoMatch, SportsPlayerObject> (); field = new FieldObject (); SelectedPlayers = new List<PlayerLongoMatch> (); lastTime = null; LoadSubsButtons (); LoadTeamsButtons (); ShowSubsitutionButtons = false; ShowTeamsButtons = false; }
public TimerObject(TimerButton timer) : base(timer) { Button = timer; Toggle = true; CurrentTime = new Time (0); if (iconImage == null) { iconImage = new Image (Path.Combine (Config.ImagesDir, StyleConf.ButtonTimerIcon)); } if (cancelImage == null) { cancelImage = new Image (Path.Combine (Config.IconsDir, StyleConf.CancelButton)); } MinWidth = StyleConf.ButtonMinWidth; MinHeight = iconImage.Height + StyleConf.ButtonTimerFontSize; cancelRect = new Rectangle (); }
public void TestOperators() { Time t1 = new Time (2000); Time t2 = new Time (1000); Assert.IsTrue (t1 > t2); Assert.IsTrue (t2 < t1); t2.MSeconds = 2000; Assert.IsTrue (t1 >= t2); Assert.IsTrue (t1 <= t2); Assert.IsTrue (t1 == t2); t2.MSeconds = 1000; Assert.IsFalse (t1 == t2); t2.MSeconds = 0; Assert.IsTrue (t1 != t2); t2.MSeconds = 1000; Assert.AreEqual ((t1 + 100).MSeconds, 2100); Assert.AreEqual ((t1 - 100).MSeconds, 1900); Assert.AreEqual ((t1 + t2).MSeconds, 3000); Assert.AreEqual ((t1 - t2).MSeconds, 1000); Assert.AreEqual ((t1 * 2).MSeconds, 4000); Assert.AreEqual ((t1 / 2).MSeconds, 1000); }
public void EmitTimeNodeChanged(TimeNode tn, Time time) { if (TimeNodeChanged != null) TimeNodeChanged (tn, time); }
public SportCategoryTimeline(ProjectLongoMatch project, List<TimelineEvent> plays, Time maxTime, double offsetY, Color background, EventsFilter filter) : base(project, plays, maxTime, offsetY, background, filter) { }
public void EmitSeekEvent(Time time, bool accurate) { if (SeekEvent != null) { SeekEvent (time, accurate); } }
public void EmitSubstitutionEvent(Team team, Player p1, Player p2, SubstitutionReason reason, Time time) { if (PlayerSubstitutionEvent != null) { PlayerSubstitutionEvent (team, p1, p2, reason, time); } }
public void EmitNewEvent(EventType eventType, List<Player> players = null, TeamType team = TeamType.NONE, List<Tag> tags = null, Time start = null, Time stop = null, Time eventTime = null, Score score = null, PenaltyCard card = null) { if (NewEventEvent != null) NewEventEvent (eventType, players, team, tags, start, stop, eventTime, score, card, null); }
public void EmitPlayerTick(Time currentTime) { if (PlayerTick != null) { PlayerTick (currentTime); } }
public TimelineObject(Time maxTime, int height, double offsetY, Color background) { this.BackgroundColor = background; this.nodes = new List<TimeNodeObject> (); this.maxTime = maxTime; selectionBorderL = LoadBorder (StyleConf.TimelineSelectionLeft); selectionBorderR = LoadBorder (StyleConf.TimelineSelectionRight); Visible = true; CurrentTime = new Time (0); OffsetY = offsetY; SecondsPerPixel = 0.1; Height = height; }
public void EmitCapturerTick(Time currentTime) { if (CapturerTick != null) { CapturerTick (currentTime); } }
public TimerTimeline(List<Timer> timers, bool showName, NodeDraggingMode draggingMode, bool showLine, Time maxTime, int height, double offsetY, Color background, Color lineColor) : base(maxTime, height, offsetY, background) { this.timers = timers; ShowName = showName; DraggingMode = draggingMode; ShowLine = showLine; LineColor = lineColor; ReloadPeriods (timers); }
void HandleTimeruleSeek(Time pos, bool accurate, bool synchronous = false, bool throttled = false) { Seek (new SeekEvent { Time = pos, Accurate = accurate, Synchronous = synchronous, Throttled = throttled }); }
void HandleShowTimerMenuEvent(Timer timer, Time time) { if (!FixedPeriods) menu.ShowMenu (project, timer, time, camerasTimeline.PeriodsTimeline, camerasTimeline); }
public void CaptureFrames() { Time pos; LongoMatch.Core.Common.Image frame; List<CameraConfig> cameras; bool quit = false; int i = 0; int j = 0; System.IO.Directory.CreateDirectory (outputDir); Log.Debug ("Start frames series capture with interval: " + interval); Log.Debug ("Total frames to be captured: " + totalFrames); if (evt.CamerasConfig.Count == 0 || fileSet.Count == 1) { cameras = new List<CameraConfig> { new CameraConfig (0) }; } else { cameras = evt.CamerasConfig; } foreach (CameraConfig cameraConfig in cameras) { MediaFile file; if (quit) { break; } Log.Debug ("Start frames series capture for angle " + cameraConfig.Index); try { file = fileSet [cameraConfig.Index]; } catch (Exception ex) { Log.Exception (ex); Log.Error (string.Format ("Camera index {0} not found in fileset", cameraConfig.Index)); continue; } capturer.Open (file.FilePath); pos = new Time { MSeconds = start.MSeconds }; if (Progress != null) { Application.Invoke (delegate { Progress (i, totalFrames, null); }); } j = 0; while (pos <= stop) { Log.Debug ("Capturing fame " + j); if (!cancel) { frame = capturer.GetFrame (pos + file.Offset, true); if (frame != null) { string path = String.Format ("{0}_angle{1}_{2}.png", seriesName, cameraConfig.Index, j); frame.Save (System.IO.Path.Combine (outputDir, path)); frame.ScaleInplace (THUMBNAIL_MAX_WIDTH, THUMBNAIL_MAX_HEIGHT); } if (Progress != null) { Application.Invoke (delegate { Progress (i + 1, totalFrames, frame); }); } pos.MSeconds += (int)interval; i++; j++; } else { Log.Debug ("Capture cancelled, deleting output directory"); System.IO.Directory.Delete (outputDir, true); cancel = false; quit = true; break; } } } capturer.Dispose (); }
public TimerTimeline(List<Timer> timers, bool showName, NodeDraggingMode draggingMode, bool showLine, Time maxTime, double offsetY, Color background, Color lineColor) : this(timers, showName, draggingMode, showLine, maxTime, StyleConf.TimelineCategoryHeight, offsetY, background, lineColor) { }
/// <summary> /// 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 is stored in a int value /// </summary> public FrameDrawing() { Pause = new Time (DEFAULT_PAUSE_TIME); Drawables = new List<Drawable> (); }
void HandleNewTagEvent(EventType evntType, List<Player> players, TeamType team, List<Tag> tags, Time start, Time stop, Time eventTime, Score score, PenaltyCard card, DashboardButton btn) { /* Forward event until we have players integrted in the dashboard layout */ if (NewTagEvent != null) { NewTagEvent (evntType, players, team, tags, start, stop, eventTime, score, card, btn); } //Config.EventsBroker.EmitNewTag (button, players, tags, start, stop); }
/// <summary> /// Handles the tick from media player to update Current Time in timelines. /// </summary> /// <param name="currentTime">Current time.</param> void HandleTick(Time currentTime, Time duration, bool seekable) { // Cache current time, the UI timeout will come and pick it up nextCurrentTime = currentTime; CameraObject camera = camerasTimeline.SelectedCamera; // Detect when secondary camera goes in and out of scope while main camera is playing. if (camera != null) { if (IsInScope (camera)) { if (ShowSecondaryPlayer ()) { // If the player was shown, resync. SyncSecondaryPlayer (); } } else { ShowDidactic (DidacticMessage.CameraOutOfScope); } } }
void HandleTick(Time currentTime) { tagger.CurrentTime = currentTime; }
public static void RenderSubstitution(Color color, Time evt, Player playerIn, Player playerOut, bool selected, bool isExpanded, IDrawingToolkit tk, IContext context, Area backgroundArea, Area cellArea, CellState state) { Point selectPoint, textPoint, imagePoint, circlePoint; Point inPoint, imgPoint, outPoint, timePoint; double textWidth; if (subsImage == null) { subsImage = new Image (Path.Combine (Config.IconsDir, StyleConf.SubsIcon)); } tk.Context = context; tk.Begin (); RenderTimelineEventBase (color, null, selected, null, tk, context, backgroundArea, cellArea, state, out selectPoint, out textPoint, out imagePoint, out circlePoint, out textWidth); inPoint = textPoint; imgPoint = new Point (textPoint.X + StyleConf.ListImageWidth + StyleConf.ListRowSeparator, textPoint.Y); outPoint = new Point (imgPoint.X + 20 + StyleConf.ListRowSeparator, imgPoint.Y); RenderPlayer (tk, playerIn, inPoint); tk.DrawImage (imgPoint, 20, cellArea.Height, subsImage, true); RenderPlayer (tk, playerOut, outPoint); timePoint = new Point (outPoint.X + StyleConf.ListImageWidth + StyleConf.ListRowSeparator, textPoint.Y); tk.FontSize = 10; tk.FontWeight = FontWeight.Normal; tk.StrokeColor = Config.Style.PaletteSelected; tk.FontAlignment = FontAlignment.Left; tk.DrawText (timePoint, 100, cellArea.Height, evt.ToSecondsString ()); RenderSeparationLine (tk, context, backgroundArea); tk.End (); }
public void Move(Time diff) { if (start != null) { start += diff; } if (stop != null) { stop += diff; } if (eventTime != null) { eventTime += diff; } }