Book a Demo

Author Topic: Alternate images in MDG and Model Templates  (Read 3423 times)

kepNCI

  • EA User
  • **
  • Posts: 127
  • Karma: +1/-0
    • View Profile
Alternate images in MDG and Model Templates
« on: August 01, 2012, 01:46:05 am »
The use of alternate images seems to get posted once a year, at least. I am new to EA within the year and wanted to use alternate images for stereotyped within an MDG as well as on elemeents on diagrams within a model template referenced within the MDG MTS file.  I initially could not get either to work.  Here is what I know so far.

Alternate Images of stereotypes within MDG Profile:
Does not currently work. This is a known bug that EA says will be fixed in some future build. During the interim EA Support recommended to use shape scripts by adding an "_image" attribute to the stereotype and selecting the browse button [...] on the" Initial Value:" field to open the shape script editor and apply script. Ensure the fully qualified name of the image begins with the technology id followed with image name.
Example Script

shape main
{
layouttype="border";
image("TechID::MyImage.jpg",0,0,100,100);
addsubshape("name","S");

shape name
{
h_align="center";
print("#NAME#");
}
}
  
This does work, that is, when one drops the stereotype element from a toolbox onto a diagram, the image is displayed. Unfortunately one looses the capability to set feature visibility.  In my case I wanted to display the alternate image AND the tagged values on the diagram. For me, displaying the tagged values on some diagrams was more important, so I chose not to use the share script and hope that EA soon fixes the alternate image functionality.


Alternate images within model template diagrams.
Initial problem:
In my model template EAP project I use an alternate image on a
boundary element in a diagram (used to display compnay logo on several
"home page" diagrams). The package is exported as an XML file, which is
referenced in my MTS Control file as the model template. When generating the MDG file, I also select the image file as one of the images to include in the technology. The generated MDG XML file is referenced via the Settings/MDG Technologies/Advanced method. When  I create a new project or add a new package using the generated MDG technology, all the packages/diagrams are correctly created, however any element/stereotype that was associated with an alternate image
reverts back to the original image and properties. However, if I import
the same XML file, the alternate image is correctly displayed, thus
leading me to believe the problem is not with the generated XML, but
with the MDG technology usage.

I was able to get this to work if:
1) I selected an image that was NOT imported via MDG.
2) When exporting package to XML, used UML 2.3 (XMI 2.1) and checked the option to same alternate images.

Hope this helps.

Karl