Exemple #1
0
        public virtual IDiagramShapeCollection AddCollection(IDiagramShapeCollection coll, bool reparentLinks)
        {
            foreach (DiagramShape obj1 in coll)
            {
                if (!base.IsChildOf(obj1) && (this != obj1))
                {
                    continue;
                }
                throw new ArgumentException("Cannot add a group to itself or to one of its own children.");
            }
            DiagramShapeCollection collection1 = new DiagramShapeCollection();

            foreach (DiagramShape obj2 in coll)
            {
                collection1.Add(obj2);
            }
            CollectionEnumerator enumerator2 = collection1.GetEnumerator();

            while (enumerator2.MoveNext())
            {
                DiagramShape obj3  = enumerator2.Current;
                bool         flag1 = obj3.Layer != null;
                if (flag1)
                {
                    GroupShape.setAllNoClear(obj3, true);
                    obj3.Remove();
                }
                this.Add(obj3);
                if (flag1)
                {
                    GroupShape.setAllNoClear(obj3, false);
                }
            }
            if (reparentLinks && base.IsInDocument)
            {
                SubGraphNode.ReparentAllLinksToSubGraphs(collection1, true, base.Document.LinksLayer);
            }
            return(collection1);
        }
Exemple #2
0
 public virtual IDiagramShapeCollection AddCollection(IDiagramShapeCollection coll, bool reparentLinks)
 {
     foreach (DiagramShape obj1 in coll)
     {
         if (!base.IsChildOf(obj1) && (this != obj1))
         {
             continue;
         }
         throw new ArgumentException("Cannot add a group to itself or to one of its own children.");
     }
     DiagramShapeCollection collection1 = new DiagramShapeCollection();
     foreach (DiagramShape obj2 in coll)
     {
         collection1.Add(obj2);
     }
     CollectionEnumerator enumerator2 = collection1.GetEnumerator();
     while (enumerator2.MoveNext())
     {
         DiagramShape obj3 = enumerator2.Current;
         bool flag1 = obj3.Layer != null;
         if (flag1)
         {
             GroupShape.setAllNoClear(obj3, true);
             obj3.Remove();
         }
         this.Add(obj3);
         if (flag1)
         {
             GroupShape.setAllNoClear(obj3, false);
         }
     }
     if (reparentLinks && base.IsInDocument)
     {
         SubGraphNode.ReparentAllLinksToSubGraphs(collection1, true, base.Document.LinksLayer);
     }
     return collection1;
 }
Exemple #3
0
 public override IDiagramShapeCollection PickObjects(PointF p, bool selectableOnly, IDiagramShapeCollection coll, int max)
 {
     if (coll == null)
     {
         coll = new DiagramShapeCollection();
     }
     if (coll.Count < max)
     {
         if (!this.CanView())
         {
             return coll;
         }
         foreach (DiagramShape obj1 in base.Backwards)
         {
             DiagramShape obj2 = obj1.Pick(p, selectableOnly);
             if (obj2 != null)
             {
                 coll.Add(obj2);
                 if (coll.Count >= max)
                 {
                     return coll;
                 }
             }
         }
         DiagramShape obj3 = this.Pick(p, selectableOnly);
         if (obj3 != null)
         {
             coll.Add(obj3);
         }
     }
     return coll;
 }
Exemple #4
0
 public static void ReparentAllLinksToSubGraphs(IDiagramShapeCollection coll, bool behind, DiagramLayer layer)
 {
     foreach (DiagramShape obj1 in coll)
     {
         IDiagramNode node1 = obj1 as IDiagramNode;
         if (node1 != null)
         {
             foreach (IDiagramLine link1 in node1.Links)
             {
                 if (((link1 != null) && (link1.FromPort != null)) && (link1.ToPort != null))
                 {
                     SubGraphNode.ReparentToCommonSubGraph(link1.DiagramShape, link1.FromPort.DiagramShape, link1.ToPort.DiagramShape, behind, layer);
                 }
             }
             continue;
         }
         IDiagramPort port1 = obj1 as IDiagramPort;
         if (port1 != null)
         {
             foreach (IDiagramLine link2 in port1.Links)
             {
                 if (((link2 != null) && (link2.FromPort != null)) && (link2.ToPort != null))
                 {
                     SubGraphNode.ReparentToCommonSubGraph(link2.DiagramShape, link2.FromPort.DiagramShape, link2.ToPort.DiagramShape, behind, layer);
                 }
             }
             continue;
         }
         IDiagramLine link3 = obj1 as IDiagramLine;
         if (((link3 != null) && (link3.FromPort != null)) && (link3.ToPort != null))
         {
             SubGraphNode.ReparentToCommonSubGraph(link3.DiagramShape, link3.FromPort.DiagramShape, link3.ToPort.DiagramShape, behind, layer);
         }
     }
 }
Exemple #5
0
 public virtual IDiagramShapeCollection PickObjects(PointF p, bool selectableOnly, IDiagramShapeCollection coll, int max)
 {
     if (coll == null)
     {
         coll = new DiagramShapeCollection();
     }
     if (coll.Count < max)
     {
         if (!this.CanView())
         {
             return coll;
         }
         DiagramShape obj1 = this.Pick(p, selectableOnly);
         if (obj1 != null)
         {
             coll.Add(obj1);
         }
     }
     return coll;
 }
Exemple #6
0
 public virtual IDiagramShapeCollection PickObjects(PointF p, bool selectableOnly, IDiagramShapeCollection coll, int max)
 {
     if (coll == null)
     {
         coll = new DiagramShapeCollection();
     }
     if (coll.Count < max)
     {
         if (!this.CanView())
         {
             return(coll);
         }
         DiagramShape obj1 = this.Pick(p, selectableOnly);
         if (obj1 != null)
         {
             coll.Add(obj1);
         }
     }
     return(coll);
 }