Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: Jacob Vos on April 16, 2020, 01:00:34 am
-
A custom connector, of metaclass 'Association', has the following shape script:
shape main
{
setlinestyle("dot");
moveto(0,0);
lineto(100,0);
}
label middlebottomlabel
{
print("");
}
When I draw the connector from an element of a custom type to an element of type Class, the line is drawn like I want. However, when drawing the connector from a Class element to my custom type, it shows an arrow pointing to the class.
At the metaclass for the connector I specified: direction: Direction = Unspecified.
When applied (via Quick Linker):
- a connector drawn from custom type to Class shows Unspecified;
- a connector drawn from Class to custom type shows Source -> Destination.
Why is this? How to change this?
(I didn't play around yet with _SourceNavigability and _TargetNavigability because the help text tells that it's better to use the direction attribute.)
-
The shape script you've written doesn't decorate the ends, so connectors with that stereotype should never show any arrow heads, regardless of the direction attribute.
It sounds to me like the arrowed connector you get is a standard Association, ie it doesn't have your stereotype.
If that is the case, you need to add quick linker definitions to your profile.
/Uffe
-
The shape script you've written doesn't decorate the ends, so connectors with that stereotype should never show any arrow heads, regardless of the direction attribute.
Unless I'm mistaken, it's not overriding the ends so it will get whatever ends the base UML connector would show.
-
The shape script you've written doesn't decorate the ends, so connectors with that stereotype should never show any arrow heads, regardless of the direction attribute.
Unless I'm mistaken, it's not overriding the ends so it will get whatever ends the base UML connector would show.
No you're right, the end point decorations are separate shapes. My bad.
/U
-
@Eve: The base UML connector is 'Association'. When I draw an Association from Class to custom type, direction = "Unspecified". But so when I draw a stereotyped connector from Class to custom type, direction = "Source -> Destination" and the arrow points to Class (= the source).
However when I draw an Association, no arrow head appears (and direction = 'Unspecified').
This is the profile:
<Stereotype name="Subject description link" metatype="Onderwerpbeschrijving-link" notes="" cx="220" cy="80" bgcolor="-1" fontcolor="-1" bordercolor="-1" borderwidth="-1" hideicon="0" strictness="all">
<metaconstraints>
<metaconstraint umlRole="source" constraint="RZ::Subject description"/>
<metaconstraint umlRole="target" constraint="Class"/>
</metaconstraints>
<Image type="EAShapeScript 1.0" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="bin.base64">UEsDBBQAAAAIABaBj1BE5KFUfQAAAPAAAAAHABEAc3RyLmRhdFVUDQAHazGXXmsxl15rMZde
XY7BCoMwEETfVcF/EE8WPOi5X6MYqGCq1FAo4r93stpKe1jYzbzJzMKNlhlHjtc2cCcjJWHV
7NsiNTCa5nQFXrocJQU9k+6CC9eD9np5mmMSUVNpTvXzy6420v6J7Uu2dCJHazYoqbfUzhKj
3/8w0bUe3pmH5QTreLbbeANQSwECFwsUAAAACAAWgY9QROShVH0AAADwAAAABwAJAAAAAAAA
AAAAAIAAAAAAc3RyLmRhdFVUBQAHazGXXlBLBQYAAAAAAQABAD4AAACzAAAAAAA=</Image>
<AppliesTo>
<Apply type="Association">
<Property name="compositionKind" value="none"/>
<Property name="direction" value="Unspecified"/>
<Property name="_MeaningForwards" value="beschrijft"/>
<Property name="_MeaningBackwards" value="is beschreven in"/>
</Apply>
</AppliesTo>
</Stereotype>
-
<metaconstraints>
<metaconstraint umlRole="source" constraint="RZ::Subject description"/>
<metaconstraint umlRole="target" constraint="Class"/>
</metaconstraints>
When dragging from a Class to a Subject description these meta constraints are going to add a quicklinker rule for your connector that is explicitly reversed. It won't show the forward connector because that's invalid.
You don't get that behavior for a normal association because that's valid in the direction dragged.
-
@Eve: Sorry, I don't completely understand what you mean.
What I want to reach (with that metaconstraint) is that the 'Subject description link' connector can only be used to set a relationship from source "RZ::Subject description" element to target "Class" element.
And when drawing the connector, I would like to be able to start from the "RZ::Subject description" element or from the "Class" element, but the source and target should always be set to "RZ::Subject description" and "Class" element respectively. (Maybe this related to what you wrote "explicitly reversed"???)
Is this even possible? Should I do this in another way than I did, and if yes, how?
BTW: I notice now that when selecting the custom connector in my custom Toolbox and then trying to draw from Class to "RZ::Subject description" element, it's not allowed. But when from Class I use quick linker functionality and select the same custom connector, it is allowed! - however with a wrong layout (see first post).
-
I think the issue is that the quicklinker creates all "from" connectors as directed, whereas "to" connectors can be directed or undirected. It is a limitation of the quicklinker.