Book a Demo

Author Topic: Symbol for composite element in stereotypes  (Read 5468 times)

balutoo

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Symbol for composite element in stereotypes
« on: February 05, 2008, 06:52:28 am »
hallo

in some elements one can see a symbol to show that the element has got a composite element.

If this element has got a stereotype this symbol is not shown any more.

Is there a possibility of showing such a symbol automatically in a stereotype with composite element??

balutoo

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Symbol for composite element in stereotypes
« Reply #1 on: February 05, 2008, 02:03:16 pm »
The only reason that I can think a stereotyped element wouldn't show the composite element indicator is if the stereotype applies a shape script. You can modify the shape script to show a composite symbol of your own design, something like this:

Code: [Select]
decoration composite
{
 orientation="se";
 if(hasproperty("iscomposite","true"))
 {
   // draw your own glyph here...
 }
}


If there is some other reason why you aren't seeing the link symbol, you'll need to give some more details (i.e. tell us which element and stereotype).
The Sparx Team
[email protected]

balutoo

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Symbol for composite element in stereotypes
« Reply #2 on: February 05, 2008, 11:20:42 pm »
hallo

I tried this following code:


Code: [Select]
shape main
{
  noshadow = "true";
  h_align = "center";
  v_align = "bottom";

  startpath();
  roundrect(0,0,100,100, 20,20);
  moveto(05,20);
  lineto(50,10);
  lineto(95, 20);
  moveto(05,23);
  lineto(50,13);
  lineto(95, 23);
  endpath();
  setfillcolor(233,255,255);
  fillandstrokepath();
 
  decoration composite
  {
     orientation="se";
    if(hasproperty("iscomposite","true"))
    {
       ellipse(75, 80, 80, 85);
       ellipse(80, 80, 85, 85);
    }
  }
  println("#NAME#");

}


But there nothing happened.

I take the ACTIVITY-element in an ACTIVITY DIAGRAM in EA Version 7, build 816.

do you need any more information??
thanks for help.
« Last Edit: February 05, 2008, 11:24:59 pm by balutoo »

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Symbol for composite element in stereotypes
« Reply #3 on: February 06, 2008, 01:53:51 pm »
The decoration section needs to be a top level one, not a sub-shape of the shape main section.
The Sparx Team
[email protected]

rabra

  • EA User
  • **
  • Posts: 50
  • Karma: +0/-0
    • View Profile
Re: Symbol for composite element in stereotypes
« Reply #4 on: February 07, 2008, 05:32:19 am »
Hallo,
this topic is interesting for me too, and I have tried some things without success.
But I think there are some things not yet clear to me:

Code: [Select]
decoration composite
{
 orientation="se";
 if(hasproperty("iscomposite","true"))
 {
   // draw your own glyph here...
 }
}  



Is the first line of the code something like a subshape?
I call a subshape with the method 'addsubshape(subshapeName, position1, position2). Do I call this thing equivalently? Or with another call?
Or - as you write that the decoration needs to be a top level section - do I have to write directly into the shape main? (What I have tried without success)
Or do I have to replace shape main with decoration composite?

And am I right that the thing 'hasproperty("iscomposite","true")' refers to the option 'Composite Element' in an element?

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Symbol for composite element in stereotypes
« Reply #5 on: February 07, 2008, 07:06:29 am »
IIRC you just write the decoration as if it were another shape. It is at the same level as the shape main, not inside it. The script should draw both your shape and your decoration.

I think you can also decorate a 'normal' shape. If EA does not see a shape main, it will use the default rendering, adding your decoration and placing it appropriately.

David
No, you can't have it!

balutoo

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Symbol for composite element in stereotypes
« Reply #6 on: February 08, 2008, 04:12:03 am »
Hallo

I tried out some things with shapes. If one writes two shapes one behind the other, then you can see only one. With one testscript I found out that the shape standing above is the one that is shown.

Code: [Select]

decoration eins
{
   startpath();
   rectangle(5, 5, 95, 95);
   endpath();
   fillandstrokepath();  
}

decoration zwei
{
   startpath();
   rectangle(30, 30, 70, 70);
   endpath();
   fillandstrokepath();
}


How can I show both??


«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Symbol for composite element in stereotypes
« Reply #7 on: February 08, 2008, 04:14:03 am »
Only one should be a decoration. The other should be a 'main' shape. This way the main shape will be drawn, then the decoration will be drawn on top (i.e. higher in the z-order).

Did it work?
No, you can't have it!

rabra

  • EA User
  • **
  • Posts: 50
  • Karma: +0/-0
    • View Profile
Re: Symbol for composite element in stereotypes
« Reply #8 on: February 08, 2008, 04:33:40 am »
I tried out the given script from balutoo - first original, then with calling one or both parts with 'shape' instead of 'decoration', and calling one of them 'shape main'. But I always only see the shape that is first in the script.
What else may be wrong?

I think I have the same surroundings as balutoo (EA 7.816, Activity Diagram).

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Symbol for composite element in stereotypes
« Reply #9 on: February 10, 2008, 08:09:42 pm »
Quote
Code: [Select]
decoration eins
{
    startpath();
    rectangle(5, 5, 95, 95);
    endpath();
    fillandstrokepath();  
}

decoration zwei
{
    startpath();
    rectangle(30, 30, 70, 70);
    endpath();
    fillandstrokepath();
}

How can I show both??

You can show them in different positions, as defined by the "orientation" setting. For example:
Code: [Select]

decoration eins
{
   orientation="NW";  // North-West
   startpath();
   rectangle(5, 5, 95, 95);
   endpath();
   fillandstrokepath();  
}

decoration zwei
{
   orientation="SE";  // South-East
   startpath();
   rectangle(30, 30, 70, 70);
   endpath();
   fillandstrokepath();
}
The Sparx Team
[email protected]