private INodeMask ReadNodeMask() { var label = myReader.ReadString(); var isApplied = myReader.ReadBoolean(); var isShowMask = myReader.ReadBoolean(); var maskType = myReader.ReadString(); if (maskType == "NodeMask") { var count = myReader.ReadInt32(); var nodes = new List <string>(count); for (int i = 0; i < count; ++i) { nodes.Add(myReader.ReadString()); } var mask = new NodeMask(nodes); mask.Label = label; mask.IsApplied = isApplied; mask.IsShowMask = isShowMask; return(mask); } else { throw new NotSupportedException("Unknown mask type: " + maskType); } }
public void Execute() { var mask = new NodeMask(); mask.Label = "Cycles"; mask.IsShowMask = true; try { if (!myPresentation.Graph.Nodes.Any()) { return; } var unvisited = new HashSet<Node>(myPresentation.Graph.Nodes); unvisited.RemoveWhere(n => n.In.Count == 0 || n.Out.Count == 0); while (unvisited.Count > 0) { var current = unvisited.First(); unvisited.Remove(current); foreach (var node in FindCycles(unvisited, current, new HashSet<Node> { current })) { mask.Set(node); } } } finally { var module = myPresentation.GetModule<INodeMaskModule>(); module.Push(mask); } }
public void Execute( Node node ) { var nodesToShow = GetNodeWithSiblings( node.Id ); var mask = new NodeMask(); mask.Set( nodesToShow ); var caption = myPresentation.GetPropertySetFor<Caption>().Get( node.Id ); mask.Label = "Siblings of " + caption.DisplayText; var module = myPresentation.GetModule<INodeMaskModule>(); module.Push( mask ); }
public void Execute( Node node ) { var nodesToHide = myPresentation.Graph.Nodes .Where( n => n.Id == node.Id ); var mask = new NodeMask(); mask.IsShowMask = false; mask.Set( nodesToHide ); var caption = myPresentation.GetPropertySetFor<Caption>().Get( node.Id ); mask.Label = caption.DisplayText; var module = myPresentation.GetModule<INodeMaskModule>(); module.Push( mask ); }
public void Execute( Node node ) { var nodesToShow = myPresentation.Graph.Edges .Where( e => e.Source.Id == node.Id ) .Select( e => e.Target ) .ToList(); nodesToShow.Add( node ); var mask = new NodeMask(); mask.Set( nodesToShow ); var caption = myPresentation.GetPropertySetFor<Caption>().Get( node.Id ); mask.Label = "Outgoing of " + caption.DisplayText; var module = myPresentation.GetModule<INodeMaskModule>(); module.Push( mask ); }
protected override void OnModelPropertyChanged(string propertyName) { if (propertyName == "Model") { OnConfigChanged(this, EventArgs.Empty); } else if (propertyName == "Presentation") { if (myPresentation == Model.Presentation) { return; } myPresentation = Model.Presentation; myPresentation.GetModule<INodeMaskModule>().AutoHideAllNodesForShowMasks = true; if (myPresentation.Graph.Nodes.Count() > 300) { var hideAllButOne = new NodeMask(); hideAllButOne.IsShowMask = true; hideAllButOne.IsApplied = true; hideAllButOne.Label = "Hide all but one node"; hideAllButOne.Set(myPresentation.Graph.Nodes.Take(1)); myPresentation.GetModule<INodeMaskModule>().Push(hideAllButOne); OnOpenFilterEditor(); } OnPropertyChanged("IsEnabled"); } }
private void OnAdd() { var regex = new Regex( Filter.ToLower(), RegexOptions.IgnoreCase ); var matchedNodes = myPresentation.Graph.Nodes .Where( n => regex.IsMatch( n.Id ) || regex.IsMatch( myPresentation.GetPropertySetFor<Caption>().Get( n.Id ).DisplayText ) ); // TODO: should we have default "hide" really? var mask = new NodeMask(); mask.IsShowMask = false; mask.Set( matchedNodes ); mask.Label = string.Format( "Pattern '{0}'", Filter ); var module = myPresentation.GetModule<INodeMaskModule>(); module.Push( mask ); Filter = null; }