我试图使用以下代码更改节点颜色,但得到分段错误。
我使用的是最新的OGDF快照。
Graph G;
GraphAttributes GA(G, GraphAttributes::nodeGraphics |
GraphAttributes::edgeGraphics );
node left = G.newNode();
GA.strokeColor (left) = Color("red"); 发布于 2013-09-19 20:34:42
属性GraphAttributes::nodeGraphics只启用节点的坐标和形状,而不启用其颜色。对于笔画和填充样式,需要在构造函数中启用GraphAttributes::nodeStyle:
Graph G;
GraphAttributes GA(G,
GraphAttributes::nodeGraphics |
GraphAttributes::nodeStyle | // <-- Enables node stroke and filling
GraphAttributes::edgeGraphics );
node left = G.newNode();
GA.strokeColor(left) = Color("red"); 有关可以使用的属性和在构造函数(或更高版本)中启用的枚举值的映射,请参见枚举的文档。
https://stackoverflow.com/questions/18898977
复制相似问题