Exemple #1
0
		public static void SetEntityType(Role element, EntityType newEntityType)
		{
			DslModeling::DomainRoleInfo.SetLinkedElement(element, RoleDomainRoleId, newEntityType);
		}
Exemple #2
0
		/// <summary>
		/// Constructor
		/// Creates a EntityTypePlaysRole link in the same Partition as the given EntityType
		/// </summary>
		/// <param name="source">EntityType to use as the source of the relationship.</param>
		/// <param name="target">Role to use as the target of the relationship.</param>
		public EntityTypePlaysRole(EntityType source, Role target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(EntityTypePlaysRole.EntityTypeDomainRoleId, source), new DslModeling::RoleAssignment(EntityTypePlaysRole.RoleDomainRoleId, target)}, null)
		{
		}
Exemple #3
0
		public static EntityType GetEntityType(Role element)
		{
			return DslModeling::DomainRoleInfo.GetLinkedElement(element, RoleDomainRoleId) as EntityType;
		}
Exemple #4
0
		public static BinaryAssociation GetBinaryAssociation(Role element)
		{
			return DslModeling::DomainRoleInfo.GetLinkedElement(element, RoleDomainRoleId) as BinaryAssociation;
		}
Exemple #5
0
		public static void SetBinaryAssociation(Role element, BinaryAssociation newBinaryAssociation)
		{
			DslModeling::DomainRoleInfo.SetLinkedElement(element, RoleDomainRoleId, newBinaryAssociation);
		}
Exemple #6
0
		public static void SetExclusiveArc(Role element, ExclusiveArc newExclusiveArc)
		{
			DslModeling::DomainRoleInfo.SetLinkedElement(element, ConstrainedRoleDomainRoleId, newExclusiveArc);
		}
Exemple #7
0
		/// <summary>
		/// Constructor
		/// Creates a BinaryAssociationContainsRole link in the same Partition as the given BinaryAssociation
		/// </summary>
		/// <param name="source">BinaryAssociation to use as the source of the relationship.</param>
		/// <param name="target">Role to use as the target of the relationship.</param>
		public BinaryAssociationContainsRole(BinaryAssociation source, Role target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(BinaryAssociationContainsRole.BinaryAssociationDomainRoleId, source), new DslModeling::RoleAssignment(BinaryAssociationContainsRole.RoleDomainRoleId, target)}, null)
		{
		}
Exemple #8
0
		/// <summary>
		/// Constructor
		/// Creates a ExclusiveArcSpansOptionalRole link in the same Partition as the given ExclusiveArc
		/// </summary>
		/// <param name="source">ExclusiveArc to use as the source of the relationship.</param>
		/// <param name="target">Role to use as the target of the relationship.</param>
		public ExclusiveArcSpansOptionalRole(ExclusiveArc source, Role target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(ExclusiveArcSpansOptionalRole.ExclusiveArcDomainRoleId, source), new DslModeling::RoleAssignment(ExclusiveArcSpansOptionalRole.ConstrainedRoleDomainRoleId, target)}, null)
		{
		}
Exemple #9
0
		public static ExclusiveArc GetExclusiveArc(Role element)
		{
			return DslModeling::DomainRoleInfo.GetLinkedElement(element, ConstrainedRoleDomainRoleId) as ExclusiveArc;
		}
Exemple #10
0
		public static void SetCardinalityQualifier(Role element, CardinalityQualifier newCardinalityQualifier)
		{
			DslModeling::DomainRoleInfo.SetLinkedElement(element, RoleDomainRoleId, newCardinalityQualifier);
		}
Exemple #11
0
		public static CardinalityQualifier GetCardinalityQualifier(Role element)
		{
			return DslModeling::DomainRoleInfo.GetLinkedElement(element, RoleDomainRoleId) as CardinalityQualifier;
		}
Exemple #12
0
		public static void SetRole(CardinalityQualifier element, Role newRole)
		{
			DslModeling::DomainRoleInfo.SetLinkedElement(element, CardinalityQualifierDomainRoleId, newRole);
		}
Exemple #13
0
		/// <summary>
		/// Constructor
		/// Creates a RoleHasCardinalityQualifier link in the same Partition as the given Role
		/// </summary>
		/// <param name="source">Role to use as the source of the relationship.</param>
		/// <param name="target">CardinalityQualifier to use as the target of the relationship.</param>
		public RoleHasCardinalityQualifier(Role source, CardinalityQualifier target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(RoleHasCardinalityQualifier.RoleDomainRoleId, source), new DslModeling::RoleAssignment(RoleHasCardinalityQualifier.CardinalityQualifierDomainRoleId, target)}, null)
		{
		}
Exemple #14
0
            /// <summary>
            /// Paint the solid crowsfoot on the end of an optional line
            /// </summary>
            protected override void DoPaintGeometry(DiagramPaintEventArgs e, IGeometryHost geometryHost)
            {
                AssociationConnector connector = (AssociationConnector)geometryHost;
                BarkerErModelContainsBinaryAssociation link = connector.ModelElement as BarkerErModelContainsBinaryAssociation;

                EdgePointCollection edgePoints;
                int edgePointCount;
                BinaryAssociation association;
                LinkedElementCollection <Barker.Role> roles;

                if (null != (edgePoints = connector.EdgePoints) &&
                    1 < (edgePointCount = edgePoints.Count) &&
                    null != (association = link.BinaryAssociation) &&
                    2 == (roles = association.RoleCollection).Count)
                {
                    PointD p1   = edgePoints[edgePointCount - 1].Point;
                    PointD p2   = edgePoints[0].Point;
                    PointD midP = new PointD((p1.X + p2.X) / 2, (p1.Y + p2.Y) / 2);

                    #region find correct roles
                    EntityType  fromEntity = connector.FromShape.ModelElement as EntityType;
                    EntityType  toEntity = connector.ToShape.ModelElement as EntityType;
                    Barker.Role fromRole = null, toRole = null;
                    if (fromEntity == roles[0].EntityType)
                    {
                        fromRole = roles[0];
                    }
                    else if (fromEntity == roles[1].EntityType)
                    {
                        fromRole = roles[1];
                    }
                    if (toEntity == roles[0].EntityType)
                    {
                        toRole = roles[0];
                    }
                    else if (toEntity == roles[1].EntityType)
                    {
                        toRole = roles[1];
                    }
                    #endregion

                    if (fromRole != null && toRole != null)
                    {
                        bool fromOptional = !fromRole.IsMandatory;
                        bool toOptional   = !toRole.IsMandatory;
                        bool bothOptional = fromOptional && toOptional;

                        PointF?v1 = null, v2 = null;
                        DrawAssociationEnd(
                            e, geometryHost, connector.FromShape, p2, midP, fromRole.IsMultiValued, fromOptional, fromRole.IsPrimaryIdComponent,
                            fromRole.PredicateText, ref v1, bothOptional);
                        DrawAssociationEnd(
                            e, geometryHost, connector.ToShape, p1, midP, toRole.IsMultiValued, toOptional, toRole.IsPrimaryIdComponent,
                            toRole.PredicateText, ref v2, bothOptional);

                        if (bothOptional && v1.HasValue && v2.HasValue)
                        {
                            Pen pen = geometryHost.GeometryStyleSet.GetPen(DiagramPens.ConnectionLine);
                            pen             = (Pen)pen.Clone();
                            pen.DashPattern = DashPattern;
                            e.Graphics.DrawLine(pen, v1.Value, v2.Value);
                        }
                    }
                }
            }