我已经分配了一组特定的坐标来在JGraphX中创建一个Group Cell。当我创建要放置在组中的两个顶点然后将其分组到父单元格中时,组单元格的x和y坐标会减少,因为这些组在图形中未正确对齐。当我尝试在父Cell中创建和分组越来越多的顶点时,会发生这种情况。任何避免这种情况的解决方案
Object vn= graph.insertVertex(graph.getDefaultParent(),null,null,400,500,150,40);//create group
createGraph(vn); //calling function to create vertices nd then group
void createGraph(graphGroup)
{
for(Object card : cardList)
{
int x=400 ,y=500;
graph.createGroupCell(new Object[] { graphGroup });//groupCell
try
{
Object v1 ,v2 = null;
v1 = graph.insertVertex(graphGroup, null, centerCard, x, y,150,40);
v2 = graph.insertVertex(graphGroup,null,centerCard.getConnectedCard(), x +50 , y,150,40);
Object e1 = graph.insertEdge(graphGroup, null, "", v1, v2);
graph.groupCells(graphGroup, 125, new Object[] { v1, v2 });
}
mxCompactTreeLayout treel = new mxCompactTreeLayout(graph,false);
treel.execute(graphGroup);