Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Paolo F Cantoni on November 05, 2021, 02:10:43 pm
-
Decorations are very useful in vertex shapescripts. One of their most useful properties is that they can be inherited (at least, presently, for one level).
I think I've asked this before, but couldn't find it in the Search.
So, can anyone (preferably a Sparxian) provide a definitive answer as to whether decorations can be used in Arc shapescripts (in v15.2)?
[Edit: Clarification: Decorations don't seem to work at all, let alone inheritance.]
If so, are there any "gotchas" I should know about NOW? If not, will they be made available in the future, or in v16?
TIA,
Paolo
-
What do you mean by arc? An arc is a part of a circle.
q.
-
What do you mean by arc? An arc is a part of a circle.
q.
Arcs also connect vertices. They are the lines... The vertices are the shapes in the graph (which is the model).
Paolo
-
Well, in my case you can call them arcs with infinite circumferrence. Ususally that's called a (straight) line. In UML terms I'd call them relationship which is for sure a longer word, but free of interpretation.
Anyhow, where would you see decorations on relationships? You can "paint" weird stuff, but that's mostly weird. You can sort of draw the end shapes. Only a bit less weird that would be.
q.
-
Well, in my case you can call them arcs with infinite circumference. Usually that's called a (straight) line. In UML terms I'd call them relationship which is for sure a longer word, but free of interpretation.
Anyhow, where would you see decorations on relationships? You can "paint" weird stuff, but that's mostly weird. You can sort of draw the end shapes. Only a bit less weird that would be.
q.
At the present we have common functionality for rendering things on lines. For example, if someone writes in the nOtes a little widget pops up on the line to say "there's a note in this line, you might want to look at it".
What we've found is it's too hard to maintain these widgets as just text in a shapescript. With Shapes, we've made a lot of progress being able to add "surfacing functionality" (making properties visible on the shapes) using decorations and inheritance. It significantly reduces the maintenance burden.
We were hoping to do the same with the lines. For example, certain line metatypes MUST have their multiplicity set to 1 at both ends. If it's not, then place standardised widgets on each end as an indicator that something is "crook in Tobruk". We want to do this in a standard way across all line metatypes. Decorations would "fit the bill", but they don't seem to work.
That's why. If decorations aren't available, we have other techniques for creating consistency, but they aren't as architecturally suitable.
Paolo
-
The relationships can only partially be scripted. You can use the SetFixedRegion to get something like an icon be drawn on a connector. Elsewise there are the labels where you can play around (though they might be opted out).
q.
-
As qwerty says, SetFixedRegion is the way to go. Here is an example:
shape main
{
noshadow=true;
setpenwidth(2);
moveto(0,0);
lineto(100,0);
setpenwidth(1);
// define area to draw decoration in (in this case 20x20 below the centre of the line)
setfixedregion(40,0,60,20);
// draw decoration
moveto(42,8);
lineto(58,8);
moveto(42,12);
lineto(58,12);
moveto(46,4);
lineto(40,10);
lineto(46,16);
moveto(54,4);
lineto(60,10);
lineto(54,16);
}
-
Guys, I'm NOT asking HOW to render widgets in connectors shapescripts. I'm asking a specific architectural question. Can we structure our common code in connector shapescripts the same way we can with shape shapescripts - that is, by using decorations that can be inherited?
I know how to do all the stuff you've mentioned. My question relates specifically to using decorations. Shapes can't be inherited due to scoping rules imposed by Sparx.
Paolo
-
Guys, I'm NOT asking HOW to render widgets in connectors shapescripts. I'm asking a specific architectural question. Can we structure our common code in connector shapescripts the same way we can with shape shapescripts - that is, by using decorations that can be inherited?
I know how to do all the stuff you've mentioned. My question relates specifically to using decorations. Shapes can't be inherited due to scoping rules imposed by Sparx.
Paolo
Well you answered that question in the very first post on this thread. Connectors don't draw decorations.
-
Guys, I'm NOT asking HOW to render widgets in connectors shapescripts. I'm asking a specific architectural question. Can we structure our common code in connector shapescripts the same way we can with shape shapescripts - that is, by using decorations that can be inherited?
I know how to do all the stuff you've mentioned. My question relates specifically to using decorations. Shapes can't be inherited due to scoping rules imposed by Sparx.
Paolo
Well you answered that question in the very first post on this thread. Connectors don't draw decorations.
I didn't answer, I asked. It didn't seem to work, but I have been known to make errors in shapescript usage, so I wanted a definitive answer - which you've now provided, Neil, thanks.
Is there any point in putting in a feature request?
Paolo