Browse by category:
|| | ||
How to preserve the position of a node in a hierarchical layout after the node has been replaced?
Replacing a single node in the grapher may cause major differences at the
next layout of the nodes. The incremental mode helps to preserve the old
positions when new nodes are added to a grapher laid out with the class
These are the steps for replacing a node with minimal impact on the overall
- Perform layout on the graph.
- Set the incremental mode to true.
- Get the center coordinates of the node:
IlvRect bbox = oldnode.boundingBox();
float centerX = bbox.x + 0.5f * bbox.width;
float centerY = bbox.y + 0.5f * bbox.height;
- Replace the node.
- Set the position of the new node so that its center matches
the position of the old node:
IlvRect bbox = newnode.boundingBox();
centerX - 0.5f * bbox.width,
centerY - 0.5f * bbox.height,
- Perform layout on the graph again.
|Also listed in|
|Visualizations -> JViews -> Diagrammer|
|Visualizations -> JViews -> Enterprise|
|Accessing the scrollbars of IlvHierarchyChart||IlvGeneralNode will not redraw correctly after changing any of...|