Example #1
0
        public static void ToogleFoldingOfVisibleClusters(this IGraphPresentation presentation)
        {
            Contract.RequiresNotNull(presentation, nameof(presentation));

            var transformation = presentation.ClusterFolding();

            var visibleClusters = presentation.TransformedGraph().Clusters
                                  .Where(presentation.Picking.Pick)
                                  .Select(c => c.Id)
                                  .ToList();

            // any visible cluster folded?
            if (visibleClusters.Any(transformation.Clusters.Contains))
            {
                // safe to pass nodes not known to transformation
                transformation.Remove(visibleClusters);
            }
            else
            {
                transformation.Add(visibleClusters);
            }
        }