Esempio n. 1
0
        static void ProcessSugiamaLayout(GeometryGraph geometryGraph, SugiyamaLayoutSettings sugiyamaLayoutSettings, CancelToken cancelToken)
        {
            PlaneTransformation originalTransform;
            var transformIsNotIdentity = HandleTransformIsNotIdentity(geometryGraph, sugiyamaLayoutSettings, out originalTransform);

            if (geometryGraph.RootCluster.Clusters.Any())
            {
                PrepareGraphForInitialLayoutByCluster(geometryGraph, sugiyamaLayoutSettings);
                var initialBc = new InitialLayoutByCluster(geometryGraph, a => sugiyamaLayoutSettings);
                initialBc.Run(cancelToken);
                //route the rest of the edges, those between the clusters
                RouteAndLabelEdges(geometryGraph, sugiyamaLayoutSettings,
                                   geometryGraph.Edges.Where(e => e.Curve == null).ToArray());
            }
            else
            {
                geometryGraph.AlgorithmData = SugiyamaLayoutSettings.CalculateLayout(geometryGraph,
                                                                                     sugiyamaLayoutSettings, cancelToken);
            }

            if (transformIsNotIdentity)
            {
                sugiyamaLayoutSettings.Transformation = originalTransform;
            }

            PostRunTransform(geometryGraph, sugiyamaLayoutSettings);
        }
        static void ProcessSugiamaLayout(GeometryGraph geometryGraph, SugiyamaLayoutSettings sugiyamaLayoutSettings, CancelToken cancelToken)
        {
            PlaneTransformation originalTransform;
            var transformIsNotIdentity = HandleTransformIsNotIdentity(geometryGraph, sugiyamaLayoutSettings, out originalTransform);

            if (geometryGraph.RootCluster.Clusters.Any())
            {
                PrepareGraphForInitialLayoutByCluster(geometryGraph, sugiyamaLayoutSettings);
                var initialBc =
                    new InitialLayoutByCluster(
                        geometryGraph,
                        //use different settings per each Cluster if available
                        c => sugiyamaLayoutSettings.ClusterSettings.ContainsKey(c.UserData)
                                 ? sugiyamaLayoutSettings.ClusterSettings[c.UserData]
                                 : sugiyamaLayoutSettings);
                initialBc.Run(cancelToken);
                //route the rest of the edges, those between the clusters
                var edgesToRoute = sugiyamaLayoutSettings.EdgeRoutingSettings.EdgeRoutingMode == EdgeRoutingMode.SplineBundling ? geometryGraph.Edges.ToArray() : geometryGraph.Edges.Where(e => e.Curve == null).ToArray();
                RouteAndLabelEdges(geometryGraph, sugiyamaLayoutSettings, edgesToRoute, 0, cancelToken);
            }
            else
            {
                geometryGraph.AlgorithmData = SugiyamaLayoutSettings.CalculateLayout(geometryGraph,
                                                                                     sugiyamaLayoutSettings, cancelToken);
            }

            if (transformIsNotIdentity)
            {
                sugiyamaLayoutSettings.Transformation = originalTransform;
            }

            PostRunTransform(geometryGraph, sugiyamaLayoutSettings);
        }