void CreateEdges(ExecutionGroupModel group)
        {
            foreach (GraphNode inputNode in graphNodes)
            {
                foreach (GraphNode outputNode in graphNodes)
                {
                    if (inputNode == outputNode)
                    {
                        continue;
                    }

                    foreach (GraphNodePort outputPort in inputNode.outputPorts)
                    {
                        foreach (GraphNodePort inputPort in outputNode.inputPorts)
                        {
                            if (outputPort.identifier.Equals(inputPort.identifier))
                            {
                                if (outputPort.selfNodeOnly && !outputNode.reference.identifier.Equals(inputPort.identifier))
                                {
                                    continue;
                                }

                                if (inputPort.selfNodeOnly && !inputNode.reference.identifier.Equals(outputPort.identifier))
                                {
                                    continue;
                                }

                                GetFromCacheOrCreateEdge(inputPort, outputPort);
                            }
                        }
                    }
                }
            }
        }
        internal void UpdateLayout(ExecutionGroupModel group)
        {
            title = group.title;

            graphNodesCache = new HashSet <GraphNode>(graphNodes);
            graphEdgesCache = new HashSet <GraphNodeEdge>(graphEdges);

            graphNodes.Clear();
            graphEdges.Clear();

            CreateNodes(group);
            CreateEdges(group);

            foreach (var graphEdge in graphEdgesCache)
            {
                RemoveElement(graphEdge);
                owner.RemoveElement(graphEdge);
            }

            foreach (var graphNode in graphNodesCache)
            {
                RemoveElement(graphNode);
                owner.RemoveElement(graphNode);
            }

            graphNodesCache = null;
            graphEdgesCache = null;
        }
 void CreateNodes(ExecutionGroupModel group)
 {
     foreach (DebugReference reference in group.references)
     {
         GraphNode node = GetFromCacheOrCreateNode(reference);
         node?.UpdateState();
     }
 }
示例#4
0
        public static ExecutionGraphModel Create(DebugMemory?memory)
        {
            List <ExecutionGroupModel> groups = new List <ExecutionGroupModel>();

            if (memory.HasValue)
            {
                ExecutionGroupModel group = ExecutionGroupModel.Create(0);

                for (DebugReference reference = memory.Value.FirstOrDefault; reference.IsValid; reference = memory.Value.Next(reference))
                {
                    if (reference.dataOnly)
                    {
                        continue;
                    }

                    if (reference.group != group.groupIndex)
                    {
                        if (group.references.Count > 0)
                        {
                            group.FindTitle(memory.Value);
                            groups.Add(group);
                        }

                        group = ExecutionGroupModel.Create(reference.group);
                    }

                    group.references.Add(reference);
                }

                if (group.references.Count > 0)
                {
                    group.FindTitle(memory.Value);
                    groups.Add(group);
                }
            }

            return(new ExecutionGraphModel()
            {
                groups = groups
            });
        }