microsoft / microsoft/automatic-graph-layout
Node BoundaryCurve has no effect
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 319
- Avg merge
- 38m
- Merged PRs (30d)
- 1
Description
I'm trying to define the size of a node explicitly. I've tried setting the label width/height as well as setting the node's boundarycurve. Both does to seem to make any effect of the node size.
Below is my sample code.
What am I missing?
Microsoft.Msagl.Drawing.Graph graph = new Microsoft.Msagl.Drawing.Graph("");
graph.AddEdge("A", "B");
graph.AddEdge("B", "C");
int nwidth = 100;
int nheight = 100;
var geometryGraph = graph.CreateGeometryGraph();
var n = graph.FindNode("A");
n.Label.GeometryLabel = new Microsoft.Msagl.Core.Layout.Label();
n.Label.GeometryLabel.Width = nwidth;
n.Label.GeometryLabel.Height = nwidth;
n.Label.Width = nwidth;
n.Label.Height = nheight;
int r = n.Attr.LabelMargin;
n.GeometryNode.BoundaryCurve = CurveFactory.CreateRectangleWithRoundedCorners(nwidth + r * 2, nheight + r * 2, r, r, new Point());
graph.Attr.LayerDirection = LayerDirection.LR;
geometryGraph.UpdateBoundingBox();
Microsoft.Msagl.GraphViewerGdi.GraphRenderer renderer = new Microsoft.Msagl.GraphViewerGdi.GraphRenderer(graph);
renderer.CalculateLayout();
int width = 1500;
Bitmap bitmap = new Bitmap(width, (int)(graph.Height * (width / graph.Width)), PixelFormat.Format32bppPArgb);
renderer.Render(bitmap);
bitmap.Save("c:\\temp\\test.png");
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the sample code in the issue, especially the BoundaryCurve assignment and the later GraphRenderer.CalculateLayout call. Run the example and inspect whether the explicit label and node dimensions survive layout; done means the rendered node reflects the requested size or the issue explains which step overrides it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100