Search this API

y.layout.hierarchic.incremental
Interface DrawingDistanceCalculator

All Known Implementing Classes:
DefaultDrawingDistanceCalculator, TypeBasedDrawingDistanceCalculator

public interface DrawingDistanceCalculator

This interface determines the minimum distances between elements that belong to the same layer.

DrawingDistanceCalculator is implemented by a helper class used by HierarchicLayouter during the phase of node placement (i.e. when the final coordinates for all nodes are calculated). NodePlacer uses instances of this interface to determine the minimum distances between elements that belong to the same layer.

Information about graph elements (i.e. nodes or edges) is given using a LayoutDataProvider while information about layers is given through Layer (describes a single layer of the hierarchic layout) or Layers (manages multiple layers of the hierarchic layout).

Implementations not needed any more should be disposed of.

The default implementation used by the HierarchicLayouter is DefaultDrawingDistanceCalculator.

 
Your browser does not support SVG content.

Method Summary
 void dispose(LayoutGraph graph, Layers layers, LayoutDataProvider ldp)
          Disposes of internal data structures.
 double getMinDistance(LayoutGraph graph, Layer layer, LayoutDataProvider ldp, Node left, Node right)
          Main interface method called by NodePlacer instances to determine the minimum distance between Nodes of same layer.
 void initialize(LayoutGraph graph, Layers layers, LayoutDataProvider ldp)
          Initializes internal data structures.
 

Method Detail

initialize

void initialize(LayoutGraph graph,
                Layers layers,
                LayoutDataProvider ldp)
Initializes internal data structures.

Implementations may cache lengthy calculations in the initialization phase.

 
It is guaranteed that the graph will not be changed during subsequent calls to getMinDistance(LayoutGraph, Layer, LayoutDataProvider, Node, Node).
Parameters:
graph - the input graph that contains all elements that are used during the node placement
layers - the Layers object that will be used during subsequent calls
ldp - the LayoutDataProvider implementation which provides access to the NodeData and EdgeData instances
See Also:
dispose(LayoutGraph, Layers, LayoutDataProvider)

getMinDistance

double getMinDistance(LayoutGraph graph,
                      Layer layer,
                      LayoutDataProvider ldp,
                      Node left,
                      Node right)
Main interface method called by NodePlacer instances to determine the minimum distance between Nodes of same layer.

 
One of Node arguments may be null if its border is not of interest. In that case, only the border of the non-null Node instance should be considered.
Parameters:
graph - the input graph
layer - the Layer object that will be used during subsequent calls
ldp - the LayoutDataProvider implementation which provides access to the NodeData and EdgeData instances
left - the left of the two Nodes whose minimum distance is to be determined or null if only the left border of the right Node is of interest
right - the right of the two Nodes whose minimum distance is to be determined or null if only the right border of the left Node is of interest
Returns:
the minimum distance between two Nodes of the same layer

dispose

void dispose(LayoutGraph graph,
             Layers layers,
             LayoutDataProvider ldp)
Disposes of internal data structures.

Implementations should release internally held data structures when they are not needed any more.

Parameters:
graph - the input graph that contains all elements that are used during the node placement
layers - the Layers object that will be used during subsequent calls
ldp - the LayoutDataProvider implementation which provides access to the NodeData and EdgeData instances
See Also:
initialize(LayoutGraph, Layers, LayoutDataProvider)

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