Hello once again) Now I'm trying to edit labels on some Nodes displayed in GViewer and I also have to resize Nodes in order to make changed labels fit into them.
But I faced a strange problem:
Calling ResizeNodeToLabel on every Node added to the graph after it had been attached to GViewer results in NullPointerException or IndexOutOfBoundsException (if graph already had some previously added nodes).
I found a temporary workaround for this problem, now I'm just commenting out this line in GViewer.cs:
//LayoutHelpers.IncrementalLayout(Graph.GeometryGraph, node.GeometryNode,
// Graph.LayoutAlgorithmSettings as SugiyamaLayoutSettings);
but I don't think that's the correct solution.
In order to reproduce the issue modify MouseDown handler in EdgeDirectionTest as follows:
//ResizeNodeToLabel shouldn't cause a crash here but it does.
private void viewer_MouseDown(object sender, MsaglMouseEventArgs e)
{
if (e.RightButtonIsPressed) {
IViewerObject ob = gv.ObjectUnderMouseCursor;
if (ob == null) {
Microsoft.Msagl.Core.Geometry.Point p = gv.ScreenToSource(e.X, e.Y);
Node n = new Node(this.FindNewId());
IViewerNode iwn = gv.CreateIViewerNode(n, p, true);
gv.AddNode(iwn, true);
gv.ResizeNodeToLabel(n);
}
else if (ob is IViewerNode) {
IViewerNode existingNode = ob as IViewerNode;
gv.RemoveNode(existingNode, true);
}
}
}
@levnach , please look at this when you have time.
Hello once again) Now I'm trying to edit labels on some Nodes displayed in GViewer and I also have to resize Nodes in order to make changed labels fit into them. But I faced a strange problem:
Calling ResizeNodeToLabel on every Node added to the graph after it had been attached to GViewer results in NullPointerException or IndexOutOfBoundsException (if graph already had some previously added nodes). I found a temporary workaround for this problem, now I'm just commenting out this line in GViewer.cs: //LayoutHelpers.IncrementalLayout(Graph.GeometryGraph, node.GeometryNode, // Graph.LayoutAlgorithmSettings as SugiyamaLayoutSettings); but I don't think that's the correct solution.
In order to reproduce the issue modify MouseDown handler in EdgeDirectionTest as follows:
@levnach , please look at this when you have time.