Book a Demo

Author Topic: EA13 image assets  (Read 8108 times)

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1387
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
EA13 image assets
« on: January 27, 2017, 12:40:57 am »
Hi,

I looked at the image assets introduced in EA13.
It's very useful since I have a number of projects where we had to organize images, which is a pain with the Image Manager.

- When converting an image to an image asset, is this asset linked with all image instances on the various diagrams? It didn't seem to be fully the case when I did a number of tests (especially checking with the Find in all diagrams..)
- Can we have a feature to convert all current images, or a selection to image assets so the convert doesn't have to be done individually? If not, can it be achieve via the API / scripts?
- Can I safely add tagged values to image assets e.g. to apply a category value?
- Will the image library on http://www.sparxsystems.com.au/resources/image_library.html  be released as images assets for EA13?

Thanks
Guillaume
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


stevesavage

  • EA User
  • **
  • Posts: 119
  • Karma: +4/-0
    • View Profile
Re: EA13 image assets
« Reply #1 on: February 06, 2017, 12:26:59 pm »
Hi Guillaume, I've also been experimenting with image assets, this is what I've found so far:

  • You can use the image assets directly in diagrams, they seem to be treated as class elements.... I've been in contact with Sparx, and they don't recommend using image assets directly in you diagram, the intent is to use them as an alternate image
  • You can use image assets as the "alternate" image for an element, but you have to set this for each diagram the element appears in... a bit of a pain
  • Once you set the image asset as the alternate image, you can update the image linked to the image asset and all you diagrams and elements pointing to it are updated.

What I'd like is a way to set the image asset as the "default" appearance for the element, but that doesn't seem to be possible yet.

So I'm trying to see if I can make a script work around for step 2.   
At the moment this is what I've figured out:
  • Each image file is stored in the table t_documents that references the GUID of the image asset Element
  • Each image asset element is stored in the t_objects table (like all other elements), element's GUID = {5E923B0A-B2C7-4761-9739-480DA752DCAE}

When you want to use the image asset for an element in the diagram:
  • You select an element, then select "appearance->select image asset as alternate image
  • Sparx EA updates t_diagramobjects and the ObjectStyle field for the diagramobject representing the element: DUID=608EC5C1;
  • Sparx EA then updates t_diagram and the StyleEx field for the diagram: OPTIONS_608EC5C1=AIG={5E923B0A-B2C7-4761-9739-480DA752DCAE}:;

So it seems to be that a script could be created that would work by:
  • Select an Element in a diagram that has already had it's appearance linked to the image asset
  • The Script identifies all diagrams that contain the Element
  • The Script would update the diagramobject.style in each diagramobject for the Element
  • The Script would update the diagram.styleEx for each diagram contain an diagramobject for the Element

Will experiment and post once I figure things out.
What I don't know right now is how Sparx EA generates the value DUID=608EC5C1;

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8617
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: EA13 image assets
« Reply #2 on: February 06, 2017, 05:41:29 pm »
Hi Steve,

I think the DUID is related to the GUID of the element.  Possibly the "right hand" portion thereof?

I think a Sparxian mentioned that one time

HTH,
Paolo
« Last Edit: February 07, 2017, 10:44:59 am by Paolo F Cantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

stevesavage

  • EA User
  • **
  • Posts: 119
  • Karma: +4/-0
    • View Profile
Re: EA13 image assets
« Reply #3 on: February 07, 2017, 12:38:16 am »
Thanks Paolo, I thought that might be the case, but at the moment I haven't found a GUID that it matches up with.

The image asset is stored in t_document,
  • docID = {5E923B0A-B2C7-4761-9739-480DA752DCAE}
  • Style = {19435D98-9499-4cbb-96B7-C58D39CB8DF7}
  • ElementID = {5E923B0A-B2C7-4761-9739-480DA752DCAE}

In t_object,
  • the image asset Element GUID = {5E923B0A-B2C7-4761-9739-480DA752DCAE}
  • the Class Element with the updated appearance has the GUID {34B7553B-BF89-48a1-936B-0C635E78DB37}

There is also an XREF entry for the image asset:
In t_xref, the XrefID = {A21E578D-6DCE-41a7-8986-B42E417636DB}, client = {5E923B0A-B2C7-4761-9739-480DA752DCAE} (the client is the GUID of the asset Element)

The GUID of the diagram = {DE664BE3-F69F-4259-A0B2-7F8FFDCEB351}

So I'm not sure where 608EC5C1 was pulled from.

I put the same Class Element on a different diagram and set it appearance to the same image asset and go a DUID of FFEED9EF

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8090
  • Karma: +118/-20
    • View Profile
Re: EA13 image assets
« Reply #4 on: February 07, 2017, 08:26:41 am »
It's a Diagram Unique ID, and is just an 8 digit1 hex number.

Any correspondence to part of any GUID is either pure coincidence, bad programming or bad random number generator.

1 Technically a hexit.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8617
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: EA13 image assets
« Reply #5 on: February 07, 2017, 10:47:57 am »
It's a Diagram Unique ID, and is just an 8 digit1 hex number.

Any correspondence to part of any GUID is either pure coincidence, bad programming or bad random number generator.

1 Technically a hexit.
Thanks for correcting that, Simon.
So, if I understand you correctly, the DUID just needs to be unique for a given diagram.

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

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: EA13 image assets
« Reply #6 on: February 07, 2017, 08:37:34 pm »
I found one use of the DUID in StyleEx (see chap. 9.11 and 9.12 Inside or search for DUID therein).

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8090
  • Karma: +118/-20
    • View Profile
Re: EA13 image assets
« Reply #7 on: February 08, 2017, 08:49:24 am »
So, if I understand you correctly, the DUID just needs to be unique for a given diagram.
That's the idea.