Пример #1
0
        public List <Pair <TimelineEntry, double> > GetInterimTimes(TimelineEntry te)
        {
            if (_interimTimes == null)
            {
                return(null);
            }

            for (int from = 0; from < _entries.Count; from++)
            {
                if (_entries[from] == te)
                {
                    List <Pair <TimelineEntry, double> > toReturn = new List <Pair <TimelineEntry, double> >();

                    for (int to = 0; to < _entries.Count; to++)
                    {
                        if (_interimTimes[from, to] != -1)
                        {
                            toReturn.Add(new Pair <TimelineEntry, double>(_entries[to], _interimTimes[from, to]));
                        }
                    }

                    return(toReturn);
                }
            }

            return(null);
        }
Пример #2
0
        /// <summary>
        /// entfernt das TimelineEntry te
        /// </summary>
        /// <param name="te">zu entfernendes TimelineEntry</param>
        public void RemoveEntry(TimelineEntry te)
        {
            te.EntryChanged -= entryToAdd_EntryChanged;
            te.parentGroup.entries.Remove(te);

            _totalEntryCount--;
            OnGroupsChanged();
        }
Пример #3
0
        /// <summary>
        /// fügt der Timeline ein fertiges TimelineEvent in die Gruppe parentGroup hinzu
        /// </summary>
        /// <param name="entryToAdd">TimelineEntry welcher eingefügt werden soll</param>
        public void AddEntry(TimelineEntry entryToAdd)
        {
            entryToAdd.maxTime       = maxTime;
            entryToAdd.EntryChanged += new TimelineEntry.EntryChangedEventHandler(entryToAdd_EntryChanged);
            entryToAdd.parentGroup.AddEntry(entryToAdd);

            _totalEntryCount++;
            OnGroupsChanged();
        }
Пример #4
0
 private void groupComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (!isNotified && timelineControl.selectedEntry != null)
     {
         TimelineGroup newGroup = groupComboBox.SelectedItem as TimelineGroup;
         TimelineEntry te       = timelineControl.selectedEntry;
         steuerung.RemoveEntry(te);
         te.parentGroup = newGroup;
         steuerung.AddEntry(te);
     }
 }
Пример #5
0
        /// <summary>
        /// Returns a list with all computed conflict points between <paramref name="te"/> and all other entries in this timeline group.
        /// Each pair in the list describes a conflict point and its distance to <paramref name="te"/>.
        /// </summary>
        /// <param name="te">The TimelineEntry</param>
        /// <returns>A list with all computed conflict points between <paramref name="te"/> and all other entries in this timeline group.</returns>
        public List <Pair <SpecificIntersection, double> > GetConflictPoints(TimelineEntry te)
        {
            if (_conflictPoints == null)
            {
                return(null);
            }

            for (int i = 0; i < _entries.Count; i++)
            {
                if (_entries[i] == te)
                {
                    return(_conflictPoints[i]);
                }
            }
            return(null);
        }
Пример #6
0
        /// <summary>
        /// Selektiert den Knoten des TreeViews, der das TimelineEntry te enthält.
        /// </summary>
        /// <param name="te">zu suchendes TimelineEntry</param>
        /// <returns>true, falls te gefunden und selektiert wurde, sonst false</returns>
        public bool SelectNodeByTimelineEntry(TimelineEntry te)
        {
            foreach (TreeNode groupNode in Nodes)
            {
                foreach (TreeNode entryNode in groupNode.Nodes)
                {
                    TimelineEntry entryOfNode = entryNode.Tag as TimelineEntry;
                    if (te == entryOfNode)
                    {
                        SelectedNode = entryNode;
                        Invalidate();
                        return(true);
                    }
                }
            }

            return(false);
        }
Пример #7
0
        public List<Pair<TimelineEntry, double>> GetInterimTimes(TimelineEntry te)
        {
            if (_interimTimes == null)
                return null;

            for (int from = 0; from < _entries.Count; from++)
                {
                if (_entries[from] == te)
                    {
                    List<Pair<TimelineEntry, double>> toReturn = new List<Pair<TimelineEntry, double>>();

                    for (int to = 0; to < _entries.Count; to++)
                        {
                        if (_interimTimes[from, to] != -1)
                            {
                            toReturn.Add(new Pair<TimelineEntry, double>(_entries[to], _interimTimes[from, to]));
                            }
                        }

                    return toReturn;
                    }
                }

            return null;
        }
Пример #8
0
        /// <summary>
        /// Returns a list with all computed conflict points between <paramref name="te"/> and all other entries in this timeline group.
        /// Each pair in the list describes a conflict point and its distance to <paramref name="te"/>.
        /// </summary>
        /// <param name="te">The TimelineEntry</param>
        /// <returns>A list with all computed conflict points between <paramref name="te"/> and all other entries in this timeline group.</returns>
        public List<Pair<SpecificIntersection, double>> GetConflictPoints(TimelineEntry te)
        {
            if (_conflictPoints == null)
                return null;

            for (int i = 0; i < _entries.Count; i++)
                {
                if (_entries[i] == te)
                    return _conflictPoints[i];
                }
            return null;
        }
Пример #9
0
 /// <summary>
 /// fügt der Timeline ein fertiges TimelineEvent an der richtigen Stelle hinzu
 /// </summary>
 /// <param name="entryToAdd">TimelineEntry welcher eingefügt werden soll</param>
 public void AddEntry(TimelineEntry entryToAdd)
 {
     _entries.Add(entryToAdd);
 }
Пример #10
0
 /// <summary>
 /// Erstellt ein neues SelectionChangedEventArgs
 /// </summary>
 /// <param name="te"></param>
 public EntryChangedEventArgs(TimelineEntry te)
 {
     this.m_affectedEntry = te;
 }
        /// <summary>
        /// Eventhandler beim Drücken der Maustaste
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TimelineControl_MouseDown(object sender, MouseEventArgs e)
        {
            // wurde der Zeitschieber angeklickt?
            if ((e.Button == MouseButtons.Left) && (Math.Abs(e.X - GetHorizontalClientPositionAtCurrentTime()) < 2))
                {
                // Drag'n'Drop Modus setzen
                howToDrag = DragNDrop.MOVE_TIMELINE_BAR;
                }

            // wurde ein Plus-/Minussysmbol einer Gruppe angeklickt?
            else if (e.X < rowHeight && GetGroupAtClientPosition(e.Location, true) != null)
                {
                TimelineGroup tg = GetGroupAtClientPosition(e.Location, true);
                tg.collapsed = !tg.collapsed;
                }

            // wurde vielleicht was anderes wichtiges angeklickt?
            else
                {
                TimelineEntry newEntry = GetTimelineEntryAtControlPosition(e.Location);
                TimelineGroup newGroup = GetGroupAtClientPosition(e.Location, false);

                if (newEntry != m_selectedEntry || newGroup != m_selectedGroup)
                    {
                    m_selectedGroup = newGroup;
                    m_selectedEntry = newEntry;
                    OnSelectionChanged();
                    }

                // wurde ein TimelineEntry angeklickt?
                if (m_selectedEntry != null)
                    {
                    // gucken, ob es sich bei te um ein TrafficLight handelt
                    TrafficLight tl = m_selectedEntry as TrafficLight;
                    if (tl != null)
                        {
                        switch (e.Button)
                            {
                        case MouseButtons.Left:
                            #region TimelineEvent hinzufügen
                            if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
                                {
                                double time = GetTimeAtControlPosition(e.Location, true);

                                // Event hinzufügen, welches die Ampel umschaltet
                                TimelineEvent eventToAdd = new TimelineEvent(time, Math.Min(1, (m_selectedEntry.GetTimeOfNextEvent(time) - time) / 2), Color.Green, tl.SwitchToGreen, tl.SwitchToRed);
                                m_selectedEntry.AddEvent(eventToAdd, true, false);

                                howToDrag = DragNDrop.MOVE_EVENT_END;
                                eventToDrag = eventToAdd;
                                this.Cursor = Cursors.SizeWE;
                                Invalidate();
                                }
                            #endregion

                            #region TimelineEntry selektieren
                            else
                                {
                                // Drag'n'Drop für Events initialisieren
                                TimelineEvent theEvent = GetTimelineEventAtControlPosition(e.Location, true);
                                if (theEvent != null)
                                    {
                                    if (Math.Abs(GetClientPositionForTimelineEvent(theEvent).X - e.Location.X) < 3)
                                        {
                                        howToDrag = DragNDrop.MOVE_EVENT_START;
                                        eventToDrag = theEvent;
                                        }
                                    else if (Math.Abs(GetClientPositionForTimelineEvent(theEvent).X + theEvent.eventLength * zoom - e.Location.X) < 3)
                                        {
                                        howToDrag = DragNDrop.MOVE_EVENT_END;
                                        eventToDrag = theEvent;
                                        }
                                    else
                                        {
                                        mouseDownPosition = e.Location;
                                        eventToDragOffset = GetClientPositionForTimelineEvent(theEvent).X - e.Location.X;
                                        howToDrag = DragNDrop.MOVE_EVENT;
                                        eventToDrag = theEvent;
                                        }
                                    }

                                }
                            #endregion
                            break;

                        case MouseButtons.Right:
                            #region TimelineEvent entfernen
                            if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
                                {
                                double time = GetTimeAtControlPosition(e.Location, false);

                                TimelineEvent eventToRemove = tl.GetEventAtTime(time);
                                tl.RemoveEvent(eventToRemove);
                                }
                            #endregion
                            break;
                            }
                        }
                    }

                Invalidate();
                }
        }
Пример #12
0
        /// <summary>
        /// Selektiert den Knoten des TreeViews, der das TimelineEntry te enthält.
        /// </summary>
        /// <param name="te">zu suchendes TimelineEntry</param>
        /// <returns>true, falls te gefunden und selektiert wurde, sonst false</returns>
        public bool SelectNodeByTimelineEntry(TimelineEntry te)
        {
            foreach (TreeNode groupNode in Nodes)
                {
                foreach (TreeNode entryNode in groupNode.Nodes)
                    {
                    TimelineEntry entryOfNode = entryNode.Tag as TimelineEntry;
                    if (te == entryOfNode)
                        {
                        SelectedNode = entryNode;
                        Invalidate();
                        return true;
                        }
                    }
                }

            return false;
        }
Пример #13
0
 void entryToAdd_EntryChanged(object sender, TimelineEntry.EntryChangedEventArgs e)
 {
     OnEntryChanged(new EntryChangedEventArgs(e.affectedEntry));
 }
Пример #14
0
        /// <summary>
        /// entfernt das TimelineEntry te
        /// </summary>
        /// <param name="te">zu entfernendes TimelineEntry</param>
        public void RemoveEntry(TimelineEntry te)
        {
            te.EntryChanged -= entryToAdd_EntryChanged;
            te.parentGroup.entries.Remove(te);

            _totalEntryCount--;
            OnGroupsChanged();
        }
Пример #15
0
        /// <summary>
        /// fügt der Timeline ein fertiges TimelineEvent in die Gruppe parentGroup hinzu
        /// </summary>
        /// <param name="entryToAdd">TimelineEntry welcher eingefügt werden soll</param>
        public void AddEntry(TimelineEntry entryToAdd)
        {
            entryToAdd.maxTime = maxTime;
            entryToAdd.EntryChanged += new TimelineEntry.EntryChangedEventHandler(entryToAdd_EntryChanged);
            entryToAdd.parentGroup.AddEntry(entryToAdd);

            _totalEntryCount++;
            OnGroupsChanged();
        }
 /// <summary>
 /// Erstellt ein neues SelectionChangedEventArgs
 /// </summary>
 /// <param name="tg">ausgewählte TimelineGroup</param>
 /// <param name="te">ausgewählte TimelineGroup</param>
 public SelectionChangedEventArgs(TimelineGroup tg, TimelineEntry te)
 {
     this.m_selectedGroup = tg;
     this.m_selectedEntry = te;
 }
        /// <summary>
        /// gibt die Koordinaten der linken oberen Ecke des TimelineEntries te zurück
        /// </summary>
        /// <param name="te">TimelineEntry, wessen Position berechnet werden soll</param>
        /// <returns>Koordinaten der linken oberen Ecke des Balkens, der te repräsentiert oder null, falls te nicht in m_entries</returns>
        public Point GetClientPositionForTimelineEntry(TimelineEntry te)
        {
            int y = 0;

            foreach (TimelineGroup tg in steuerung.groups)
                {
                y += totalRowHeight;
                if (!tg.collapsed)
                    {
                    foreach (TimelineEntry foo in tg.entries)
                        {
                        if (foo == te)
                            {
                            return new Point(totalRowHeight, y);
                            }
                        y += totalRowHeight;
                        }
                    }
                }

            return new Point(0,0);
        }
Пример #18
0
 /// <summary>
 /// Erstellt ein neues SelectionChangedEventArgs
 /// </summary>
 /// <param name="te"></param>
 public EntryChangedEventArgs(TimelineEntry te)
 {
     this.m_affectedEntry = te;
 }
 /// <summary>
 /// Erstellt ein neues SelectionChangedEventArgs
 /// </summary>
 /// <param name="te">ausgewähltes TimelineEntry</param>
 /// <param name="ev">ausgewähltes TimelineEvent</param>
 /// <param name="dragAction">Art des Drag and Drop-Vorganges</param>
 public EventChangedEventArgs(TimelineEntry te, TimelineEvent ev, DragNDrop dragAction)
 {
     this.m_selectedEntry = te;
     this.m_handeledEvent = ev;
     this.m_dragAction = dragAction;
 }
Пример #20
0
 /// <summary>
 /// fügt der Timeline ein fertiges TimelineEvent an der richtigen Stelle hinzu
 /// </summary>
 /// <param name="entryToAdd">TimelineEntry welcher eingefügt werden soll</param>
 public void AddEntry(TimelineEntry entryToAdd)
 {
     _entries.Add(entryToAdd);
 }