Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Is there a way/an option to "force" position coordinates from an ELK layout to be considered as an "Integer" (without digit after comma)? #1126

Open
lredor opened this issue Feb 6, 2025 · 1 comment
Labels
question Request for support in using ELK.

Comments

@lredor
Copy link
Contributor

lredor commented Feb 6, 2025

Ask your questions
As discussed in forum today, I have a problem indirectly caused by the floating coordinates.

I have no simple reproduction use case. In ELK everything is OK. But after that, I "translate" ELK graph to a GMF graph and there are some glitches on edges (of one pixel). Because the source node have not the same absolute y location than the target node (because of coordinates with xxx.5)

Reproduction use case files
The following zip contains three ELKT files:

  • 1-beforeELKLayout.elkt : The original diagram.
  • 2_afterELKLayout.elkt : The diagram after the ELK layout.
  • 3_manualSimulationOfResultOnGMFSide.elkt : The same diagram manually modified to observe the GMT result.
    elktSampleFiles.zip

The graph seems to be too big to be sent with "ELK live" links.

Screenshots
The ELK result is like this:
Image

The edge "toA1", between "C111" and "A1", is a straight edge.
The absolute y coordinate of C111 is 116.5+44.5+33+33=227.
The absolute y coordinate of A1 is 138+89=227.

But after conversion to GMF, C111 absolute y coordinate is 228 and the edge "toA1" has a bendpoint of one pixel.
I manually simulate the observed result in GMF. It is like this:

Image

@lredor lredor added the question Request for support in using ELK. label Feb 6, 2025
@soerendomroes soerendomroes added this to the Release 0.10.1 milestone Feb 7, 2025
@lredor
Copy link
Contributor Author

lredor commented Feb 7, 2025

I finally found a solution on my side. The approach is to take into account the rounding of the parents' coordinates to avoid drifting too much (and therefore rounding up or down).

To try to clarify my approach, if I take the example of four nodes contained within each other, with each a location of {10.5, 10.5} relative to its parent: A / B / C / D.
The absolute coordinates on the ELK side are:

  • A: {10.5, 10.5}
  • B: {21, 21}
  • C: {31.5, 31.5}
  • D: {42, 42}

The result on the GMF side was:

  • A: {11, 11}
  • B: {22, 22}
  • C: {33, 33}
  • D: {44, 44}

Now the result on the GMF side is:

  • A: {11, 11}
  • B: {21, 21}
    *C: {32, 32}
    *D: {42, 42}

I don't know if there is really something to do on ELK side (except an option to directly round the coordinates). But with this trick, I have non longer my problem.

lredor added a commit to eclipse-sirius/sirius-desktop that referenced this issue Feb 7, 2025
Problem is described here
eclipse-elk/elk#1126.
There is no simple reproduction use case because the issue was observed
in a complex customer diagram.

Change-Id: Ib70266ce1039040a19a1d09e2d93283c500c53ea
lredor added a commit to eclipse-sirius/sirius-desktop that referenced this issue Feb 28, 2025
Problem is described here
eclipse-elk/elk#1126.
There is no simple reproduction use case because the issue was observed
in a complex customer diagram.

Change-Id: Ib70266ce1039040a19a1d09e2d93283c500c53ea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Request for support in using ELK.
Projects
None yet
Development

No branches or pull requests

2 participants