示例#1
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);
        }