7月23日

搞清楚平面布局类的各个参数

orthoLayout

此类的getBoundingBox()函数可以返回包围盒

separationcOverhangoptionsmargin结果
200.4
00
myGraph.png 

10.400myGraph(1).png 

可见separation控制线之间的距离

此值不能是0

20 
1000myGraph(3).png 
cOverhang似乎没什么影响,但是它的值也不能是0
200.40100myGraph(4).png 
margin对结果没有什么影响

当结果有多个连通分量时,margin控制不同连通分量之间的距离
200.410myGraph(5).png 

200.420myGraph(6).png 
发生了一些变化,但不知道有什么意义
200.440myGraph(7).png 
发生了一些变化,但不知道
有什么意义


一些参数的意义

pageRatio 放置不同的连通分量时,最终结果的要求宽高比,一般为1

margin 当结果有多个连通分量时,控制不同连通分量之间的距离


布局聚类图的代码


ClusterGraph   CG(G);

SList<node>     c1List, c2List, c3List;

for (int i = 0; i < nNodes/3; ++i)

c1List.pushBack(nodeArray[i]);

for (int i = nNodes/3; i < nNodes/3*2; ++i)

c2List.pushBack(nodeArray[i]);

for (int i = nNodes/3*2; i < nNodes; ++i)

c3List.pushBack(nodeArray[i]);

cluster c1 = CG.createCluster(c1List);

cluster c2 = CG.createCluster(c2List);

cluster c3 = CG.createCluster(c3List);

ClusterGraphAttributes   CGA(CG, 

ClusterGraphAttributes::nodeId|

ClusterGraphAttributes::nodeGraphics|

ClusterGraphAttributes::edgeGraphics);

CGA.setAllWidth(20);

CGA.setAllHeight(20);

CGA.clusterLineWidth(c1) = 5;

CGA.clusterLineWidth(c2) = 5;

CGA.clusterLineWidth(c3) = 5;


ClusterPlanarizationLayout cpl;

ClusterOrthoLayout* col = new ClusterOrthoLayout;

col->separation(10);

col->margin(30);

cpl.setPlanarLayouter(col);

cpl.call (G, CGA, CG,false);

结果如下:

myGraph(8).png 





原文地址:https://www.cnblogs.com/dydx/p/4236159.html