Book a Demo

Author Topic: Replace metafile assignment with a ShapeScript  (Read 2879 times)

jakob

  • EA User
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
Replace metafile assignment with a ShapeScript
« on: May 06, 2011, 12:38:05 am »
Hi everyone!

When assigning an image metafile to a stereotype, the name of the element is displayed directly under the image. Even when the element is being resized, the name label is always directly under the image without additional space between label and image. I really like this visualization style. But for one of my stereotypes I need to change the image (metafile) according to a certain tagged value.

I tried to rebuild the visualization described above with a shape script to be able to change the element's icon. But I'm not able to reproduce the described behavior with a ShapeScript:

Code: [Select]
shape main {
      h_Align = "center";
      v_Align = "bottom";
      image("image.emf",0,0,100,90);
      print("#name#");
}

But this results not in the desired behaviour:

As the font-size of the label is fixed and the image dimension are relative, the label overlays the image when the element is very small and when the element is very big, there is a lot of space between the image and the label.

Maybe there are some other possibilities to get the desired behavior?
I just want to have the same behavior applied when defining a metafile to a stereotype and additionally be able to change the image according to a certain tagged value of the element (which seems only be possible by using a ShapeScript?).

Thanks a lot,
Jakob
« Last Edit: June 17, 2011, 05:09:47 am by jakob »

jakob

  • EA User
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
Re: Replace metafile assignment with a ShapeScript
« Reply #1 on: June 23, 2011, 03:44:57 am »
For anyone who is interested in this, too: I found a solution that works very well.

Code: [Select]
shape main {
      noshadow = "true";
      layouttype = "border";
      addsubshape("name","S");
      addsubshape("image","center");
      shape name {
            h_align="center";
            preferredHeight=12;
            print("#NAME#");
      }
      shape image {
            image("image.emf",0,0,100,100);
      }
}

Jakob