Example #1
0
        private void ToggleClusterFolding(Cluster commandParamter)
        {
            var t = Presentation.ClusterFolding();

            foreach (var c in GetSelectedClusters(commandParamter))
            {
                t.Toggle(c.Id);
            }
        }
Example #2
0
        public INodeMask Compute(Cluster cluster)
        {
            var folding         = Presentation.ClusterFolding();
            var clusterIsFolded = folding.Clusters.Contains(cluster.Id);

            if (clusterIsFolded)
            {
                // the algorithm should work on folded clusters as well so we need to unfold the cluster temporarily
                folding.Remove(cluster.Id);
            }

            try
            {
                // re-fetch the cluster in case it was folded
                var clusterNodes = Presentation.TransformedGraph().Clusters.Single(c => c.Id == cluster.Id).Nodes
                                   // do not process hidden nodes
                                   .Where(Presentation.Picking.Pick)
                                   .ToList();

                var mask = new NodeMask();
                mask.IsShowMask = false;

                mask.Set(FindNodes(clusterNodes));

                var caption = Presentation.GetPropertySetFor <Caption>().Get(cluster.Id);
                if (SiblingsType == SiblingsType.Any)
                {
                    mask.Label = $"Nodes not connected with outside {caption.DisplayText}";
                }
                else if (SiblingsType == SiblingsType.Sources)
                {
                    mask.Label = $"Nodes not reachable from outside {caption.DisplayText}";
                }
                else if (SiblingsType == SiblingsType.Targets)
                {
                    mask.Label = $"Nodes reaching outside {caption.DisplayText}";
                }

                return(mask);
            }
            finally
            {
                if (clusterIsFolded)
                {
                    folding.Add(cluster.Id);
                }
            }
        }