public void DrawTreeMap(IRenderer Renderer)
        {
            if (DoRevalue ||
                (ShowLayout != ShowNodes.All && XRay.CoverChange) ||
                (ShowLayout == ShowNodes.Instances && XRay.InstanceChange))
            {
                RecalcCover(InternalRoot);
                RecalcCover(ExternalRoot);

                XRay.CoverChange    = false;
                XRay.InstanceChange = false;

                DoRevalue = false;
                RevalueCount++;

                DoResize = true;
            }

            if (DoResize)
            {
                var drawArea = new RectangleF(ScreenOffset.X, ScreenOffset.Y, ScreenSize.Width, ScreenSize.Height);

                float offset      = 0;
                float centerWidth = drawArea.Width;

                PositionMap.Clear();
                CenterMap.Clear();

                if (ShowingOutside)
                {
                    offset       = drawArea.Width * 1.0f / 4.0f;
                    centerWidth -= offset;

                    InternalRoot.SetArea(new RectangleF(ScreenOffset.X, ScreenOffset.Y, offset - PanelBorderWidth, drawArea.Height));
                    PositionMap[InternalRoot.ID] = InternalRoot;
                    SizeNode(Renderer, InternalRoot, CurrentRoot, false);
                }
                if (ShowingExternal)
                {
                    float extWidth = drawArea.Width * 1.0f / 4.0f;
                    centerWidth -= extWidth;

                    ExternalRoot.SetArea(new RectangleF(ScreenOffset.X + offset + centerWidth + PanelBorderWidth, ScreenOffset.Y, extWidth - PanelBorderWidth, drawArea.Height));
                    PositionMap[ExternalRoot.ID] = ExternalRoot;
                    SizeNode(Renderer, ExternalRoot, null, false);
                }

                CurrentRoot.SetArea(new RectangleF(ScreenOffset.X + offset, ScreenOffset.Y, centerWidth, drawArea.Height));
                PositionMap[CurrentRoot.ID] = CurrentRoot;
                SizeNode(Renderer, CurrentRoot, null, true);

                DoResize = false;
                ResizeCount++;
            }
        }
示例#2
0
        public void DrawTheadline()
        {
            if (DoRevalue)
            {
                RecalcCover(InternalRoot);
                RecalcCover(ExternalRoot);

                DoRevalue = false;
                RevalueCount++;

                DoResize = true;
            }

            // set what nodes are allowed in the threadline based on the current root
            if (CurrentThreadlineZoom != CurrentRoot)
            {
                CenterMap.Clear();
                CenterMap.Add(CurrentRoot.ID);

                Utilities.RecurseTree <NodeModel>(
                    tree: CurrentRoot.Nodes,
                    evaluate: n => CenterMap.Add(n.ID),
                    recurse: n => n.Nodes);

                CurrentThreadlineZoom = CurrentRoot;
            }

            long currentTick = XRay.Watch.ElapsedTicks;

            if (!Paused)
            {
                CalcThreadline(currentTick);
            }

            LayoutThreadlines(currentTick);
        }
示例#3
0
        public void DrawCallGraph()
        {
            if (DoRevalue ||
                XRay.CallChange ||
                (ShowLayout != ShowNodes.All && XRay.CoverChange) ||
                (ShowLayout == ShowNodes.Instances && XRay.InstanceChange))
            {
                RecalcCover(InternalRoot);
                RecalcCover(ExternalRoot);

                PositionMap.Clear();
                CenterMap.Clear();

                var root = CurrentRoot;
                //causes method graph with ShowExternal on to show nothing
                //if (root == InternalRoot && ShowExternal)
                //    root = TopRoot;

                TopGraph = new GraphSet(this, root);

                // combine position and center maps for graph tree
                Utilities.RecurseTree(
                    TopGraph,
                    s =>
                {
                    foreach (var kvp in s.PositionMap)
                    {
                        PositionMap[kvp.Key] = kvp.Value;
                    }

                    foreach (var id in s.CenterMap)
                    {
                        CenterMap.Add(id);
                    }
                },
                    s => s.Subsets.Values
                    );

                XRay.CallChange     = false;
                XRay.CoverChange    = false;
                XRay.InstanceChange = false;

                DoRevalue = false;
                RevalueCount++;

                DoResize = true;
            }

            // graph created in relative coords so it doesnt need to be re-computed each resize, only on recalc

            if (DoResize)
            {
                Utilities.RecurseTree(
                    TopGraph,
                    s =>
                {
                    foreach (var graph in s.Graphs)
                    {
                        if (s.GraphContainer == null)
                        {
                            ScaleGraph(graph, new RectangleF(ScreenOffset, ScreenSize));
                        }

                        else if (s.GraphContainer.XNode.External)
                        {
                            // this is assuming the external node is a triangle
                            var area   = s.GraphContainer.AreaF;
                            var inside = new RectangleF(area.X + area.Width / 4f, area.Y + area.Height / 2f, area.Width / 2f, area.Height / 2f);
                            ScaleGraph(graph, inside);
                        }
                        else
                        {
                            ScaleGraph(graph, s.GraphContainer.AreaF);
                        }
                    }
                },
                    s => s.Subsets.Values
                    );

                DoResize = false;
                ResizeCount++;
            }
        }