|
|
|
Re: Changing node order (bring to front) [message #1746760 is a reply to message #1746638] |
Fri, 04 November 2016 10:11 |
Olaf Donk Messages: 7 Registered: June 2016 |
Junior Member |
|
|
Okay, I've been doing my homework and I'm a bit puzzled at this point
After reading the documentation (a second... and a third time) and giving the proposed solution some thought I realized that I could use properties as well for another question I have: how to access some diagram related info inside my algorithm to tune the algorithm's behavior based on different types of nodes.
So as first step I added one property to begin with and that works fine: I declared it's existence and a default value in the .elkm file and I have it available in my algorithm. I plan to add the output property for the Z order in a next step.
Then I implemented a very basic connector, using the empty auto-generated stubs. Of course the algorithm doesn't work anymore using empty stubs, but the breakpoints in both buildLayoutGraph and applyLayout get hit, so I assumed (maybe wrongly, see below) I injected this connector correctly.
Now as I just want to add one or two properties in buildLayoutGraph and process this one Z order property in applyLayout, I rather reuse an existing implementation than writing both methods from scratch. So as a next step I've made my empty stubs extend GmfDiagramLayoutConnector and call the respective supers in the two methods. I based my choice of the GmfDiagramLayoutConnector on values I got while debugging the flow while executing my algorithm without having a custom connector injected.
And now much to my surprise the layout is not using my algorithm anymore. Breakpoints in the connector still work, but in the algorithm they're not hit , so it's not that the algorithm itself is not working correctly, but it doesn't get executed at all.
I guess I'm doing something wrong with the dependency injection. To begin with I assumed the injection of the custom algorithm was totally independent of the injection of the connector, but maybe this is not correct? A bit of help at this point would be much appreciated
Best, Olaf
|
|
|
Re: Changing node order (bring to front) [message #1751107 is a reply to message #1746760] |
Wed, 04 January 2017 14:16 |
Christoph Daniel Schulze Messages: 98 Registered: September 2015 |
Member |
|
|
I'm sorry, Olaf, I didn't see your message here. I kind of expect the newsgroup to notify me of changes, which it obviously was not set up to do automatically... :/
Olaf Donk wrote on Fri, 04 November 2016 10:11
After reading the documentation (a second... and a third time) and giving the proposed solution some thought I realized that I could use properties as well for another question I have: how to access some diagram related info inside my algorithm to tune the algorithm's behavior based on different types of nodes.
Yes, that's pretty much what properties are for. By the way, if you have any suggestions on how the documentation can be made clearer, I'd be more than happy to listen!
Olaf Donk wrote on Fri, 04 November 2016 10:11
Now as I just want to add one or two properties in buildLayoutGraph and process this one Z order property in applyLayout, I rather reuse an existing implementation than writing both methods from scratch. So as a next step I've made my empty stubs extend GmfDiagramLayoutConnector and call the respective supers in the two methods. I based my choice of the GmfDiagramLayoutConnector on values I got while debugging the flow while executing my algorithm without having a custom connector injected.
If you want to customize how the layout graph is generated for a GMF-based editor, this is what you would do, yes.
Olaf Donk wrote on Fri, 04 November 2016 10:11
And now much to my surprise the layout is not using my algorithm anymore. Breakpoints in the connector still work, but in the algorithm they're not hit , so it's not that the algorithm itself is not working correctly, but it doesn't get executed at all.
I guess I'm doing something wrong with the dependency injection. To begin with I assumed the injection of the custom algorithm was totally independent of the injection of the connector, but maybe this is not correct? A bit of help at this point would be much appreciated
The layout algorithm should not be injected in any way. Once your diagram layout connector is called, the layout process has already begun. What ELK wants your connector to do is to give ELK a configured graph structure it can work with. Once that is supplied, your layout connector is out of the picture for a while. Then ELK takes over again and checks which layout algorithm needs to be executed. It determines that by looking at the graph's top node's CoreOptions.ALGORITHM property. Thus, make sure that your layout connector sets that option to the ID of your layout algorithm. Then everything should work fine. If no algorithm is set, ELK will by default call the ELK Layered algorithm.
Does that make sense?
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04415 seconds