Book a Demo

Author Topic: Using metafiles in a profile  (Read 4733 times)

ocroquette

  • EA User
  • **
  • Posts: 93
  • Karma: +0/-0
    • View Profile
Using metafiles in a profile
« on: July 03, 2007, 03:16:59 am »
Hi

I am creating a profile, but somehow I can not get metafiles (EMF) working.

I tried to create a custom shape for my stereotypes, and calling Image("xxx.emf"), but it doesn't seem to work.

Then I saw in the documentation that the Stereotype supports directly a metafile:

<Stereotype name="Router" cx="130" cy="100" notes="" metafile="router.emf">

When I export my profile, and then edit the XML file accordingly, and import it in another model, everything works fine, but I don't really like the idea to have to edit the XML files manually after each update of the profile!

Where in the model of my profile can I set this "metafile" attribute?

Thanks for your attention!
« Last Edit: July 03, 2007, 03:17:35 am by ocroquette »

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Using metafiles in a profile
« Reply #1 on: July 03, 2007, 04:25:38 am »
If you don't get a quick (two days or so) response on this - someone may recognize the symptom and know the answer off hand - then I suggest you report this to Sparx as a bug.

My suspicion is that this is not a bug, and that there is some quirk that you have to see before it works correctly.

If you figure it out please post back to this thread so others can see the solution when they run into this.

David
No, you can't have it!

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Using metafiles in a profile
« Reply #2 on: July 03, 2007, 01:35:31 pm »
In your profile, apply the metafile to the <<stereotype>> class (Ctrl+Shift+W), then when you save the profile make sure the "Alternate Image" option is checked.
The Sparx Team
[email protected]

ocroquette

  • EA User
  • **
  • Posts: 93
  • Karma: +0/-0
    • View Profile
Re: Using metafiles in a profile
« Reply #3 on: July 04, 2007, 01:12:45 am »
Quote
In your profile, apply the metafile to the <<stereotype>> class (Ctrl+Shift+W), then when you save the profile make sure the "Alternate Image" option is checked.


Many thanks, it worked like a charm.
The bad side effect is that on the profile's diagram, the stereotype is shown with the alternate image  :-/

I am trying now to create a shape script so that the user can influence the representation of his stereotyped classes. A typical example is:

Code: [Select]


shape main      
{
 shape emf
 {
   image("my.emf",0,0,100,100);
 }

 shape native
 {
   drawnativeshape();
 }
 
 if(hasTag("notation", "emf"))
    addsubshape("emf", 100, 100);
 else
    addsubshape("native", 100, 100);

 return;
}


However, I can't get the image("my.emf") to work. The EMF is never available in the client model, even if I:


  • put the EMF file in the same directory as the profile's files, as stated in the documentation
  • attach it as alternate image to the stereotype (in this case the shape script is not executed at all apparently.
  • insert manually the image in the image database of the client model


I am surprised to see how to define custom appearance of stereotypes in a profile is tricky, and I am grateful for your help!

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Using metafiles in a profile
« Reply #4 on: July 04, 2007, 03:37:08 am »
I think you have to either import the image into the target model, or export and import the appropriate reference data.

I don't have a suitably configured model handy to try this out with, but see if you can use these to make it work.

David
No, you can't have it!

ocroquette

  • EA User
  • **
  • Posts: 93
  • Karma: +0/-0
    • View Profile
Re: Using metafiles in a profile
« Reply #5 on: July 08, 2007, 11:08:16 pm »
Hi David!

Thanks, you're right: it works by manually importing the EMF files in the target model.

But it kind of defeats to goal of a profile.


«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Using metafiles in a profile
« Reply #6 on: July 09, 2007, 03:22:33 am »
I know. It's a bit of a catch-22 as it currently stands.

Somehow it seems that the Sparx-produced profiles do this, so it may be possible. If so, I'm missing how it is accomplished.

Perhaps - after rereading the documentation on profiles - you should submit a feature request to Sparx, so that the metafiles will be exported with the profile.

David
No, you can't have it!