예제 #1
0
        /// <summary>
        /// Clears all children of UI objects and rebuilds the timeline.
        /// </summary>
        public void RebuildTimeline()
        {
            toggledNodes.Clear();

            foreach (Object child in Timelines.Children)
            {
                if (child is TimelinePanel) // Only TimelinePanel objects since Timelines also contains separating lines
                {
                    TimelinePanel timeline = (TimelinePanel)child;
                    timeline.Children.Clear();
                }
            }
            foreach (Object child in Blocks.Children)
            {
                if (child is TimelinePanel) // Only TimelinePanel objects since Timelines also contains separating lines
                {
                    TimelinePanel blockPanel = (TimelinePanel)child;
                    blockPanel.Children.Clear();
                }
            }
            Timelines.Children.Clear();
            Ticks.Children.Clear();
            TicksBar.Children.Clear();
            TimeStamps.Children.Clear();
            Blocks.Children.Clear();
            eventTypeList.Clear();
            eventUserList.Clear();
            BuildTimeline();
        }
예제 #2
0
        /// <summary>
        /// Draws ticks below the nodes to represent the seconds of each timeline interval
        /// </summary>
        /// <param name="beginDate">begin date of a timeline period</param>
        /// <param name="endDate"> end date of a timeline period</param>
        private void AddTicks(DateTime beginDate, DateTime endDate)
        {
            TimelinePanel timelinePanel = MakeTimelinePanel(beginDate, endDate);

            AddTicksBar(beginDate, endDate);
            int timePeriod = (int)endDate.Subtract(beginDate).TotalSeconds;

            for (int i = 0; i < timePeriod; i++)
            {
                Line tick = new Line();
                tick.Stroke          = Brushes.Black;
                tick.X1              = 10;
                tick.X2              = 10;
                tick.Y1              = 0;
                tick.Y2              = 20;
                tick.StrokeThickness = 1;

                TimelinePanel.SetDate(tick, beginDate);
                timelinePanel.Children.Add(tick);
                beginDate = beginDate.AddSeconds(1);
            }
            Ticks.Children.Add(timelinePanel);

            Line separationLine = MakeTimelineSeparatingLine();

            separationLine.Visibility = Visibility.Hidden; // Hidden since this line is added only for proper spacing
            Ticks.Children.Add(separationLine);
        }
예제 #3
0
        /// <summary>
        /// Creates a TimelinePanel for Blocks
        /// </summary>
        /// <param name="beginDate">begin date of timeline</param>
        /// <param name="endDate">end date of timeline</param>
        /// <returns>TimelinePanel that can space Blocks according to time</returns>
        private TimelinePanel MakeBlockPanel(DateTime beginDate, DateTime endDate)
        {
            TimelinePanel timelinePanel = new TimelinePanel
            {
                UnitTimeSpan = new TimeSpan(0, 0, 0, 10),
                UnitSize     = 200,
                BeginDate    = beginDate,
                EndDate      = endDate,
                KeepOriginalOrderForOverlap = true
            };

            return(timelinePanel);
        }
예제 #4
0
        /// <summary>
        /// Creates a TimelinePanel
        /// </summary>
        /// <param name="beginDate">begin date of timeline</param>
        /// <param name="endDate">end date of timeline</param>
        /// <returns>TimelinePanel that can space graphical objects according to time</returns>
        private TimelinePanel MakeTimelinePanel(DateTime beginDate, DateTime endDate)
        {
            TimelinePanel timelinePanel = new TimelinePanel
            {
                UnitTimeSpan = new TimeSpan(0, 0, 0, 1),
                UnitSize     = App.nodeCollection.nodeList[0].Width,
                BeginDate    = beginDate,
                EndDate      = endDate,
                KeepOriginalOrderForOverlap = true
            };

            return(timelinePanel);
        }
예제 #5
0
        /// <summary>
        /// Draws a line to connect a node to a timeline
        /// </summary>
        /// <param name="timelinePanel">timeline panel to hold and position connection lines</param>
        /// <param name="eventTime">time used as position for where to draw a connecting line</param>
        private void ConnectNodeToTimeline(TimelinePanel timelinePanel, DateTime eventTime)
        {
            Line connectorLine = new Line();

            connectorLine.Stroke          = Brushes.LightSteelBlue;
            connectorLine.X1              = 10;
            connectorLine.X2              = 10;
            connectorLine.Y1              = 0;
            connectorLine.Y2              = 15;
            connectorLine.StrokeThickness = 1;

            TimelinePanel.SetDate(connectorLine, eventTime);
            timelinePanel.Children.Add(connectorLine);
        }
예제 #6
0
        /// <summary>
        /// Creates a timeline with the given events and adds it to the UI.
        /// </summary>
        /// <param name="nodesCluster">list of events that belong in 1 timeline</param>
        private void AddTimeline(List <Node.Node> nodesCluster)
        {
            DateTime beginDate = DateTimeRoundDown(nodesCluster[0].aEvent.EventTime, maxRealTimeSpan);
            DateTime endDate   = beginDate.AddMinutes(1);

            TimelinePanel timelinePanel = MakeTimelinePanel(beginDate, endDate);
            TimelinePanel blockPanel    = MakeBlockPanel(beginDate, endDate);

            List <StackedNodes> stackedNodesList = GetStackedNodes(nodesCluster);

            // Add all nodes that stack onto a timeline
            foreach (StackedNodes stackedNode in stackedNodesList)
            {
                stackedNode.Click      += DotPress;
                stackedNode.MouseEnter += HoverStackedNodes;
                stackedNode.MouseLeave += HoverStackedNodes;
                stackedNode.Style       = (Style)Resources["StackedNode"];
                TimelinePanel.SetDate(stackedNode, stackedNode.events[0].EventTime);
                stackedNode.Content = stackedNode.events.Count.ToString();
                allNodes.Add(stackedNode);
                timelinePanel.Children.Add(stackedNode);
                ConnectNodeToTimeline(timelinePanel, stackedNode.events[0].EventTime);

                // Adds invisible blocks as padding for a nice vertical allignment.
                int       numBlocksNeeded = maxStackedNodes - stackedNode.nodes.Count;
                TextBlock alignmentBlock  = new TextBlock
                {
                    Style      = (Style)Resources["TimelineBlock"],
                    Visibility = Visibility.Collapsed,
                    Height     = numBlocksNeeded * 70
                };

                stackedNode.alignmentBlock = alignmentBlock;
                TimelinePanel.SetDate(stackedNode.alignmentBlock, stackedNode.nodes[0].GetBlockTime());
                blockPanel.Children.Add(stackedNode.alignmentBlock);

                // Adds the actual node blocks
                foreach (Node.Node node in stackedNode.nodes)
                {
                    node.IsChecked   = false;
                    node.block.Style = (Style)Resources["TimelineBlock"];
                    TimelinePanel.SetDate(node.block, node.GetBlockTime());
                    blockPanel.Children.Add(node.block);
                }
            }
            // Add all other nodes onto a timeline
            foreach (Node.Node node in nodesCluster)
            {
                node.MouseEnter -= HoverNode;
                node.MouseLeave -= HoverNode;
                node.MouseEnter += HoverNode;
                node.MouseLeave += HoverNode;
                TimelinePanel.SetDate(node, node.aEvent.EventTime);
                allNodes.Add(node);
                timelinePanel.Children.Add(node);
                ConnectNodeToTimeline(timelinePanel, node.aEvent.EventTime);

                // Adds invisible block as padding for a nice vertical allignment.
                TextBlock alignmentBlock = new TextBlock
                {
                    Style      = (Style)Resources["TimelineBlock"],
                    Visibility = Visibility.Collapsed,
                    Height     = (maxStackedNodes - 1) * 70
                };

                node.alignmentBlock = alignmentBlock;
                TimelinePanel.SetDate(node.alignmentBlock, node.GetBlockTime());
                blockPanel.Children.Add(node.alignmentBlock);


                // Adds the actual node blocks
                node.IsChecked   = false;
                node.block.Style = (Style)Resources["TimelineBlock"];
                TimelinePanel.SetDate(node.block, node.GetBlockTime());
                blockPanel.Children.Add(node.block);
            }

            Timelines.Children.Add(timelinePanel);

            Blocks.Children.Add(blockPanel);
            Line separationLine  = MakeTimelineSeparatingLine();
            Line blockSeperation = MakeBlockPanelSeparation();

            Blocks.Children.Add(blockSeperation);
            Timelines.Children.Add(separationLine);
            AddTicks(beginDate, endDate);
            AddTimeStamp(beginDate, endDate);
        }