Example #1
0
 private void GatherMembers(Dictionary<Part, Info> map, Part p, bool dragging) {
   if (map.ContainsKey(p)) return;
   // only check CanMove or CanCopy when dragging interactively, because this is the Diagram.CurrentTool
   if (dragging && !p.CanMove() && !p.CanCopy()) return;
   Node n = p as Node;
   if (n != null) {
     map[n] = new Info() { Point = n.Location };
     if (((int)this.Inclusions & 1 /*?? EffectiveCollectionInclusions.Members */) != 0) {
       Group g = n as Group;
       if (g != null) {
         foreach (Node c in g.MemberNodes) {
           GatherMembers(map, c, dragging);
         }
         foreach (Link c in g.MemberLinks) {
           GatherMembers(map, c, dragging);
         }
       }
     }
     if (((int)this.Inclusions & 2 /*?? EffectiveCollectionInclusions.ConnectingLinks */) != 0) {
       foreach (Link l in n.LinksConnected) {
         if (map.ContainsKey(l)) continue;
         Node from = l.FromNode;
         Node to = l.ToNode;
         //??? NOTMOVABLELINK
         if (from != null && map.ContainsKey(from) && to != null && map.ContainsKey(to)) {
           GatherMembers(map, l, dragging);
         }
       }
     }
     if ((this.Inclusions & EffectiveCollectionInclusions.TreeChildren) != 0) {
       Diagram diagram = n.Diagram;
       var nodes = (diagram != null && diagram.TreePath == Northwoods.GoXam.Layout.TreePath.Source) ? n.NodesInto : n.NodesOutOf;
       foreach (Node c in nodes) {
         GatherMembers(map, c, dragging);
       }
     }
   } else {
     Link l = p as Link;
     if (l != null) {
       map[l] = new Info();
       if (((int)this.Inclusions & 4 /*?? EffectiveCollectionInclusions.LinkLabelNodes */) != 0) {
         Node lab = l.LabelNode;
         if (lab != null) {
           GatherMembers(map, lab, dragging);
         }
       }
     }
   }
 }