protected override bool CloneRelationship(Diagram diagram, Shape first, Shape second) { if (first.Entity is CompositeType firstType && second.Entity is CompositeType secondType) { GeneralizationRelationship clone = GeneralizationRelationship.Clone(firstType, secondType); return(diagram.InsertGeneralization(clone)); }
private GeneralizationRelationship AddGeneralization(GeneralizationRelationship generalization) { Shape startShape = GetShape(generalization.First); Shape endShape = GetShape(generalization.Second); AddConnection(new Generalization(generalization, startShape, endShape)); return(generalization); }
/// <exception cref="RelationshipException"> /// Cannot create relationship between the two types. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="derivedType"/> or <paramref name="baseType"/> is null. /// </exception> public GeneralizationRelationship AddGeneralization(CompositeType derivedType, CompositeType baseType) { GeneralizationRelationship generalization = new GeneralizationRelationship(derivedType, baseType); AddRelationship(generalization); return(generalization); }
public bool InsertGeneralization(GeneralizationRelationship generalization) { if (generalization != null && !model.Relationships.Contains(generalization) && model.Entities.Contains(generalization.First) && model.Entities.Contains(generalization.Second)) { AddGeneralization(generalization); return(true); } return(false); }
protected override bool CloneRelationship(Diagram diagram, Shape first, Shape second) { var firstType = first.Entity as CompositeType; var secondType = second.Entity as CompositeType; if (firstType != null && secondType != null) { var clone = GeneralizationRelationship.Clone(firstType, secondType); return(diagram.InsertGeneralization(clone)); } return(false); }
protected override bool CloneRelationship(IDiagram diagram, Shape first, Shape second) { if (diagram.DiagramType != DiagramType.ClassDiagram) { return(false); } CompositeType firstType = first.Entity as CompositeType; CompositeType secondType = second.Entity as CompositeType; if (firstType != null && secondType != null) { GeneralizationRelationship clone = generalization.Clone(firstType, secondType); return(((ClassDiagram)diagram).InsertGeneralization(clone)); } else { return(false); } }
/// <exception cref="ArgumentNullException"> /// <paramref name="generalization"/> is null.-or- /// <paramref name="startShape"/> is null.-or- /// <paramref name="endShape"/> is null. /// </exception> public Generalization(GeneralizationRelationship generalization, Shape startShape, Shape endShape) : base(generalization, startShape, endShape) { this.generalization = generalization; }
public bool InsertGeneralization(GeneralizationRelationship generalization) { return(model.InsertRelationship(generalization)); }
/// <exception cref="RelationshipException"> /// Cannot create relationship between the two types. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="derivedType"/> or <paramref name="baseType"/> is null. /// </exception> public GeneralizationRelationship AddGeneralization(CompositeType derivedType, CompositeType baseType) { GeneralizationRelationship generalization = new GeneralizationRelationship(derivedType, baseType); AddRelationship(generalization); return generalization; }