自定义布局管理器中设置线条格式

 框架默认的连线方式是:STRAIGHT_LINE;我需要使用是ORTHOGONAL_STRAIGHT_POLYLINE;

这些样式在fr.kapit.layouts.constants.EdgeDrawType中有定义。

思路:

1、在创建线条时设定线条格式

 

var l: ILink = diagrammer.addLinkElement({test:"test"},nodeIndex[link.start.nodeId],nodeIndex[link.end.nodeId], null,-1,-1,null,null,4 )as ILink;

失败;

 

2、在创建布局管理器时设置线条格式

 

protected override function preLayoutProcessing():void

{

super.preLayoutProcessing();

//没有效果

this.edgeDrawing = EdgeDrawType.ORTHOGONAL_STRAIGHT_POLYLINE;

this.enableMoveToCenter=true;

_graph = _originalGraph;

}

 

3、在实现布局管理器时设置线条格式

protected override function performComputation():void

{

var node:Node;

var w:Number = _graph.width;

var h:Number = _graph.height;

var nodeNumber:int=_graph.numberOfNodes-1;

var degree:Number=2*Math.PI/nodeNumber;

trace("CustomLayout "+w+"   "+h);

var count:uint=0;

var currentDegree:Number=0;

// trace("degree: "+degree);

for each(node in _graph.nodes)

{

                                实现布局

}

if(enableMoveToCenter)

moveToCenter();  // Moving graph to its previous center

if(!graph.isRootGraph)

graph.fitToContent(); // If the layouted group is a subgroup it should be autofitted to its content.

graph.fitToContent();

// this.updateStraightTypedEdges(); // Assigning Edges paths

this.updateOrthogonalTypedEdges(_graph.edges);

}

成功;

你可能感兴趣的:(自定义布局,线条格式)