/// <summary> /// Copies objects and arrows /// </summary> /// <param name="objects">Objects</param> /// <param name="arrows">Arrows</param> /// <param name="associated">Sign for setting associated objects</param> public virtual void Copy(IEnumerable <IObjectLabel> objects, IEnumerable <IArrowLabel> arrows, bool associated) { List <IObjectLabel> objs = new List <IObjectLabel>(); List <IObjectLabel> tobjs = new List <IObjectLabel>(); foreach (IObjectLabel l in objects) { objs.Add(l); IObjectLabel lab = new PureObjectLabel(l.Name, l.Kind, l.Type, l.X, l.Y); tobjs.Add(lab); lab.Object = l.Object; lab.Desktop = this; this.objects.Add(lab); if (l.Object is IObjectContainer) { IObjectContainer oc = l.Object as IObjectContainer; oc.SetParents(this); oc.Load(); } // components.Add(lab); table[l.Name] = lab; } List <IArrowLabel> arrs = new List <IArrowLabel>(); foreach (IArrowLabel l in arrows) { IArrowLabel lab = new PureArrowLabel(l.Name, l.Kind, l.Type, l.X, l.Y); lab.Arrow = l.Arrow; lab.Desktop = this; arrs.Add(lab); table[l.Name] = lab; IObjectLabel source = Find(objs, tobjs, l.Source, l.Desktop); IObjectLabel target = Find(objs, tobjs, l.Target, l.Desktop); lab.Source = source; lab.Target = target; } if (!associated) { return; } this.SetParents(); PureObjectLabel.SetLabels(objects); PureArrowLabel.SetLabels(arrs); foreach (IArrowLabel l in arrs) { this.arrows.Add(l); } }