Author Topic: Alternate image in MDG  (Read 13047 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8595
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Alternate image in MDG
« on: April 08, 2010, 08:29:19 pm »
I tried to create an alternate image for my MDG but I can't get it to work...  I'm obviously missing the "special sauce".

Can any kind soul show me how it's done?  There were no effective references in a search.

TIA,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Michael Proske

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: Alternate image in MDG
« Reply #1 on: April 22, 2010, 05:45:25 am »
What exactly to you mean with "alternate image" ? Do you mean the icon that will be shown in the MDG Technologies dialog ? This icon should be only a 16x16 bitmap maybe this is the problem.

Rossco

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Alternate image in MDG
« Reply #2 on: April 22, 2010, 08:54:13 am »
If you want to apply an alternative image for an element in diagrams you can do this using shape script and the image function

image(
       string imageId,
       int left,
       int top,
       int right,
       int bottom)

Where the image ID is the name of an image in your model
(Settings- >Images) and the rest is formating

Regards
Ross

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8595
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Alternate image in MDG
« Reply #3 on: April 22, 2010, 09:37:49 am »
Quote
What exactly to you mean with "alternate image" ? Do you mean the icon that will be shown in the MDG Technologies dialog ? This icon should be only a 16x16 bitmap maybe this is the problem.
No Michael,

I have those OK - thanks.

I'm after what Ross was mentioning.

Ross, I was aware of using shape scripts - but the help implied I didn't need to do that.

The Help also suggested that I could use the paintbox to set Stereotype default fill, border and font colours - but that doesn't seem true either.  You have to use shapescripts also - which in this latter case don't have the same functionality.  :(

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Alternate image in MDG
« Reply #4 on: April 22, 2010, 06:28:08 pm »
Hi paolo,

Do you need an alternate image for a profiled stereotype? i've been experiencing problems with the alternate images also. I wrote shape scripts to put images as additional decorations to stereotyped elements. when the profile was exported and then applied with a MDG technology, the images weren't drawn. I guess it's because of the images werent properly exported, or have different id's, i don't know. sometimes it worked, sometimes not  :P ...

the _image attribute of the stereotypes' metaclass needs to be private, type 'int' to get working with a shape script in the initial value. never tried to specify an image (id) directly there.

HTH
günther

Krzysztof Swiatkowski

  • EA User
  • **
  • Posts: 76
  • Karma: +0/-0
  • Understanding is a three-edged sword
    • View Profile
Re: Alternate image in MDG
« Reply #5 on: April 22, 2010, 06:37:16 pm »
If you don't need the picture, just colors then you can do it without the shapescript. You just need to set "Default appearance F4" in appearance menu. And then select "Color and Appearance" in Save Profile dialog.
Unfortunately the image probably needs to be drawn.
Some time ago there was a stereotype property for applying metafile to a stereotype but it don't remember its name :(.

HTH
Kris
If I put you finger in the eye
then you have finger in the eye
and I have finger in the eye
but it's not the same

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8595
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Alternate image in MDG
« Reply #6 on: April 22, 2010, 09:18:16 pm »
Quote
If you don't need the picture, just colors then you can do it without the shapescript. You just need to set "Default appearance F4" in appearance menu. And then select "Color and Appearance" in Save Profile dialog.
[size=18]...[/size]
Hi Kris,

Thanks! My problem was I'd just coloured the element; NOT set the Default Appearance [F4].

Working now...

Paolo

Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8595
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Alternate image in MDG
« Reply #7 on: April 23, 2010, 11:55:03 am »
Quote
My problem was I'd just coloured the element; NOT set the Default Appearance [F4].
Well,

I can now set the default appearance of the stereotyped element on creation from the profile.  What I CAN'T do is what I need - to create the default appearance of the stereotype.  I need to do the same as the Default Colours panel of the UML Types Stereotypes tab.

I need to be able to change the definition in the profile and when the new profile is loaded have the new definition applied to all the elements with that stereotype.

At present, using this current technology, if I change the Default appearance of the Stereotype - all the existing elements retain the old appearance - creating confusion all round.

Is it really THAT hard to get consistency?  I mean in a profile we're dealing with metadata.  The primary use case should be how to apply the characteristics at the stereotype (not element) level.  Being able to set the element specific characteristics is, at best, as supporting use case!

If, as I suspect, it isn't possible - at present.  I have a proposal for how to (easily) make that happen.

Thoughts?
Paolo
« Last Edit: April 23, 2010, 10:07:39 pm by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8595
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Alternate image in MDG
« Reply #8 on: April 23, 2010, 10:17:30 pm »
Quote
I tried to create an alternate image for my MDG but I can't get it to work...  I'm obviously missing the "special sauce".

Can any kind soul show me how it's done?  There were no effective references in a search.

TIA,
Paolo
Back to the original question...

I've created the emf file.  Added it to the profile (as per the Profile Structure Help topic) - checked it appears in the XML and still nothing...

Anyone got it to work?

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Krzysztof Swiatkowski

  • EA User
  • **
  • Posts: 76
  • Karma: +0/-0
  • Understanding is a three-edged sword
    • View Profile
Re: Alternate image in MDG
« Reply #9 on: April 26, 2010, 09:45:26 am »
Quote
Quote
I need to be able to change the definition in the profile and when the new profile is loaded have the new definition applied to all the elements with that stereotype.

Ah so that what you need Paolo. Well you need this friendly ShapeScript:
Code: [Select]
shape main{
      SetFillColor(0,0,255);
      SetPenColor(0,255,0);
      SetPenWidth(2);
      DrawNativeShape();
}

now you only need to add _image attribute to your stereotype and your on your way. With one exception: for some strange reason you cannot change text color - but thats general problem of the ShapeScripts.

But be aware that this path leads to the dark side of UML. With ShapeScript you can change the looks completly to the point of making it unreadable. You have been warned.
On the other hand "The Force" allows you to make "cloudy" UML::Nodes which can be handy :D
Sorry, It must be 1am SW mood I got into  ;D.

Regards
Kris
If I put you finger in the eye
then you have finger in the eye
and I have finger in the eye
but it's not the same

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8595
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Alternate image in MDG
« Reply #10 on: April 26, 2010, 09:55:34 am »
Quote
[size=18]...[/size]
Ah so that what you need Paolo. Well you need this friendly ShapeScript:
[size=18]...[/size]
Hi Kris,

I'm well aware of shapescripts for MDG - I've been reporting bugs with them for most of last week...  ;)

As usual, their behaviour is self inconsistent.

My point is that the Help documentation says I can do some things WITHOUT shapescripts (such as set alternate images).  These don't work either (at least I can't make it work so far).

Frustrating isn't the word...

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Alternate image in MDG
« Reply #11 on: April 27, 2010, 01:11:26 am »
[OT]
Quote
Sorry, It must be 1am SW mood I got into  ;D.

I'd better say, it seems the [size=12]force[/size][/color] touched you. Trying to be helpful shows you're on a good way ...  ;)

WBR
g.
[/OT]


Sunshine

  • EA Practitioner
  • ***
  • Posts: 1309
  • Karma: +120/-10
  • Its the results that count
    • View Profile
Re: Alternate image in MDG
« Reply #12 on: April 30, 2010, 01:36:13 pm »
As far as I know there are two approaches to applying alternative images to stereotypes.
a) Use shape script as mention in previous lists.
b) apply the alternative image to the stereo type on the profile diagram.

I think you are after the easiest option which is option b)
On your profile diagram where you inherit from an existing meta class you need apply the alternative image (ctrl+shft+w) to the new stereotype you are creating. Then when you save as profile ensure you have the alternative image tick box selected.

I've used both techniques on past versions of EA. Although haven't tried it with V7.5 or 8.0.
Happy to help
:)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8595
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Alternate image in MDG
« Reply #13 on: April 30, 2010, 10:58:49 pm »
Quote
[size=18]...[/size]
I've used both techniques on past versions of EA. Although haven't tried it with V7.5 or 8.0.
Well, I've just tried option b) (which you've correctly noted is the one I'm after) on v8 and (just like before) it didn't work.  The image data IS generated into the XML file, but it doesn't seem to trigger the alternate image.

Can anybody confirm the process outlined for option b) works for v8?

TIA,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1309
  • Karma: +120/-10
  • Its the results that count
    • View Profile
Re: Alternate image in MDG
« Reply #14 on: June 29, 2010, 10:04:09 am »
I've recently had the opportunity to create another profile using images. One of the things I've found is that there are two ways to deploy the technology xml file created by the tools>generate MDG Technology file menu.
a) copy the file to C:\Program Files\Sparx Systems\EA\MDGTechnologies and restart EA.
or
b) Import the technology file via resources>MDG Technologies.

Thinking back a few years now it was option b) I used to get alternative images working.

With option a) the toolbox associated with the new diagram type works but the images don't seem to show.
However with option b) the images show but the toolbox doesn't work.

Don't you love it. :-?

My workaround is to use both approaches so the images work with the toolbox. Alternatively you can reference the image in a shape script. I confess I haven't gone down that path as I have 78 stereotype and don't what to write 78 shapescripts.

« Last Edit: June 29, 2010, 10:16:11 am by phenzell »
Happy to help
:)