Search this API

y.layout
Class BufferedLayouter

java.lang.Object
  extended by y.layout.AbstractLayoutStage
      extended by y.layout.BufferedLayouter
All Implemented Interfaces:
Layouter, LayoutStage

public class BufferedLayouter
extends AbstractLayoutStage

A BufferedLayouter is a hull algorithm that invokes its core layout algorithm on a copy of the input graph.

After the layout process has finished, the calculated layout will either be written back to the original graph or provided as a separate graph layout information in terms of the original input graph.

This class also provides the possibility to perform arbitrary layout algorithms merely on a graph interface plus associated graph layout. This comes in handy if an application has its own graph and only provides a graph interface adapter to the yFiles graph layout machinery.

 
It is recommended to run layout calculations on a copy of the original graph. Then, if for some reason the layout calculation fails, the graph won't be compromised.
 

Field Summary
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
BufferedLayouter()
          Creates a new BufferedLayouter instance without a core layout algorithm.
BufferedLayouter(Layouter coreLayouter)
          Creates a new BufferedLayouter instance using the given core layout algorithm.
 
Method Summary
 GraphLayout calcLayout(GraphInterface graph, GraphLayout layout)
          Returns the layout calculated by the core layout algorithm without changing the input graph.
 GraphLayout calcLayout(LayoutGraph graph)
          Returns the layout calculated by the core layout algorithm without changing the input graph.
 boolean canLayout(LayoutGraph graph)
          Checks whether or not this layout algorithm is able to arrange the given graph.
 void doLayout(GraphInterface graph, GraphLayout layout)
          Applies the layout calculated by the core layout algorithm to the input graph.
 void doLayout(LayoutGraph graph)
          Applies the layout calculated by the core layout algorithm to the input graph.
 
Methods inherited from class y.layout.AbstractLayoutStage
canLayoutCore, doLayoutCore, getCoreLayouter, setCoreLayouter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferedLayouter

public BufferedLayouter()
Creates a new BufferedLayouter instance without a core layout algorithm.


BufferedLayouter

public BufferedLayouter(Layouter coreLayouter)
Creates a new BufferedLayouter instance using the given core layout algorithm.

Parameters:
coreLayouter - the core layout routine
Method Detail

calcLayout

public GraphLayout calcLayout(LayoutGraph graph)
Returns the layout calculated by the core layout algorithm without changing the input graph.

 
The layout calculation is invoked on a copy of the given graph. The given graph won't be modified.
Parameters:
graph - the input graph
Returns:
the calculated graph layout
See Also:
calcLayout(GraphInterface, GraphLayout)

calcLayout

public GraphLayout calcLayout(GraphInterface graph,
                              GraphLayout layout)
Returns the layout calculated by the core layout algorithm without changing the input graph.

 
The layout calculation is invoked on a copy of the given graph. The given graph won't be modified.
Parameters:
graph - the input graph
layout - the layout information for the input graph
Returns:
the calculated graph layout
See Also:
calcLayout(LayoutGraph)

doLayout

public void doLayout(LayoutGraph graph)
Applies the layout calculated by the core layout algorithm to the input graph. The layout calculation is invoked on a copy of the given graph. Then, the calculated layout will be written back to the given graph.

Parameters:
graph - the input graph
See Also:
doLayout(GraphInterface, GraphLayout)

doLayout

public void doLayout(GraphInterface graph,
                     GraphLayout layout)
Applies the layout calculated by the core layout algorithm to the input graph. The layout calculation is invoked on a copy of the given graph. Then, the calculated layout will be written back to the given graph.

Parameters:
graph - the input graph
layout - the layout information for the input graph
See Also:
doLayout(LayoutGraph)

canLayout

public boolean canLayout(LayoutGraph graph)
Checks whether or not this layout algorithm is able to arrange the given graph. This method delegates the actual check to the current core layout algorithm.

Parameters:
graph - the input graph
Returns:
true if there is no core layout algorithm or the core layout algorithm accepts the graph, false otherwise
See Also:
Layouter.doLayout(LayoutGraph)

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