Author Topic: Label position in shape  (Read 113 times)

Mats Gejnevall

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Label position in shape
« on: January 05, 2017, 03:44:44 am »
I have created a decoration in my shape. But the label of the element overrights the shape when there are long label names. I would like to be able to move the label printing down a few lines. I am using the Class element as a base for my shape. Must I create my totally own shape to be successful?

qwerty

  • EA Guru
  • *****
  • Posts: 8090
  • Karma: +106/-84
  • I'm no guru at all
    • View Profile
Re: Label position in shape
« Reply #1 on: January 05, 2017, 05:35:46 am »
Can you post your current code?

q.

Mats Gejnevall

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Label position in shape
« Reply #2 on: January 10, 2017, 02:22:04 am »
This is the decoration in my Stereotype (copy of archimate capability). From _image

decoration capability
{
   orientation="NE";
   //Top row
   rectangle (90,0,60,30);
   //Second row
   rectangle (60,60,30,30);
   rectangle (90,60,60,30);
   //Third row
   rectangle (0,90,30,60);
   rectangle (60,90,30,60);
    rectangle (90,90,60,60);
}

qwerty

  • EA Guru
  • *****
  • Posts: 8090
  • Karma: +106/-84
  • I'm no guru at all
    • View Profile
Re: Label position in shape
« Reply #3 on: January 10, 2017, 10:06:35 am »
I see what you mean. Positioning standard labels/compartments is not possible (AFAIK). So if you really need it, you have to bite the bullet. Means: write everything you want to see with your own prints and create compartments. Not that funny, I guess. It's probably easier to either enlarge the elements so there's no overlap.

q.

P.S. I just realize that the decoration appears in the same line as the stereotype and the class name is right below. So the issue will only occur if your stereotype name is rather long.

Mats Gejnevall

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Label position in shape
« Reply #4 on: January 10, 2017, 06:35:37 pm »
But normallly I do not show the stereotype in my elements and then the problem stays.

qwerty

  • EA Guru
  • *****
  • Posts: 8090
  • Karma: +106/-84
  • I'm no guru at all
    • View Profile
Re: Label position in shape
« Reply #5 on: January 10, 2017, 09:37:29 pm »
It thought that you could show the stereotype and draw a rectangle with the background color right over that place. Of course you can not specify absolute sizes, but only relative ones, so that won't work. I also noticed that with my V12 FillPath() also draws a border line which should only appear with FillAndStrokePath() (any takers to submit a bug report are welcome). So yes, you are just unlucky here.

q.

Mats Gejnevall

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Label position in shape
« Reply #6 on: January 11, 2017, 02:17:34 am »
I guess I could create the shape from scratch with Shapescripts but that might not help either if I cannot place the print() at the right place.

qwerty

  • EA Guru
  • *****
  • Posts: 8090
  • Karma: +106/-84
  • I'm no guru at all
    • View Profile
Re: Label position in shape
« Reply #7 on: January 11, 2017, 07:32:26 pm »
The problem with all those is, that positions are always relative. In that case you would need some absolute Position. Usually the relative positioning works for many cases, but the lack of absolute positioning is really a pity.

q.

Simon M

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 5928
  • Karma: +34/-2
    • View Profile
Re: Label position in shape
« Reply #8 on: January 12, 2017, 08:49:30 am »
Here, try using this shape script for an element with long (wrappable) name.

Code: [Select]
shape main
{
layouttype="border";
addsubshape("heading","N");
rectangle(0,0,100,100);

shape heading
{
layouttype="border";
preferredheight=25;
addsubshape("icon","E");
addsubshape("name","CENTER");

shape icon
{
preferredwidth=25;
ellipse(10,10,90,90);
}

shape name
{
h_align = "center";
println("#SS##STEREOTYPE##ES#");
println("#NAME#");
}
}
}

Border layout is my goto for absolute positioning, but does get complex. Set fixed region is used for an absolute size at a relative position.

qwerty

  • EA Guru
  • *****
  • Posts: 8090
  • Karma: +106/-84
  • I'm no guru at all
    • View Profile
Re: Label position in shape
« Reply #9 on: January 12, 2017, 10:18:52 am »
That fixes the heading part, but you loose the attr/oper compartments.

q.

Mats Gejnevall

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Label position in shape
« Reply #10 on: January 14, 2017, 02:10:44 am »
I mailed with SPARX support and there is not way of doing this keeping all the advantages of using UML shapes.