public override void FillCopy(Versioning.IExolutioCloneable copyComponent, ProjectVersion projectVersion, Versioning.ElementCopiesMap createdCopies) { base.FillCopy(copyComponent, projectVersion, createdCopies); PIMAssociationEndViewHelper copyAssociationEndViewHelper = (PIMAssociationEndViewHelper)copyComponent; this.CardinalityLabelViewHelper.FillCopy(copyAssociationEndViewHelper.CardinalityLabelViewHelper, projectVersion, createdCopies); this.RoleLabelViewHelper.FillCopy(copyAssociationEndViewHelper.RoleLabelViewHelper, projectVersion, createdCopies); copyAssociationEndViewHelper.Points.AppendRangeAsCopy(this.Points); }
public override void FillCopy(Versioning.IExolutioCloneable copyComponent, ProjectVersion projectVersion, Versioning.ElementCopiesMap createdCopies) { base.FillCopy(copyComponent, projectVersion, createdCopies); PIMAssociationViewHelper copyAssociationViewHelper = (PIMAssociationViewHelper)copyComponent; copyAssociationViewHelper.UseDiamond = UseDiamond; MainLabelViewHelper.FillCopy(copyAssociationViewHelper.MainLabelViewHelper, projectVersion, createdCopies); for (int i = 0; i < AssociationEndsViewHelpers.Count; i++) { PIMAssociationEndViewHelper associationEndViewHelper = AssociationEndsViewHelpers[i]; PIMAssociationEnd copyEnd = projectVersion.Project.TranslateComponent <PIM.PIMAssociation>(createdCopies.GetGuidForCopyOf(associationEndViewHelper.AssociationEnd.PIMAssociation)).PIMAssociationEnds[i]; System.Diagnostics.Debug.Assert(copyEnd.PIMClass == projectVersion.Project.TranslateComponent <PIM.PIMClass>(createdCopies.GetGuidForCopyOf(associationEndViewHelper.AssociationEnd.PIMClass))); PIMAssociationEndViewHelper endViewHelperCopy = new PIMAssociationEndViewHelper(copyAssociationViewHelper.Diagram, copyAssociationViewHelper); endViewHelperCopy.AssociationEnd = copyEnd; associationEndViewHelper.FillCopy(endViewHelperCopy, projectVersion, createdCopies); copyAssociationViewHelper.AssociationEndsViewHelpers.Add(endViewHelperCopy); } }
/// <summary> /// Creates <see cref="PIMAssociationEndViewHelper"/> for each <paramref name="association"/>'s end. /// </summary> /// <param name="association">model association</param> public void CreateEndsViewHelpers(PIMAssociation association) { //associationEndsViewHelpers.Clear(); List <PIMAssociationEndViewHelper> used = new List <PIMAssociationEndViewHelper>(); // add new ends foreach (PIMAssociationEnd associationEnd in association.PIMAssociationEnds) { PIMAssociationEndViewHelper endViewHelper = associationEndsViewHelpers.Where(helper => helper.AssociationEnd == associationEnd).SingleOrDefault(); if (endViewHelper == null) { endViewHelper = new PIMAssociationEndViewHelper(Diagram, this); endViewHelper.AssociationEnd = associationEnd; associationEndsViewHelpers.Add(endViewHelper); } used.Add(endViewHelper); } if (used.Count == 2 && associationEndsViewHelpers.Count > 2 && UseDiamond) { associationEndsViewHelpers[0].Points.Clear(); } associationEndsViewHelpers.RemoveAll(helper => !used.Contains(helper)); if (association.PIMAssociationEnds.Count > 2 || ForceUseDiamond) { UseDiamond = true; } else { UseDiamond = false; } }