Пример #1
0
        /// <summary>
        /// Obtains sorted operations (order is back to front).
        /// </summary>
        /// <returns>The list of all operations in ShaderCode:</returns>
        public static List <IOperation> GetSortedOperations(IOperation output)
        {
            // We build graph of all operations.
            DataGraph <IOperation> graph = new DataGraph <IOperation>();
            uint outputID = AddOperationToGraph(output, graph, uint.MaxValue);

            // Now we have to list operations in correct order.
            List <uint>       ordered = GraphAnalysis.ListNodesInOrder(outputID, graph);
            List <IOperation> result  = new List <IOperation>(ordered.Count);

            // We simply "back copy" operations.
            for (int i = 0; i < ordered.Count; i++)
            {
                result.Add(graph[ordered[i]]);
            }

            return(result);
        }
Пример #2
0
 private static void ExecuteAnalysis(GraphAnalysis analysis, DirectedGraph graph)
 {
     analysis.Styles.ToList().ForEach(s => graph.Styles.Add(s));
     analysis.Properties.ToList().ForEach(p => graph.Properties.Add(p));
     analysis.Analysis(graph);
 }