Skip to content
本页目录

Class: LayoutSystem

布局系统

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new LayoutSystem(animationSystem, graphSystem)

Parameters

NameType
animationSystemAnimationSystem
graphSystemGraphSystem

Properties

animationSystem

animationSystem: AnimationSystem


graphSystem

graphSystem: GraphSystem

Methods

circleLayout

circleLayout(graph, opt?): Layout

对指定图对象做圆形布局

指定的图如果不是一棵树,将自动生成图的最小生成树,然后根据最小生成树生成布局对象

Parameters

NameType
graphGraph
opt?CircleLayoutOpt

Returns

Layout


getCircleLayoutPositions

getCircleLayoutPositions(rootVetext, opt?): any[]

Parameters

NameTypeDescription
rootVetextVertext-
opt?Object-
opt.angleScale?number每层角度缩小系数, 默认1,总的角度保持不变
opt.cx?number-
opt.cy?number-
opt.endAngle?number-
opt.radius?number-
opt.radiusScale?number每层半径缩小系数, 默认0.5
opt.startAngle?number-
opt.update?Function-

Returns

any[]


shapeLayout

shapeLayout(objects, shapeOrPoints): Layout

根据指定的对象集合 和 形状来生成布局

对象的个数 <= 点的个数

Parameters

NameType
objectsNode[]
shapeOrPointsPointLike[] | Shape

Returns

Layout


sizeFitToChildren

sizeFitToChildren(node, padding?): void

调整节点对象的尺寸:尺寸刚好覆盖住所有子节点

Parameters

NameType
nodeNode
padding?number

Returns

void


travelTree

travelTree(graph, rootVetext): any[]

遍历一棵树所有顶点-广度优先

Parameters

NameType
graphGraph
rootVetextVertext

Returns

any[]


treeLayout

treeLayout(graph): Layout

对指定图对象做树形布局

指定的图如果不是一棵树,将自动生成图的最小生成树,然后根据最小生成树生成布局对象

Parameters

NameType
graphGraph

Returns

Layout