Пример #1
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);
        }
Пример #2
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);
        }
Пример #3
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;
 }
Пример #4
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;
 }