-
Notifications
You must be signed in to change notification settings - Fork 85
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
Provide JSON coordinate options #1071
base: master
Are you sure you want to change the base?
Conversation
* Record the original parent of each edge, before the call to `updateContainment()`. * Split the layout transfer into two passes: Pass 1 does everything except edges; Pass 2 does edges. This allows us to compute the global coords of each node, before working on the edges. * In this commit, we add some diagnostic output to the final JSON, which is probably not ultimately wanted. (Global coords, and original parents.)
For now, we don't do anything with it except note the enum ordinal in the JSON for each edge.
The unit tests I added are passing on my machine. I believe I'm using Java 11. Looks like they failed in CI with Java 17. I don't know why that would make a difference. |
Thank you very much for starting this PR, I will try to support you if I can.
I think the edge labels should be in the same coordinate system as the edge itself.
If we support |
plugins/org.eclipse.elk.graph.json/src/org/eclipse/elk/graph/json/JsonImporter.xtend
Outdated
Show resolved
Hide resolved
One issue with the tests is the NPE pointed out above. Another one is that the algorithm is not properly registered in the test. |
test/org.eclipse.elk.graph.json.test/src/org/eclipse/elk/graph/json/test/EdgeCoordsTest.xtend
Outdated
Show resolved
Hide resolved
test/org.eclipse.elk.graph.json.test/src/org/eclipse/elk/graph/json/test/EdgeCoordsTest.xtend
Outdated
Show resolved
Hide resolved
test/org.eclipse.elk.graph.json.test/src/org/eclipse/elk/graph/json/test/EdgeCoordsTest.xtend
Outdated
Show resolved
Hide resolved
plugins/org.eclipse.elk.graph.json/src/org/eclipse/elk/graph/json/JsonImporter.xtend
Outdated
Show resolved
Hide resolved
(Applying suggestions from code review) Co-authored-by: Sören Domrös <[email protected]>
(applying suggestion from code review) Co-authored-by: Sören Domrös <[email protected]>
Thanks for the help in interpreting the test failures. I was only running individual tests on my local machine, since I was unable to get maven working here, and I missed the ones that were failing. I've now got maven working locally, so I should be able to test more thoroughly now. |
QUESTION: Can you tell me how to run maven on just a single test class? By studying the CI code for this repo I extracted this:
which allows me to run all the tests. Following this guide I tried adding
but then it skips all the tests, including the one I want, and says, "No tests were executed!". |
This one's going to be tough for me to work on, since I'm not getting the error at all, locally. This does seem similar to what's discussed in the issue you linked (#859), where the problem arose only inside a Docker container. It seems that here the problem only occurs in the CI test runner container. As a shot in the dark, I tried adding the line
inside the one new test method that I've defined in this PR, but unfortunately I can't even seem to import elk/test/org.eclipse.elk.alg.test/src/org/eclipse/elk/alg/test/PlainJavaInitialization.java Line 15 in ad04950
and here: elk/test/org.eclipse.elk.shared.test/src/org/eclipse/elk/shared/test/ElkReflectTest.java Line 17 in ad04950
but when I put
into my test file ( Is it because I am in an |
I noticed a typo in The following command works for me, if you do the fixes above.
The local maven repo is optional, but I use this to not compromise my user local nvm repository. Clean might also be optional. Additionally, I tend to copy the elk repository to avoid unnecessary artifacts I am usually developing ELK by using the Eclipse Setup of our semantics repository using the ELK stream to install ELK, Klighd, and our SCCharts repositories in an Eclipse such that I can just run Unit tests in Eclipse. |
test/org.eclipse.elk.graph.json.test/src/org/eclipse/elk/graph/json/test/EdgeCoordsTest.xtend
Outdated
Show resolved
Hide resolved
Co-authored-by: Sören Domrös <[email protected]>
Thank you for all the help. The However, I'm finding that maven seems to rebuild everything on each run, even things having no changes (e.g. the layout algorithms), and it does this even if I omit |
As for the So perhaps its nonappearance was just some artifact of my broken testing setup. |
Okay, I'll add that. |
I think it should be easy to provide |
I don't know, whether you are familiar with Oomph setups for Eclipse. If this is not the case and your initial try fails, please do not refrain from asking questions and depending on our schedule (and mine) it might be helpful to have a short meeting regarding this since version used during the setup change frequently and one can easily spend an hour achieving nothing. I am currently using an "Eclipse IDE for Java and DSL development" with product version 2023-12 and a Java 17 as a base and use the KIELER Semantics Oomph setup an the "ELK" stream with target platform set to None. |
Now determined for each node only once, on the first traversal.
Also move definitions down in file.
I think this is ready for review, but I'd like to see how the updated docs pages will look. Is there an easy way to build the docs locally using maven? |
Not really, but I followed this one to get the setup I'm using now. It seems similar to the one for the semantics repo (but maybe not as complete?). |
Also, mention this in the docs.
Okay, I added one more commit:
|
I will try to review it till the end of the week, but I am currently not feeling well. |
Sorry to hear that! Take your time. |
The documentation for this can be found here. |
Yes, this one "only" installs ELK, which is enough to develop. The one in the semantics repository will also install tooling for the elkt and elkj languages and actual programming languages together with stuff to start a language server or an Eclipse RCA. |
Thanks, that worked perfectly. Don't know how I missed that page before. After reviewing the built docs, I think they basically look good, but of course I'll be interested to hear your feedback. One question: I used italics for page links following the style of the link to "layout options" at the top of this page, but I don't know if that's actually the desired style for all internal links or not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. How can I verify this?
I am trying to build elk-live such that I can verify that the new a new locally build elkjs version does indeed solves the issue.
Btw, I debug elk-live locally using the following setup: Debug elkjs locally
Add local elkjs in elk-live in
Build and run elk-live (requires node 18).
Select the local option for elkjs. |
I've opened kieler/elkjs#298, to share the drawing code I used to verify it during development. That one supports drawing in all of the new proposed JSON coordinate modes. Another way to verify would be to try a graph in elk-live which has bad edges (I paste one below), and then check that, once you set
then the edges look good. Actually I have not tried this yet myself, but I think it should work, and we should check it before merging this. {
"id": "root",
"properties": {
"algorithm": "layered",
"org.eclipse.elk.hierarchyHandling": "INCLUDE_CHILDREN"
},
"children": [
{ "id": "A",
"children": [
{ "id": "x", "width": 50, "height": 90 },
{ "id": "B",
"labels": [ { "text": "B", "width": 12, "height": 20 } ],
"ports": [
{ "id": "p", "width": 10, "height": 10,
"labels": [ { "text": "p", "width": 12, "height": 20 } ]
}
],
"children": [
{ "id": "y", "width": 50, "height": 90 },
{ "id": "z", "width": 50, "height": 90 }
],
"edges": [
{ "id": "e1", "sources": [ "y" ], "targets": [ "z" ] },
{ "id": "e2", "sources": [ "x" ], "targets": [ "z" ],
"labels": [ { "text": "e2", "width": 22, "height": 20 } ]
},
{ "id": "e3", "sources": [ "x" ], "targets": [ "p" ] },
{ "id": "e4", "sources": [ "p" ], "targets": [ "y" ] }
]
}
]
}
]
} |
Thanks. I plan to give this a shot. I tried building elk-live locally before, but ran into some errors and gave up. I'll let you know if I have problems again. |
@skieffer Do you need any pointers to elk-live? I guess it would be best to add a switch to the transformation from the elk json graph to sprotty? |
Hey @soerendomroes , thanks for checking in. I'm out of office this week, but hope to look at this again next week. I'll let you know how it goes with elk-live! |
Resolves #901
Resolves #1012
We provide two new properties, which control what type of coordinates you get when you load a graph from JSON, and then transfer the layout back into the same JSON.
First new property
org.eclipse.elk.json.edgeCoords
Controls coordinates for edge route points and edge labels.
Possible values:
Defaults to
CONTAINER
at root level, otherwise toINHERIT
.Second new property
org.eclipse.elk.json.shapeCoords
Controls coordinates for nodes, ports, and labels of nodes and ports.
Possible values:
Defaults to
PARENT
at root level, otherwise toINHERIT
.Summary
Setting
ROOT
in both properties is a solution to #1012.Setting
PARENT
foredgeCoords
should make a majority of those people happy who have had a problem with #901, i.e. who expect the edge coords to simply be interpreted relative to the node where the edge was defined.Questions / Tasks for this PR
org.eclipse.elk.json.nodeCoords
option? I think it would have three values:INHERIT
,PARENT
, andROOT
. Or should it beorg.eclipse.elk.json.shapeCoords
to also affect ports and labels? We need something like this for Layout option to force globalcontainer: root
coordinates for all children and edges #1012 .Tasks for another PR (in another repo)
elk-live
should be updated to force use ofPARENT
coords for edges. Currently, elk-live is still broken on this issue (example).