Esempio n. 1
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++;
            }
        }
        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++;
            }
        }