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); }
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; }
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); }
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); }
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; }
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; }
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); }
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; }
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); } } } }
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; }