Book a Demo

Author Topic: Custom stereotype in MDG seems to show inherited ShapeScript  (Read 4861 times)

pieter.steyn

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
I have created a tailored MDG based on ArchiMate, and have replaced all of the ShapeScripts on the elements. (I used Geert's library - thanks, Geert!)
It has worked perfectly for most elements, including Business, Application and Technology elements, as I have not needed to change decorations.

I have now got around to customising decorations for some extended elements (such as Objective derived from Goal, and Organisation derived from Business Actor), and am running into an issue.

When I put in custom ShapeScript on these elements, the shapescript seems to be duplicated on top of the standard ArchiMate ShapeScript.
Anything I draw seems to be overlaid.
 
In fact, if I remove everything from the custom ShapeScript (which should just draw an empty shape), it still draws the standard ArchiMate shape that I extended, including the decoration, colour and main shape. It cannot therefore be anything in the new ShapeScript.

Any idea why these elements would be displaying inherited ShapeScript overlaid with any new ShapeScript, and what I can do about it?

Appreciate it.

Pieter.
« Last Edit: July 26, 2018, 12:05:10 pm by pieter.steyn »

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Custom stereotype in MDG seems to show inherited ShapeScript
« Reply #1 on: July 26, 2018, 09:05:00 am »
Unfortunately, it isn't possible to override decorations in inherited shape scripts. EA will show all decorations for all stereotypes up the inheritance hierarchy.
The Sparx Team
[email protected]

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8107
  • Karma: +119/-20
    • View Profile
Re: Custom stereotype in MDG seems to show inherited ShapeScript
« Reply #2 on: July 26, 2018, 09:05:30 am »
It sounds like either you have created a decoration script or you are calling drawparentshape().

pieter.steyn

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Custom stereotype in MDG seems to show inherited ShapeScript
« Reply #3 on: July 26, 2018, 12:03:50 pm »
Thanks!

(@KP - I am not calling DrawParentShape(), but have edited the decoration script.)

So, it's good to know all inherited decorations are drawn. Appreciate it, @Simon M.

Not ideal, but what I have done to get my custom decoration to display is to rely on the fact that my decoration is overlaid on top of the inherited decoration.
I create and fill a shape to override the previous decoration, and then draw mine on top of that.

For example, I specialised the ArchiMate_Goal element to be an Objective (more SMART).
The decoration in the shapescript for ArchiMate_Goal is:

decoration goal
{
   orientation="ne";
   SetOrigin("ne",-25,5);
   
   startpath();
   ellipse(0,0,100,100);
   endpath();
   strokepath();
   startpath();
   ellipse(15,15,85,85);
   endpath();
   strokepath();
   setfillcolor(getuserbordercolor());
   ellipse(30,30,70,70);
}

What I did in my custom ShapeScript was replace the decoration, and start with blotting out the old decoration:
decoration objective
{
   orientation="ne";

   SetOrigin("ne",-25,5);
   
   startpath();
   ellipse(0,0,100,100);
   endpath();
   SetFillColor(GetUserFillColor());
   FillAndStrokePath();
   
        //...      
}

I suppose, if specialising an existing MDG and using custom ShapeScript (as per Geert's library), there is no value in keeping the decorations in the new ShapeScript as the inherited decorations will always be displayed, unless you want to redefine it.

Thanks again!

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1350
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Custom stereotype in MDG seems to show inherited ShapeScript
« Reply #4 on: July 26, 2018, 07:12:52 pm »
What I tend to do if extending ArchiMate as you intend with objective is  to extend the new stereo type from the base UML type instead of ArchiMate. For example for instead of extending ArchiMate  Goal which is based on Class I create a stereo type and extend it from Class to create an Objective. the Stereotype has its own shapescript. That way you don't have the the base ArchiMate  element shapescript being drawn.
Happy to help
:)

pieter.steyn

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Custom stereotype in MDG seems to show inherited ShapeScript
« Reply #5 on: August 01, 2018, 10:44:44 am »
What I tend to do if extending ArchiMate as you intend with objective is  to extend the new stereo type from the base UML type instead of ArchiMate. For example for instead of extending ArchiMate  Goal which is based on Class I create a stereo type and extend it from Class to create an Objective. the Stereotype has its own shapescript. That way you don't have the the base ArchiMate  element shapescript being drawn.

Makes sense. I suppose it's a toss-up between fully controlling the visualisation, and having to define all of the metamodel relationships to make the Quick Linker work!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13510
  • Karma: +573/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Custom stereotype in MDG seems to show inherited ShapeScript
« Reply #6 on: May 18, 2020, 07:03:16 pm »
Damn, just ran into the same issue myself.
This is still not fixed.
I feel like the decorations should not be drawn unless I explicitly ask to drawn the parent shape.

Now I have to use some kind of workaround to make my shapescript show another decoration.

Geert