Author Topic: Prevent sterotype icon from overlapping base class  (Read 4511 times)

Gusztav

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
  • EA expert
    • View Profile
    • Imprestige. Your issues in safe hands.
Prevent sterotype icon from overlapping base class
« on: October 02, 2013, 02:55:09 am »
Hi,

I have a class stereotype for which a custom shape script is defined. The shape script displays an icon at the top right corner of the class, and it works just fine. However when a class of that stereotype has a superclass, which is not shown on a diagram on which the mentioned class is displayed, EA displays the name of the superclass at the top right corner of the class box. Unfortunatelly, the icon overlaps with the name of the superclass and hides a part of it.

How can I get this working so that the icon and the label aligns to each other? If I have to override the main shape (now my script only contains a decoration block), how can I access that part of the rectangle and how can I access the supertype of a class in a shape script?

Thanks,
Gus
------------------------
Imprestige. Your issues in safe hands.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Prevent sterotype icon from overlapping base c
« Reply #1 on: October 02, 2013, 05:10:55 am »
You should report that as a bug since an overlap is not correct - however you take it. The only "solution" is to enlarge the frame so the text fits and does not overlap.

I have no idea how to access the superclass :-/

q.
« Last Edit: October 02, 2013, 05:12:58 am by qwerty »

Gusztav

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
  • EA expert
    • View Profile
    • Imprestige. Your issues in safe hands.
Re: Prevent sterotype icon from overlapping base c
« Reply #2 on: October 02, 2013, 05:14:45 am »
Even worse, since both the icon, both the label is right-aligned, enlarging anything does not have any effect to the problem. Gonna report it, though I think I'll get an instruction to try to redefine the main shape and add the superclass name myself. :)

Thanks for your time.

Gus
------------------------
Imprestige. Your issues in safe hands.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Prevent sterotype icon from overlapping base c
« Reply #3 on: October 02, 2013, 05:46:52 am »
Maybe they have a solution at hand. I should probably also write a book about shape scripts :-)

q.

Gusztav

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
  • EA expert
    • View Profile
    • Imprestige. Your issues in safe hands.
Re: Prevent sterotype icon from overlapping base c
« Reply #4 on: October 02, 2013, 07:47:48 pm »
Would appreciate it. :) Actually it took me ages to make almost sure (confident enough) the canvas is of 100x100 units. I found no hint as to how to size a stereotype decoration for example, and if your potential next book could address similar questions, it would fill real gaps. :)
------------------------
Imprestige. Your issues in safe hands.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Prevent sterotype icon from overlapping base c
« Reply #5 on: October 03, 2013, 09:11:39 am »
The drawing area for a decoration is 16x16 drawing units (pixels at 100% zoom), but the majority of commands that you are likely to use in a decoration take values that are percentage of drawing area. So this:

Code: [Select]
decoration x
{
    ellipse(0,0,100,100);
}
will use 100% of the drawing area to give a circle of diameter 16 pixels. You can draw outside the decoration, e.g. ellipse(-50,-50,150,150);

Regarding your original question, I think the only way to avoid the decoration overwriting the superclass name is to have the decoration in the top left corner instead. Decorations have no way of knowing what they are being drawn in front of.
The Sparx Team
[email protected]

Gusztav

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
  • EA expert
    • View Profile
    • Imprestige. Your issues in safe hands.
Re: Prevent sterotype icon from overlapping base c
« Reply #6 on: October 03, 2013, 03:49:54 pm »
Thanks KP. Maybe you could add it to EA's nice-to-have list to align superclass name with the decoration, since placing an icon to the top-right corner is more UML-ish and catches the eyes better (just think of the built-in rectangle notation of UML activities). Until that I'll place the icon to the opposite side. :)
------------------------
Imprestige. Your issues in safe hands.