Search this API

y.layout.tree
Interface NodePlacer

All Known Subinterfaces:
FromSketchNodePlacer
All Known Implementing Classes:
AbstractNodePlacer, AbstractRotatableNodePlacer, ARNodePlacer, AssistantPlacer, BusPlacer, CompactNodePlacer, DefaultNodePlacer, DelegatingNodePlacer, DendrogramPlacer, DoubleLinePlacer, FreePlacer, GridNodePlacer, GroupedNodePlacer, LayeredNodePlacer, LeafPlacer, LeftRightPlacer, SimpleNodePlacer, TreeDrawer.HierarchicTreePlacer

public interface NodePlacer

A NodePlacer is responsible for the arrangement of a local root node and all of its subtrees.

Subtrees are represented as SubtreeShapes with a connecting edge to the root of the subtree.

Implementations of this interface have to:

 

Field Summary
static byte DIRECTION_ANY
          Direction specifier which indicates that any direction can be used for the connector to the parent node.
static byte DIRECTION_EAST
          Direction specifier which indicates that the connector to the parent node should end in a segment that can be extended by a segment that goes east.
static byte DIRECTION_NONE
          Direction specifier which indicates that no connector should be calculated.
static byte DIRECTION_NORTH
          Direction specifier which indicates that the connector to the parent node should end in a segment that can be extended by a segment that goes north.
static byte DIRECTION_SOUTH
          Direction specifier which indicates that the connector to the parent node should end in a segment that can be extended by a segment that goes south.
static byte DIRECTION_WEST
          Direction specifier which indicates that the connector to the parent node should end in a segment that can be extended by a segment that goes west.
 
Method Summary
 Processor createProcessor(GenericTreeLayouter layouter, LayoutGraph graph, Node currentRoot)
          Creates an optional Processor for pre- and post-processing.
 void determineChildConnectors(Node localRoot, DataMap connectorMap)
          Provides the direction of the connector to the SubtreeShape for each child node.
 GenericTreeLayouter.SubtreeShape placeSubtree(DataProvider nodeShapeProvider, DataProvider subtreeShapeProvider, LayoutGraph graph, Node localRoot, byte parentConnectorDirection)
          Arranges the SubtreeShapes of the local root and its children and routes the edges that connect them.
 

Field Detail

DIRECTION_NONE

static final byte DIRECTION_NONE
Direction specifier which indicates that no connector should be calculated.

See Also:
placeSubtree(DataProvider, DataProvider, LayoutGraph, Node, byte), Constant Field Values

DIRECTION_ANY

static final byte DIRECTION_ANY
Direction specifier which indicates that any direction can be used for the connector to the parent node.

See Also:
placeSubtree(DataProvider, DataProvider, LayoutGraph, Node, byte), Constant Field Values

DIRECTION_NORTH

static final byte DIRECTION_NORTH
Direction specifier which indicates that the connector to the parent node should end in a segment that can be extended by a segment that goes north.

See Also:
placeSubtree(DataProvider, DataProvider, LayoutGraph, Node, byte), Constant Field Values

DIRECTION_EAST

static final byte DIRECTION_EAST
Direction specifier which indicates that the connector to the parent node should end in a segment that can be extended by a segment that goes east.

See Also:
placeSubtree(DataProvider, DataProvider, LayoutGraph, Node, byte), Constant Field Values

DIRECTION_SOUTH

static final byte DIRECTION_SOUTH
Direction specifier which indicates that the connector to the parent node should end in a segment that can be extended by a segment that goes south.

See Also:
placeSubtree(DataProvider, DataProvider, LayoutGraph, Node, byte), Constant Field Values

DIRECTION_WEST

static final byte DIRECTION_WEST
Direction specifier which indicates that the connector to the parent node should end in a segment that can be extended by a segment that goes west.

See Also:
placeSubtree(DataProvider, DataProvider, LayoutGraph, Node, byte), Constant Field Values
Method Detail

determineChildConnectors

void determineChildConnectors(Node localRoot,
                              DataMap connectorMap)
Provides the direction of the connector to the SubtreeShape for each child node.

This method is called by GenericTreeLayouter before the SubtreeShapes for the children of the local root node are calculated. The direction specifiers are stored in the given map for all child nodes of the local root.

Parameters:
localRoot - the local root node
connectorMap - the map that must be used for storing the direction specifiers of the child nodes

placeSubtree

GenericTreeLayouter.SubtreeShape placeSubtree(DataProvider nodeShapeProvider,
                                              DataProvider subtreeShapeProvider,
                                              LayoutGraph graph,
                                              Node localRoot,
                                              byte parentConnectorDirection)
Arranges the SubtreeShapes of the local root and its children and routes the edges that connect them.

This method is the main method of the tree layout algorithm. It is called by GenericTreeLayouter in each recursion step to place the local root in relation to its children. Their shapes will be merged into one SubtreeShape, which is returned by this method.

The SubtreeShape for the local root can be obtained from the nodeShapeProvider. subtreeShapeProvider contains the SubtreeShapes assigned to the child nodes.

Due to the order in which the tree nodes are processed, it is guaranteed that at the time of the invocation of this method the SubtreeShape of every descendant node has already been calculated.

Parameters:
nodeShapeProvider - the DataProvider for obtaining an initial shape of the root node
subtreeShapeProvider - the DataProvider for accessing the pre-calculated shapes of the subtrees
graph - the input graph
localRoot - the root of the subtree that should be arranged by this method
parentConnectorDirection - the direction specifier for the connector of the local root node to its parent node
Returns:
the combined shape of the whole subtree

createProcessor

Processor createProcessor(GenericTreeLayouter layouter,
                          LayoutGraph graph,
                          Node currentRoot)
Creates an optional Processor for pre- and post-processing.

This method is called by GenericTreeLayouter before arranging the SubtreeShapes. If no pre- or post-processing is needed, this method may return null.

Parameters:
layouter - the current GenericTreeLayouter instance
graph - the input graph
currentRoot - the root node handled by this NodePlacer
Returns:
a Processor instance or null

© Copyright 2000-2021,
yWorks GmbH.
All rights reserved.