I've a graph with 18 vertices and lots of edges. Due to the number of elements involved and their structure the built-in algorithms available (i.e. mxHierarchicalLayout used for the shown image ) are not working as expected, causing the majority of edges with description to overlap, as shown in the picture Current status sample.
Doing some tests and checks in the source code I managed to change only few things on the edges trough the geometry of the mxCell:
- Edge lable
- Control points
However I'm not finding any way to manipulate the point of the source and target terminals. Can anyone suggest me the proper classes/methods to be used to control where the terminal should be connected.
Any help/info would be appreciated.
The code I managed to test to manipulate the edges is the following:
..
Arrays.asList(edges).stream().map(edge -> (mxCell) edge).forEach(edge -> {
mxGeometry newGeo = (mxGeometry) edge.getGeometry().clone();
// TODO calculate condition
// This code actually move the label from the default
// position
mxPoint offset = new mxPoint(edge.getGeometry().getPoint().getX() + EDGE_OFFSET,
edge.getGeometry().getPoint().getY() + EDGE_OFFSET);
newGeo.setOffset(offset);
newGeo.setX(newGeo.getX() + 1);
if (newGeo.getPoints() != null) {
newGeo.getPoints().forEach(point -> {
point.setX(point.getX() + 200);
point.setY(point.getY() + 200);
});
}
model.setGeometry(edge,newGeo);
});
Thanks and regards