Example #1
0
 public virtual void Remove(DiagramShape obj)
 {
     if (obj != null)
     {
         DiagramShapeCollection.fastRemove(this.myObjects, obj);
     }
 }
Example #2
0
        public virtual DiagramSelection CreateDragSelection()
        {
            DiagramSelection selection1 = new DiagramSelection(null);

            Shapes.RectangleGraph rectangle1 = new Shapes.RectangleGraph();
            rectangle1.Bounds  = base.CurrentObject.Bounds;
            rectangle1.Visible = false;
            base.View.Layers.Default.Add(rectangle1);
            selection1.Add(rectangle1);
            Shapes.DiagramShapeCollection collection1 = new Shapes.DiagramShapeCollection();
            CollectionEnumerator          enumerator1 = ((this.EffectiveSelection != null) ? this.EffectiveSelection : base.Selection).GetEnumerator();

            while (enumerator1.MoveNext())
            {
                Shapes.DiagramShape obj1 = enumerator1.Current;
                collection1.Add(obj1.DraggingObject);
            }
            RectangleF ef1     = DiagramDocument.ComputeBounds(collection1, base.View);
            float      single1 = base.View.WorldScale.Width;

            if (((ef1.Width * single1) > 2000f) || ((ef1.Height * single1) > 2000f))
            {
                single1 *= System.Math.Min((float)(2000f / (ef1.Width * single1)), (float)(2000f / (ef1.Height * single1)));
            }
            Bitmap bitmap1 = base.View.GetBitmapFromCollection(collection1, ef1, single1, false);

            Shapes.DiagramImage image1 = new Shapes.DiagramImage();
            image1.Image  = bitmap1;
            image1.Bounds = new RectangleF(ef1.X, ef1.Y, ((float)bitmap1.Width) / single1, ((float)bitmap1.Height) / single1);
            base.View.Layers.Default.Add(image1);
            selection1.Add(image1);
            return(selection1);
        }
Example #3
0
        public Shapes.IDiagramShapeCollection AddCollection(Shapes.IDiagramShapeCollection coll, bool reparentLinks)
        {
            Shapes.DiagramShapeCollection collection1 = new Shapes.DiagramShapeCollection();
            foreach (Shapes.DiagramShape obj1 in coll)
            {
                collection1.Add(obj1);
            }
            CollectionEnumerator enumerator2 = collection1.GetEnumerator();

            while (enumerator2.MoveNext())
            {
                Shapes.DiagramShape obj2 = enumerator2.Current;
                bool flag1 = obj2.Layer != null;
                if (flag1)
                {
                    Shapes.GroupShape.setAllNoClear(obj2, true);
                    obj2.Remove();
                }
                this.Add(obj2);
                if (flag1)
                {
                    Shapes.GroupShape.setAllNoClear(obj2, false);
                }
            }
            if (reparentLinks && this.IsInDocument)
            {
                Shapes.SubGraphNode.ReparentAllLinksToSubGraphs(collection1, true, this.Document.LinksLayer);
            }
            return(collection1);
        }
Example #4
0
 public Shapes.IDiagramShapeCollection AddCollection(Shapes.IDiagramShapeCollection coll, bool reparentLinks)
 {
     Shapes.DiagramShapeCollection collection1 = new Shapes.DiagramShapeCollection();
     foreach (Shapes.DiagramShape obj1 in coll)
     {
         collection1.Add(obj1);
     }
     CollectionEnumerator enumerator2 = collection1.GetEnumerator();
     while (enumerator2.MoveNext())
     {
         Shapes.DiagramShape obj2 = enumerator2.Current;
         bool flag1 = obj2.Layer != null;
         if (flag1)
         {
             Shapes.GroupShape.setAllNoClear(obj2, true);
             obj2.Remove();
         }
         this.Add(obj2);
         if (flag1)
         {
             Shapes.GroupShape.setAllNoClear(obj2, false);
         }
     }
     if (reparentLinks && this.IsInDocument)
     {
         Shapes.SubGraphNode.ReparentAllLinksToSubGraphs(collection1, true, this.Document.LinksLayer);
     }
     return collection1;
 }
Example #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);
 }
Example #6
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);
        }
Example #7
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;
 }
Example #8
0
 public virtual Shapes.IDiagramShapeCollection PickObjects(PointF p, bool selectableOnly, Shapes.IDiagramShapeCollection coll, int max)
 {
     if (selectableOnly && !this.CanSelectObjects())
     {
         return null;
     }
     if (coll == null)
     {
         coll = new Shapes.DiagramShapeCollection();
     }
     LayerCollectionEnumerator enumerator1 = this.Layers.Backwards.GetEnumerator();
     while (enumerator1.MoveNext())
     {
         DiagramLayer layer1 = enumerator1.Current;
         if (coll.Count >= max)
         {
             return coll;
         }
         layer1.PickObjects(p, selectableOnly, coll, max);
     }
     return coll;
 }
Example #9
0
 public Shapes.IDiagramShapeCollection PickObjects(PointF p, bool selectableOnly, Shapes.IDiagramShapeCollection coll, int max)
 {
     if (coll == null)
     {
         coll = new Shapes.DiagramShapeCollection();
     }
     if (coll.Count < max)
     {
         if (!this.CanViewObjects())
         {
             return(coll);
         }
         if (selectableOnly && !this.CanSelectObjects())
         {
             return(coll);
         }
         GoLayerCache cache1 = this.FindCache(p);
         if (cache1 != null)
         {
             ArrayList list1 = cache1.Objects;
             for (int num2 = list1.Count - 1; num2 >= 0; num2--)
             {
                 Shapes.DiagramShape obj1   = (Shapes.DiagramShape)list1[num2];
                 Shapes.GroupShape   group1 = obj1 as Shapes.GroupShape;
                 if (group1 != null)
                 {
                     group1.PickObjects(p, selectableOnly, coll, max);
                 }
                 else
                 {
                     Shapes.DiagramShape obj2 = obj1.Pick(p, selectableOnly);
                     if (obj2 != null)
                     {
                         coll.Add(obj2);
                         if (coll.Count >= max)
                         {
                             return(coll);
                         }
                     }
                 }
             }
             return(coll);
         }
         LayerEnumerator enumerator1 = this.Backwards.GetEnumerator();
         while (enumerator1.MoveNext())
         {
             Shapes.DiagramShape obj3   = enumerator1.Current;
             Shapes.GroupShape   group2 = obj3 as Shapes.GroupShape;
             if (group2 != null)
             {
                 group2.PickObjects(p, selectableOnly, coll, max);
                 continue;
             }
             Shapes.DiagramShape obj4 = obj3.Pick(p, selectableOnly);
             if (obj4 != null)
             {
                 coll.Add(obj4);
                 if (coll.Count >= max)
                 {
                     return(coll);
                 }
             }
         }
     }
     return(coll);
 }
Example #10
0
 public virtual DiagramSelection CreateDragSelection()
 {
     DiagramSelection selection1 = new DiagramSelection(null);
     Shapes.RectangleGraph rectangle1 = new Shapes.RectangleGraph();
     rectangle1.Bounds = base.CurrentObject.Bounds;
     rectangle1.Visible = false;
     base.View.Layers.Default.Add(rectangle1);
     selection1.Add(rectangle1);
     Shapes.DiagramShapeCollection collection1 = new Shapes.DiagramShapeCollection();
     CollectionEnumerator enumerator1 = ((this.EffectiveSelection != null) ? this.EffectiveSelection : base.Selection).GetEnumerator();
     while (enumerator1.MoveNext())
     {
         Shapes.DiagramShape obj1 = enumerator1.Current;
         collection1.Add(obj1.DraggingObject);
     }
     RectangleF ef1 = DiagramDocument.ComputeBounds(collection1, base.View);
     float single1 = base.View.WorldScale.Width;
     if (((ef1.Width * single1) > 2000f) || ((ef1.Height * single1) > 2000f))
     {
         single1 *= System.Math.Min((float)(2000f / (ef1.Width * single1)), (float)(2000f / (ef1.Height * single1)));
     }
     Bitmap bitmap1 = base.View.GetBitmapFromCollection(collection1, ef1, single1, false);
     Shapes.DiagramImage image1 = new Shapes.DiagramImage();
     image1.Image = bitmap1;
     image1.Bounds = new RectangleF(ef1.X, ef1.Y, ((float)bitmap1.Width) / single1, ((float)bitmap1.Height) / single1);
     base.View.Layers.Default.Add(image1);
     selection1.Add(image1);
     return selection1;
 }
Example #11
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;
 }
Example #12
0
 public static void ReparentToCommonSubGraph(DiagramShape obj, DiagramShape child1, DiagramShape child2, bool behind, DiagramLayer layer)
 {
     SubGraphNode graph1 = SubGraphNode.FindParentSubGraph(child1);
     SubGraphNode graph2 = SubGraphNode.FindParentSubGraph(child2);
     DiagramShape obj1 = DiagramShape.FindCommonParent(graph1, graph2);
     while ((obj1 != null) && !(obj1 is SubGraphNode))
     {
         obj1 = obj1.Parent;
     }
     SubGraphNode graph3 = obj1 as SubGraphNode;
     if ((obj.Parent != graph3) || (obj.Layer == null))
     {
         if ((obj.Parent == null) && (obj.Layer == null))
         {
             if (graph3 != null)
             {
                 if (behind)
                 {
                     graph3.InsertBefore(null, obj);
                 }
                 else
                 {
                     graph3.InsertAfter(null, obj);
                 }
             }
             else
             {
                 layer.Add(obj);
             }
         }
         else
         {
             DiagramShapeCollection collection1 = new DiagramShapeCollection();
             collection1.Add(obj);
             if (graph3 != null)
             {
                 graph3.AddCollection(collection1, false);
             }
             else
             {
                 layer.AddCollection(collection1, false);
             }
         }
     }
 }
Example #13
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;
 }
Example #14
0
 protected virtual Shapes.IDiagramShapeCollection DoExternalDrop(DragEventArgs evt)
 {
     DiagramSelection selection1 = evt.Data.GetData(typeof(DiagramSelection)) as DiagramSelection;
     if (selection1 != null)
     {
         DiagramDocument document1 = this.Document;
         if (document1 != null)
         {
             PointF tf1 = this.LastInput.DocPoint;
             Shapes.DiagramShape obj2 = selection1.Primary;
             if (obj2 != null)
             {
                 string text1 = null;
                 Shapes.DiagramShapeCollection collection1 = new Shapes.DiagramShapeCollection();
                 try
                 {
                     this.StartTransaction();
                     SizeF ef1 = DiagramTool.SubtractPoints(tf1, new PointF(obj2.Left + selection1.HotSpot.Width, obj2.Top + selection1.HotSpot.Height));
                     CopyDictionary dictionary1 = document1.CopyFromCollection(selection1, false, true, ef1, null);
                     foreach (Shapes.DiagramShape obj4 in dictionary1.Values)
                     {
                         if (((obj4 == null) || !obj4.IsTopLevel) || (obj4.Document != document1))
                         {
                             continue;
                         }
                         collection1.Add(obj4);
                         if (this.GridSnapDrag != DiagramViewSnapStyle.None)
                         {
                             PointF tf2 = obj4.Location;
                             PointF tf3 = this.FindNearestGridPoint(tf2);
                             obj4.DoMove(this, tf2, tf3);
                         }
                     }
                     DiagramSelection selection2 = this.Selection;
                     selection2.Clear();
                     Shapes.DiagramShape obj5 = (Shapes.DiagramShape)dictionary1[obj2];
                     if ((obj5 != null) && collection1.Contains(obj5))
                     {
                         selection2.Add(obj5);
                     }
                     CollectionEnumerator enumerator2 = collection1.GetEnumerator();
                     while (enumerator2.MoveNext())
                     {
                         Shapes.DiagramShape obj6 = enumerator2.Current;
                         selection2.Add(obj6);
                     }
                     selection2.HotSpot = selection1.HotSpot;
                     text1 = "Drop";
                     this.RaiseExternalObjectsDropped(this.LastInput);
                 }
                 finally
                 {
                     this.FinishTransaction(text1);
                 }
                 return collection1;
             }
         }
     }
     return null;
 }
Example #15
0
 public Shapes.DiagramShape AddCopy(Shapes.DiagramShape obj, PointF loc)
 {
     PointF tf1 = obj.Location;
     Shapes.DiagramShapeCollection collection1 = new Shapes.DiagramShapeCollection();
     collection1.Add(obj);
     SizeF ef1 = DiagramTool.SubtractPoints(loc, tf1);
     CopyDictionary dictionary1 = this.CopyFromCollection(collection1, false, false, ef1, null);
     return (dictionary1[obj] as Shapes.DiagramShape);
 }
Example #16
0
 public virtual CopyDictionary CopyFromCollection(Shapes.IDiagramShapeCollection coll, bool copyableOnly, bool dragging, SizeF offset, CopyDictionary env)
 {
     CollectionEnumerator enumerator2;
     if (env == null)
     {
         env = this.CreateCopyDictionary();
     }
     env.SourceCollection = coll;
     Hashtable hashtable1 = new Hashtable();
     Shapes.DiagramShapeCollection collection1 = null;
     Shapes.DiagramShapeCollection collection2 = new Shapes.DiagramShapeCollection();
     Shapes.DiagramShapeCollection collection3 = null;
     foreach (Shapes.DiagramShape obj1 in coll)
     {
         Shapes.DiagramShape obj2 = dragging ? obj1.DraggingObject : obj1;
         if (((obj2 != null) && (!copyableOnly || obj2.CanCopy())) && !this.alreadyCopied(hashtable1, obj2))
         {
             if ((collection1 != null) && (obj2 is Shapes.GroupShape))
             {
                 enumerator2 = collection1.GetEnumerator();
                 while (enumerator2.MoveNext())
                 {
                     Shapes.DiagramShape obj3 = enumerator2.Current;
                     if (obj3.IsChildOf(obj2))
                     {
                         hashtable1.Remove(obj3);
                         if (collection3 == null)
                         {
                             collection3 = new Shapes.DiagramShapeCollection();
                         }
                         collection3.Add(obj3);
                         collection2.Remove(obj3);
                     }
                 }
                 if ((collection3 != null) && !collection3.IsEmpty)
                 {
                     enumerator2 = collection3.GetEnumerator();
                     while (enumerator2.MoveNext())
                     {
                         Shapes.DiagramShape obj4 = enumerator2.Current;
                         collection1.Remove(obj4);
                     }
                     collection3.Clear();
                 }
             }
             hashtable1.Add(obj2, obj2);
             if (!obj2.IsTopLevel)
             {
                 if (collection1 == null)
                 {
                     collection1 = new Shapes.DiagramShapeCollection();
                 }
                 collection1.Add(obj2);
             }
             collection2.Add(obj2);
         }
     }
     PointF tf1 = new PointF();
     enumerator2 = collection2.GetEnumerator();
     while (enumerator2.MoveNext())
     {
         Shapes.DiagramShape obj5 = enumerator2.Current;
         Shapes.DiagramShape obj6 = env[obj5] as Shapes.DiagramShape;
         if (obj6 == null)
         {
             obj6 = env.Copy(obj5);
             if (obj6 != null)
             {
                 tf1 = obj6.Location;
                 obj6.Location = obj6.ComputeMove(tf1, new PointF(tf1.X + offset.Width, tf1.Y + offset.Height));
                 DiagramLayer layer1 = obj5.Layer;
                 DiagramLayer layer2 = null;
                 if (layer1 != null)
                 {
                     if (layer1.Document == this)
                     {
                         layer2 = layer1;
                     }
                     else
                     {
                         layer2 = this.Layers.Find(layer1.Identifier);
                     }
                 }
                 if (layer2 == null)
                 {
                     layer2 = this.DefaultLayer;
                 }
                 if (!copyableOnly || layer2.CanInsertObjects())
                 {
                     layer2.Add(obj6);
                 }
             }
         }
     }
     foreach (Shapes.DiagramShape obj8 in env.Delayeds)
     {
         if (obj8 != null)
         {
             Shapes.DiagramShape obj9 = env[obj8] as Shapes.DiagramShape;
             if (obj9 != null)
             {
                 obj8.CopyObjectDelayed(env, obj9);
             }
         }
     }
     return env;
 }
Example #17
0
 public virtual DiagramSelection ComputeEffectiveSelection(Shapes.IDiagramShapeCollection coll, bool move)
 {
     Hashtable hashtable1 = new Hashtable();
     Shapes.DiagramShapeCollection collection1 = null;
     DiagramSelection selection1 = new DiagramSelection(null);
     Shapes.DiagramShapeCollection collection2 = null;
     foreach (Shapes.DiagramShape obj1 in coll)
     {
         Shapes.DiagramShape obj2 = obj1.DraggingObject;
         if (((obj2 != null) && !(move ? !obj2.CanMove() : !obj2.CanCopy())) && !this.alreadyDragged(hashtable1, obj2))
         {
             if ((collection1 != null) && (obj2 is Shapes.GroupShape))
             {
                 CollectionEnumerator enumerator2 = collection1.GetEnumerator();
                 while (enumerator2.MoveNext())
                 {
                     Shapes.DiagramShape obj3 = enumerator2.Current;
                     if (obj3.IsChildOf(obj2))
                     {
                         hashtable1.Remove(7);
                         if (collection2 == null)
                         {
                             collection2 = new Shapes.DiagramShapeCollection();
                         }
                         collection2.Add(obj3);
                         selection1.Remove(obj3);
                     }
                 }
                 if ((collection2 != null) && !collection2.IsEmpty)
                 {
                     enumerator2 = collection2.GetEnumerator();
                     while (enumerator2.MoveNext())
                     {
                         Shapes.DiagramShape obj4 = enumerator2.Current;
                         collection1.Remove(obj4);
                     }
                     collection2.Clear();
                 }
             }
             hashtable1.Add(obj2, obj2);
             if (!obj2.IsTopLevel)
             {
                 if (collection1 == null)
                 {
                     collection1 = new Shapes.DiagramShapeCollection();
                 }
                 collection1.Add(obj2);
             }
             selection1.Add(obj2);
         }
     }
     Shapes.DiagramShape[] objArray1 = selection1.CopyArray();
     for (int num1 = 0; num1 < objArray1.Length; num1++)
     {
         Shapes.DiagramShape obj5 = objArray1[num1];
         Shapes.IDiagramNode node1 = obj5 as Shapes.IDiagramNode;
         if (node1 != null)
         {
             foreach (Shapes.IDiagramLine link1 in node1.DestinationLinks)
             {
                 if (!this.alreadyDragged(hashtable1, link1.DiagramShape) && ((link1.ToPort == null) || this.alreadyDragged(hashtable1, link1.ToPort.DiagramShape)))
                 {
                     hashtable1.Add(link1.DiagramShape, link1.DiagramShape);
                     selection1.Add(link1.DiagramShape);
                 }
             }
             foreach (Shapes.IDiagramLine link2 in node1.SourceLinks)
             {
                 if (!this.alreadyDragged(hashtable1, link2.DiagramShape) && ((link2.FromPort == null) || this.alreadyDragged(hashtable1, link2.FromPort.DiagramShape)))
                 {
                     hashtable1.Add(link2.DiagramShape, link2.DiagramShape);
                     selection1.Add(link2.DiagramShape);
                 }
             }
         }
     }
     return selection1;
 }
Example #18
0
        public virtual DiagramSelection ComputeEffectiveSelection(Shapes.IDiagramShapeCollection coll, bool move)
        {
            Hashtable hashtable1 = new Hashtable();

            Shapes.DiagramShapeCollection collection1 = null;
            DiagramSelection selection1 = new DiagramSelection(null);

            Shapes.DiagramShapeCollection collection2 = null;
            foreach (Shapes.DiagramShape obj1 in coll)
            {
                Shapes.DiagramShape obj2 = obj1.DraggingObject;
                if (((obj2 != null) && !(move ? !obj2.CanMove() : !obj2.CanCopy())) && !this.alreadyDragged(hashtable1, obj2))
                {
                    if ((collection1 != null) && (obj2 is Shapes.GroupShape))
                    {
                        CollectionEnumerator enumerator2 = collection1.GetEnumerator();
                        while (enumerator2.MoveNext())
                        {
                            Shapes.DiagramShape obj3 = enumerator2.Current;
                            if (obj3.IsChildOf(obj2))
                            {
                                hashtable1.Remove(7);
                                if (collection2 == null)
                                {
                                    collection2 = new Shapes.DiagramShapeCollection();
                                }
                                collection2.Add(obj3);
                                selection1.Remove(obj3);
                            }
                        }
                        if ((collection2 != null) && !collection2.IsEmpty)
                        {
                            enumerator2 = collection2.GetEnumerator();
                            while (enumerator2.MoveNext())
                            {
                                Shapes.DiagramShape obj4 = enumerator2.Current;
                                collection1.Remove(obj4);
                            }
                            collection2.Clear();
                        }
                    }
                    hashtable1.Add(obj2, obj2);
                    if (!obj2.IsTopLevel)
                    {
                        if (collection1 == null)
                        {
                            collection1 = new Shapes.DiagramShapeCollection();
                        }
                        collection1.Add(obj2);
                    }
                    selection1.Add(obj2);
                }
            }
            Shapes.DiagramShape[] objArray1 = selection1.CopyArray();
            for (int num1 = 0; num1 < objArray1.Length; num1++)
            {
                Shapes.DiagramShape obj5  = objArray1[num1];
                Shapes.IDiagramNode node1 = obj5 as Shapes.IDiagramNode;
                if (node1 != null)
                {
                    foreach (Shapes.IDiagramLine link1 in node1.DestinationLinks)
                    {
                        if (!this.alreadyDragged(hashtable1, link1.DiagramShape) && ((link1.ToPort == null) || this.alreadyDragged(hashtable1, link1.ToPort.DiagramShape)))
                        {
                            hashtable1.Add(link1.DiagramShape, link1.DiagramShape);
                            selection1.Add(link1.DiagramShape);
                        }
                    }
                    foreach (Shapes.IDiagramLine link2 in node1.SourceLinks)
                    {
                        if (!this.alreadyDragged(hashtable1, link2.DiagramShape) && ((link2.FromPort == null) || this.alreadyDragged(hashtable1, link2.FromPort.DiagramShape)))
                        {
                            hashtable1.Add(link2.DiagramShape, link2.DiagramShape);
                            selection1.Add(link2.DiagramShape);
                        }
                    }
                }
            }
            return(selection1);
        }
Example #19
0
 public Shapes.IDiagramShapeCollection PickObjects(PointF p, bool selectableOnly, Shapes.IDiagramShapeCollection coll, int max)
 {
     if (coll == null)
     {
         coll = new Shapes.DiagramShapeCollection();
     }
     if (coll.Count < max)
     {
         if (!this.CanViewObjects())
         {
             return coll;
         }
         if (selectableOnly && !this.CanSelectObjects())
         {
             return coll;
         }
         GoLayerCache cache1 = this.FindCache(p);
         if (cache1 != null)
         {
             ArrayList list1 = cache1.Objects;
             for (int num2 = list1.Count - 1; num2 >= 0; num2--)
             {
                 Shapes.DiagramShape obj1 = (Shapes.DiagramShape)list1[num2];
                 Shapes.GroupShape group1 = obj1 as Shapes.GroupShape;
                 if (group1 != null)
                 {
                     group1.PickObjects(p, selectableOnly, coll, max);
                 }
                 else
                 {
                     Shapes.DiagramShape obj2 = obj1.Pick(p, selectableOnly);
                     if (obj2 != null)
                     {
                         coll.Add(obj2);
                         if (coll.Count >= max)
                         {
                             return coll;
                         }
                     }
                 }
             }
             return coll;
         }
         LayerEnumerator enumerator1 = this.Backwards.GetEnumerator();
         while (enumerator1.MoveNext())
         {
             Shapes.DiagramShape obj3 = enumerator1.Current;
             Shapes.GroupShape group2 = obj3 as Shapes.GroupShape;
             if (group2 != null)
             {
                 group2.PickObjects(p, selectableOnly, coll, max);
                 continue;
             }
             Shapes.DiagramShape obj4 = obj3.Pick(p, selectableOnly);
             if (obj4 != null)
             {
                 coll.Add(obj4);
                 if (coll.Count >= max)
                 {
                     return coll;
                 }
             }
         }
     }
     return coll;
 }