상속: IComparable
예제 #1
0
 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");
 }
예제 #2
0
 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);
 }
예제 #3
0
 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;
 }
예제 #4
0
        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 ();
        }
예제 #5
0
        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);
        }
예제 #6
0
 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);
 }
예제 #7
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;
 }
예제 #8
0
파일: Seeker.cs 프로젝트: GNOME/longomatch
        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);
        }
예제 #9
0
 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;
 }
예제 #10
0
 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 ();
 }
예제 #11
0
        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);
        }
예제 #12
0
 public void EmitTimeNodeChanged(TimeNode tn, Time time)
 {
     if (TimeNodeChanged != null)
         TimeNodeChanged (tn, time);
 }
예제 #13
0
        public SportCategoryTimeline(ProjectLongoMatch project, List<TimelineEvent> plays, Time maxTime,
									  double offsetY, Color background, EventsFilter filter)
            : base(project, plays, maxTime,
																									 offsetY, background, filter)
        {
        }
예제 #14
0
 public void EmitSeekEvent(Time time, bool accurate)
 {
     if (SeekEvent != null) {
         SeekEvent (time, accurate);
     }
 }
예제 #15
0
        public void EmitSubstitutionEvent(Team team, Player p1, Player p2,
		                                   SubstitutionReason reason, Time time)
        {
            if (PlayerSubstitutionEvent != null) {
                PlayerSubstitutionEvent (team, p1, p2, reason, time);
            }
        }
예제 #16
0
        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);
        }
예제 #17
0
 public void EmitPlayerTick(Time currentTime)
 {
     if (PlayerTick != null) {
         PlayerTick (currentTime);
     }
 }
예제 #18
0
        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;
        }
예제 #19
0
 public void EmitCapturerTick(Time currentTime)
 {
     if (CapturerTick != null) {
         CapturerTick (currentTime);
     }
 }
예제 #20
0
        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);
        }
예제 #21
0
 void HandleTimeruleSeek(Time pos, bool accurate, bool synchronous = false, bool throttled = false)
 {
     Seek (new SeekEvent {
         Time = pos,
         Accurate = accurate,
         Synchronous = synchronous,
         Throttled = throttled
     });
 }
예제 #22
0
 void HandleShowTimerMenuEvent(Timer timer, Time time)
 {
     if (!FixedPeriods)
         menu.ShowMenu (project, timer, time, camerasTimeline.PeriodsTimeline, camerasTimeline);
 }
예제 #23
0
        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 ();
        }
예제 #24
0
        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)
        {
        }
예제 #25
0
 /// <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> ();
 }
예제 #26
0
        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);
        }
예제 #27
0
        /// <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);
                }
            }
        }
예제 #28
0
 void HandleTick(Time currentTime)
 {
     tagger.CurrentTime = currentTime;
 }
예제 #29
0
        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 ();
        }
예제 #30
0
 public void Move(Time diff)
 {
     if (start != null) {
         start += diff;
     }
     if (stop != null) {
         stop += diff;
     }
     if (eventTime != null) {
         eventTime += diff;
     }
 }