Author Topic: Parsing the Layout of Diagrams  (Read 7066 times)

olav

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Parsing the Layout of Diagrams
« on: June 10, 2005, 12:01:19 am »
Hi!

Parsing the EA model via COM yields a problem. When I want to have a look at the layout of the diagrams I get the collection of displayed objects (DiagramObjects) and have a look at each individual DiagramObject. These have the members left, right, top, and bottom which (according to the docs) ought to hold the position of the object in the diagram. Unfortunately, the values found there do not correspond to the actual position I perceive by looking at the diagram.

What's wrong with my approach? What am I missing?

Thank you very much!


Best Regards,

Olav

Erwan

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Parsing the Layout of Diagrams
« Reply #1 on: June 03, 2024, 06:36:03 pm »
Hi !!

It's been a while since you posted this message but I have the same problem, have you or anyone found a solution. On my side I try to match the position value with the image snippet with "PutDiagramImageToFile()" and the position does not match the generated images.

Best regards,

Erwan

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13283
  • Karma: +556/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Parsing the Layout of Diagrams
« Reply #2 on: June 03, 2024, 06:43:51 pm »
Can you explain how it doesn't match?

I'm sure you'll need to do some translation to match the size of the image, but relatively speaking they should match.

Geert

Erwan

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Parsing the Layout of Diagrams
« Reply #3 on: June 03, 2024, 07:24:02 pm »
Yes, it's look like a translation problem, all position seems to draw the diagram but all my problem is here. I don't know how to retrieve the translation.

I tried to find manually the translation on a diagram by comparing rectangle area of different element, but it's a failed, I suppose that element have margin ?! And this is not a solution I have to know all the translation for all diagram so I couldn't make it manually.

I was hoping that exist a value to retrieve it or a way to calculate it, but I didn't find it. :'(

Erwan

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13283
  • Karma: +556/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Parsing the Layout of Diagrams
« Reply #4 on: June 03, 2024, 07:58:30 pm »
It should really be simple math.

You can compare the size of your diagram with the size of your image, and calculate the relevant positions based on that.

Geert

Erwan

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Parsing the Layout of Diagrams
« Reply #5 on: June 03, 2024, 09:51:03 pm »
I tried it and it doesn't work, because the "PutDiagramImageToFile" method only prints the diagram, compared to diagram.cx and diagram.cy which are the

diagram values ​​of x and y based on landscape and portrait format even if the diagram takes up less space. 

I will look for other method

Erwan

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13283
  • Karma: +556/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Parsing the Layout of Diagrams
« Reply #6 on: June 03, 2024, 11:02:53 pm »
if you look for max diagramObject.right, and min diagramObject.bottom, you should get the used size of the diagram no?

Geert

Erwan

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Parsing the Layout of Diagrams
« Reply #7 on: June 03, 2024, 11:54:01 pm »
yes this could work, currently I am getting it to match position but only for a one page diagram by exporting with diagram.SaveImagePage() and simple

translation, but I need to concatenate pages for the larger diagram, nothing impossible!

Otherwise, thank you for your advice and opinions.


Erwan

johann

  • EA User
  • **
  • Posts: 26
  • Karma: +1/-0
    • View Profile
Re: Parsing the Layout of Diagrams
« Reply #8 on: June 04, 2024, 06:28:51 pm »
I'm not sure if this helps you: The image maps in the HTML report contain the exact positions of diagram objects in the exported PNG diagram images (but just for some object boxes).

For example:

Code: [Select]
<div class="diagram_image">
  <img src="EA2.png" usemap="#EA2" border="0">
  <map name="EA2">
    <area shape="rect" coords="270,290,480,489" href="EA14.htm" target="_self">
    <area shape="rect" coords="50,290,240,390" href="EA15.htm" target="_self">
    <area shape="rect" coords="50,67,483,245" href="EA13.htm" target="_self">
  </map>
</div>

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8063
  • Karma: +118/-20
    • View Profile
Re: Parsing the Layout of Diagrams
« Reply #9 on: June 05, 2024, 08:26:41 am »
The numbers you're getting out of the API are the numbers stored in the database.

Most likely the problem is that you're trying to compare it to a saved image, which obeys the option: Start > Appearance > Preferences > Diagram > Scale Saved Bitmaps to