Package | com.yworks.yfiles.layout.tree |
Class | public class TreeReductionStage |
Inheritance | TreeReductionStage AbstractLayoutStage YObject Object |
Typical usage:
TreeLayouter tl = new TreeLayouter(); TreeReductionStage trs = new TreeReductionStage(); trs.setNonTreeEdgeRouter(new OrganicEdgeRouter()); trs.setNonTreeEdgeSelectionKey(OrganicEdgeRouter.ROUTE_EDGE_DPKEY); tl.appendStage(trs); new BufferedLayouter(tl).doLayout(graph); tl.removeStage(trs);
Note that if there are edges between group nodes, the com.yworks.yfiles.layout.tree.TreeLayouter may throw a com.yworks.yfiles.base.InvalidGraphStructureException -Exception. Such exceptions can be prevented by temporarily removing those edges.
Note that this layout stage is also able to handle multi-parent structures, i.e., structures of multiple nodes that share the same predecessors as well as the same successors. More precisely, if the specified core layout can handle multi-parent structures (see com.yworks.yfiles.layout.tree.GenericTreeLayouter.multiParentAllowed) and option multiParentAllowed is enabled, this stage does not hide such structures (i.e., the multi-parents are passed to the core layouter).
See also
Property | Defined By | ||
---|---|---|---|
coreLayouter : Layouter
Specifies the core layouter. | AbstractLayoutStage | ||
multiParentAllowed : Boolean
Specifies whether or not multi-parent structures (structures of multiple nodes that share the same predecessors as well as the same successors) are allowed. | TreeReductionStage | ||
nonTreeEdgeRouter : Layouter
Getter:
Returns the currently set edge router for non-tree edges. | TreeReductionStage | ||
nonTreeEdgeSelectionKey : Object
Getter:
Returns the currently set non-tree edge selection key. | TreeReductionStage |
Method | Defined By | ||
---|---|---|---|
TreeReductionStage(init:Boolean = true) | TreeReductionStage | ||
canLayout(graph:LayoutGraph):Boolean [override]
Returns true. | TreeReductionStage | ||
Creates a layouter that can be used to route all non-tree edges as a single straight-line segment. | TreeReductionStage | ||
doLayout(graph:LayoutGraph):void [override] | TreeReductionStage | ||
equals(o:Object):Boolean | YObject | ||
getClass():Class [override] | TreeReductionStage | ||
hashCode():int | YObject | ||
[static] | TreeReductionStage |
Method | Defined By | ||
---|---|---|---|
canLayoutCore(graph:LayoutGraph):Boolean
Queries the core layouter whether or not the given graph can be laid out. | AbstractLayoutStage | ||
doLayoutCore(graph:LayoutGraph):void
Invokes the layout routine of the core layouter. | AbstractLayoutStage | ||
initAbstractLayoutStage1():void | AbstractLayoutStage | ||
initAbstractLayoutStage2(core:Layouter):void | AbstractLayoutStage | ||
initTreeReductionStage():void | TreeReductionStage | ||
Routes the non-tree edges. | TreeReductionStage |
Constant | Defined By | ||
---|---|---|---|
NON_TREE_EDGES_DPKEY : Object = TreeReductionStage#NON_TREE_EDGES_DPKEY [static]
DataProvider key that can be used to explicitly mark (some) edges that should not be considered to belong to a tree. | TreeReductionStage |
multiParentAllowed | property |
multiParentAllowed:Boolean
Specifies whether or not multi-parent structures (structures of multiple nodes that share the same predecessors as well as the same successors) are allowed.
More precisely, if this option is enabled and the specified core layout can handle multi-parent structures (see com.yworks.yfiles.layout.tree.GenericTreeLayouter.multiParentAllowed), this stage does not hide such structures (i.e., the multi-parent structures are passed to the core layouter).
public function get multiParentAllowed():Boolean
public function set multiParentAllowed(value:Boolean):void
See also
nonTreeEdgeRouter | property |
nonTreeEdgeRouter:Layouter
Getter: Returns the currently set edge router for non-tree edges.
Setter: Sets the edge router for non-tree edges. Very often, this method should be used in conjunction with nonTreeEdgeSelectionKey to control the set of edges that should be handled by the edge router. public function get nonTreeEdgeRouter():Layouter
public function set nonTreeEdgeRouter(value:Layouter):void
See also
nonTreeEdgeSelectionKey | property |
nonTreeEdgeSelectionKey:Object
Getter: Returns the currently set non-tree edge selection key.
Setter: Sets the DataProvider key that will be used by the non-tree edge router to determine the set of edges that should be routed. public function get nonTreeEdgeSelectionKey():Object
public function set nonTreeEdgeSelectionKey(value:Object):void
See also
TreeReductionStage | () | Constructor |
public function TreeReductionStage(init:Boolean = true)
init:Boolean (default = true )
|
canLayout | () | method |
override public function canLayout(graph:LayoutGraph):Boolean
Returns true
.
Parameters
graph:LayoutGraph |
Boolean |
createStraightlineRouter | () | method |
public function createStraightlineRouter():Layouter
Creates a layouter that can be used to route all non-tree edges as a single straight-line segment.
ReturnsLayouter |
See also
doLayout | () | method |
getClass | () | method |
override public function getClass():Class
ReturnsClass |
initTreeReductionStage | () | method |
protected final function initTreeReductionStage():void
newTreeReductionStage | () | method |
routeNonTreeEdges | () | method |
protected function routeNonTreeEdges(graph:LayoutGraph, nonTreeEdgeMap:EdgeMap):void
Routes the non-tree edges.
Parameters
graph:LayoutGraph — graph that can contain tree and non-tree edges.
| |
nonTreeEdgeMap:EdgeMap — an edge map that marks all non-tree edges in the graph with boolean value true .
|
NON_TREE_EDGES_DPKEY | Constant |
public static const NON_TREE_EDGES_DPKEY:Object = TreeReductionStage#NON_TREE_EDGES_DPKEY
DataProvider key that can be used to explicitly mark (some) edges that should not be considered to belong to a tree.