Author Topic: Decorations and Arc Shapescripts  (Read 14153 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Decorations and Arc Shapescripts
« 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
« Last Edit: November 05, 2021, 02:29:57 pm by Paolo F Cantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Decorations and Arc Shapescripts
« Reply #1 on: November 05, 2021, 06:36:45 pm »
What do you mean by arc? An arc is a part of a circle.

q.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Decorations and Arc Shapescripts
« Reply #2 on: November 05, 2021, 07:35:04 pm »
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
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Decorations and Arc Shapescripts
« Reply #3 on: November 05, 2021, 07:55:03 pm »
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.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Decorations and Arc Shapescripts
« Reply #4 on: November 05, 2021, 09:13:05 pm »
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
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Decorations and Arc Shapescripts
« Reply #5 on: November 05, 2021, 09:27:32 pm »
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.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Decorations and Arc Shapescripts
« Reply #6 on: November 08, 2021, 08:00:49 am »
As qwerty says, SetFixedRegion is the way to go. Here is an example:

Code: [Select]
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);
}
The Sparx Team
[email protected]

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Decorations and Arc Shapescripts
« Reply #7 on: November 08, 2021, 09:15:58 am »
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
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Decorations and Arc Shapescripts
« Reply #8 on: November 08, 2021, 09:47:51 am »
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.
The Sparx Team
[email protected]

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Decorations and Arc Shapescripts
« Reply #9 on: November 08, 2021, 11:37:23 am »
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
« Last Edit: November 08, 2021, 11:43:13 am by Paolo F Cantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!