Please excuse me if this topic was already addressed somewhere, I couldn't find anything though in the tutorial nor on this forum...
I would like to use Zest's LayoutAlgorithm in an auto layout Feature in Graphiti.
I've seen the FAQ about integrating an arbitrary automatic layouter and have tested the TutorialLayoutDiagramFeature, but I'm unsure how this relates to Zest LayoutAlgorithmn.
Will I have to create an offscreen GraphViewer and layout my elements there, getting back the coordinates to feed the Graphiti Diagram? Or is there any way to use LayoutAlgorithmn directly in Graphiti?
Has anyone here ever achieved something like that and if so, could you tell me more?
Any pointers will be greatly appreciated!
I think you have to map
* the org.eclipse.graphiti.mm.pictograms.Diagram to org.to the org.eclipse.draw2d.graph.CompoundDirectedGraph, like shown in the TutorialLayoutDiagramFeature.java
* map the org.eclipse.draw2d.graph.CompoundDirectedGraph to org.eclipse.zest.core.widgets.Graph
* org.eclipse.draw2d.graph.Node -> org.eclipse.zest.core.widgets.GraphNode
* org.eclipse.draw2d.graph.Edge -> org.eclipse.zest.core.widgets.GraphConnection
* apply the Zest layout algorithm, e.g.
* map the org.eclipse.zest.core.widgets.Graph back to org.eclipse.draw2d.graph.CompoundDirectedGraph
* map the org.eclipse.draw2d.graph.CompoundDirectedGraph back to org.eclipse.graphiti.mm.pictograms.Diagram
I think you can even skip the mapping to CompoundDirectedGraph and map the Diagram directly to Graph, as org.eclipse.zest.core.widgets.GraphNode has a method getLocation() : Point, where you can map the coordinates.