Пример #1
0
        public GraphSet(ViewModel model, NodeModel root, NodeModel container=null, int depth = -1)
        {
            Model = model;
            GraphMode = Model.GraphMode;
            GraphContainer = container;

            // iternate nodes at this zoom level
            if (GraphMode == CallGraphMode.Intermediates)
            {
                AddDependencyNodes();
            }

            else if (GraphMode == CallGraphMode.Layers)
            {
                foreach (var child in root.Nodes)
                    AddCalledNodes(child, true, 0);
            }

            else
            {
                AddCalledNodes(root, true, depth);

                if (GraphContainer == null)
                {
                    if (Model.ShowOutside || CenterMap.Count == 1) // prevent blank screen
                        AddCalledNodes(Model.InternalRoot, false);

                    if (Model.ShowExternal)
                        AddCalledNodes(Model.ExternalRoot, false);
                }
            }

            // process subsets before building graphs so we can prune empty subset graphs
            if (GraphMode == CallGraphMode.Layers)
            {
                foreach (var child in root.Nodes)
                    Subsets[child.ID] = new GraphSet(Model, child, child);
            }

            else if (GraphMode == CallGraphMode.Class &&
                     Model.ShowMethods &&
                     GraphContainer == null)
            {
                foreach (var classNode in PositionMap.Values)
                    Subsets[classNode.ID] = new GraphSet(Model, classNode, classNode, 1);
            }

            if (PositionMap.Count > 0)
            {
                BuildGraphs();

                if (Graphs.Count > 0)
                    LayoutGraphs();
            }
        }
Пример #2
0
        public GraphSet(ViewModel model, NodeModel root, NodeModel container = null, int depth = -1)
        {
            Model          = model;
            GraphMode      = Model.GraphMode;
            GraphContainer = container;

            // iternate nodes at this zoom level
            if (GraphMode == CallGraphMode.Intermediates)
            {
                AddDependencyNodes();
            }

            else if (GraphMode == CallGraphMode.Layers)
            {
                foreach (var child in root.Nodes)
                {
                    AddCalledNodes(child, true, 0);
                }
            }

            else
            {
                AddCalledNodes(root, true, depth);

                if (GraphContainer == null)
                {
                    if (Model.ShowOutside || CenterMap.Count == 1) // prevent blank screen
                    {
                        AddCalledNodes(Model.InternalRoot, false);
                    }

                    if (Model.ShowExternal)
                    {
                        AddCalledNodes(Model.ExternalRoot, false);
                    }
                }
            }

            // process subsets before building graphs so we can prune empty subset graphs
            if (GraphMode == CallGraphMode.Layers)
            {
                foreach (var child in root.Nodes)
                {
                    Subsets[child.ID] = new GraphSet(Model, child, child);
                }
            }

            else if (GraphMode == CallGraphMode.Class &&
                     Model.ShowMethods &&
                     GraphContainer == null)
            {
                foreach (var classNode in PositionMap.Values)
                {
                    Subsets[classNode.ID] = new GraphSet(Model, classNode, classNode, 1);
                }
            }


            if (PositionMap.Count > 0)
            {
                BuildGraphs();

                if (Graphs.Count > 0)
                {
                    LayoutGraphs();
                }
            }
        }