Author Topic: V15-1512 : Shape Scripts drawnativeshape() always renders shadows  (Read 149 times)

Samuraibel

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Trying to get a decoration on an actionpin in an activity diagram. Script below :
shape main {
    noshadow=true;
    drawnativeshape();
}
Then there is a decoration afterwards.
But it seems the noshadow statement is not take into account, the drawnativeshape() invocation always renders a shadow.

The decoration should be different for inputs and outputs. Can I use the "Kind" field - visible in the properties view - by a query e.g. HasProperty ?     

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 6817
  • Karma: +63/-7
    • View Profile
Re: V15-1512 : Shape Scripts drawnativeshape() always renders shadows
« Reply #1 on: October 21, 2019, 02:05:41 pm »
Shadows aren't something you can influence about the native shape. Just colours and line thickness. However, using rectangle (0,0,100,100); Will effectively do the same thing.

Yes, you can use HasProperty("kind","input") or HasProperty("kind","output")

eg.
Code: [Select]
shape main
{
    noshadow=true;
rectangle (0,0,100,100);
defSize (16,16);
if(hasproperty("parentedge","top"))
{
if(hasproperty("kind","input"))
{
addsubshape("down");
}
else
{
addsubshape("up");
}
}
if(hasproperty("parentedge","bottom"))
{
if(hasproperty("kind","input"))
{
addsubshape("up");
}
else
{
addsubshape("down");
}
}
if(hasproperty("parentedge","left"))
{
if(hasproperty("kind","input"))
{
addsubshape("right");
}
else
{
addsubshape("left");
}
}
if(hasproperty("parentedge","right"))
{
if(hasproperty("kind","input"))
{
addsubshape("left");
}
else
{
addsubshape("right");
}
}

shape up
{
print("^");
}
shape down
{
print("\/");
}
shape left
{
print("<");
}
shape right
{
print(">");
}
}
« Last Edit: October 21, 2019, 02:17:32 pm by Eve »
Eve

support@sparxsystems.com

Samuraibel

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: V15-1512 : Shape Scripts drawnativeshape() always renders shadows
« Reply #2 on: October 21, 2019, 06:26:55 pm »
Thank you very much for the reply and the script  :D

But some comments :

1) drawnativeshape() is described in manuals as :  Renders the shape in its usual, non Shape Script notation; subsequent drawing commands are superimposed over the native notation.

Therefore, as ActionPin is not shadowed if I add via ChildElement or via Toolbox, but it gets shadowed if I use drawnativeshape(), does that mean addition via ChildElement or Toolbox would not provide the usual notation ? But then  - what else and how ?

 This is really not intuitive - and should be adapted. Drawnativeshape should render the shape the same way it is displayed in the context of the diagram. Or it should take into account noshadow et al.

2) Looking again in the manuals - online and offline - the "kind" field is not mentioned as property in the shape script parts . Well, could have tried ...
Anyhow worth to add, and if there would be others missing .....

3)The script is great and basically does what I want - but : the rectangle fits in size and location at the time I invoke the stereotype, but as soon as it becomes selected e.g. to move  it is re-drawn andd there remains a gap between the activity and the actionpin - they are not overlapping, the gap is close to the width of the shadow around the activity element.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 6817
  • Karma: +63/-7
    • View Profile
Re: V15-1512 : Shape Scripts drawnativeshape() always renders shadows
« Reply #3 on: October 28, 2019, 10:12:49 am »
1) I do get a shadow normally, not sure what the difference is at this point.
2) Not sure about the documentation, but HasProperty can also query the CustomProperties. Which is effectively just the type specific properties defined in UML for the current element. I'd prefer to see something in the shape script help that says that these properties exist, but I'm not sure where this documentation of uml datatypes should go. Or even if it should be written down. I know it can be queried via our API.
3) I had some issues with the pin resizing badly until I added the defSize(16,16). What you are describing doesn't sound like anything I saw.
Eve

support@sparxsystems.com

Modesto Vega

  • EA User
  • **
  • Posts: 331
  • Karma: +6/-4
    • View Profile
Re: V15-1512 : Shape Scripts drawnativeshape() always renders shadows
« Reply #4 on: November 01, 2019, 05:17:22 am »
Do these shadows have different colours? If they all have the same colour, what happens to the shadow if you change the status of an element?

Shadows or, at least, something that looks like a shadow can be linked to the status of an element.