Node overlapping problem in HorizontalTreeLayoutAlgorithm [message #1745979] |
Thu, 20 October 2016 06:51  |
Sumit Fataniya Messages: 12 Registered: July 2016 |
Junior Member |
|
|
I have currently some problem with tree and HorizontalTreeLayoutAlgorithm.The problem is when there is multiple graph node, join with a all nodes.
All Graph node are at leaf level node overlapped on each other.
Code For creating Horzontal tree:
public class ZestView extends ViewPart {
private Graph graph;
private int layout = 1;
public void createPartControl(Composite parent) {
Tree tree = new Tree(parent, SWT.None | SWT.MULTI);
TreeItem itemroot;
TreeItem itemchild, itemchild1, itemchild2;
graph = new Graph(parent, SWT.NONE);
for (int r = 0; r < 1; r++) {
itemroot = new TreeItem(tree, SWT.NONE);
GraphNode source = new GraphNode(graph, SWT.NONE, "Parent");
for (int j = 0; j < 04; j++) {
itemchild = new TreeItem(itemroot, SWT.NONE);
GraphNode destinantion = new GraphNode(graph, SWT.NONE,"Child Level1");
new GraphConnection(graph, estStyles.CONNECTIONS_DIRECTED,source, destinantion);
for (int su = 0; su < 20; su++) {
itemchild2 = new TreeItem(itemchild1, SWT.NONE);
GraphNode destinantion2 = new GraphNode(graph,SWT.NONE, "Child Level 3 ");
new GraphConnection(graph,ZestStyles.CONNECTIONS_DIRECTED, destinantion1,destinantion2);
}
}
graph.setLayoutAlgorithm(new HorizontalTreeLayoutAlgorithm(
LayoutStyles.NO_LAYOUT_NODE_RESIZING), true);
}
}
}
In the output screen the nodes of the graph on level 3 are overlapping.
How to avoid this?
[Updated on: Mon, 24 October 2016 10:08] Report message to a moderator
|
|
|
Re: Node overlapping problem in HorizontalTreeLayoutAlgorithm [message #1746167 is a reply to message #1745979] |
Mon, 24 October 2016 12:05   |
|
Well, there are multiple possibilities: 1) Allow the layout algorithm to position nodes outside of the viewport (applyLayout() takes width and height parameters), and use scaling or scrolling to make it accessible; 2) Allow the layout algorithm to resize nodes, so that the children on level 3 are resized to fit the viewport (however, their labels will not be readable); 3) Hide/Show elements depending on context information so that the graph is not as polluted as it is if all information is shown (possibly utilizing context menus); 4) Use a different layout algorithm that better utilizes the available space.
If you are developing a new application, maybe it is worth to take a look at the new GEF Zest [1]. You will need to make some efforts in order to get a satisfying visualization with either technology. However, the new GEF Zest already provides scrolling and a layout-bounds property. So increasing the area in which the nodes are layed out should be relatively easy. It also provides a HidingModel that can be used to hide nodes and edges, so that restricting the visualization to the currently needed nodes should be relatively easy.
[1] https://github.com/eclipse/gef/wiki/Zest
Best regards,
Matthias
|
|
|
|
Powered by
FUDForum. Page generated in 0.01857 seconds