Class RescaleLayoutAlgorithm2D<V,​E>

java.lang.Object
org.jgrapht.alg.drawing.RescaleLayoutAlgorithm2D<V,​E>
Type Parameters:
V - the vertex type
E - the edge type
All Implemented Interfaces:
LayoutAlgorithm2D<V,​E>

public class RescaleLayoutAlgorithm2D<V,​E>
extends java.lang.Object
A layout algorithm which re-scales vertex positions to (center-scale,center+scale) in all dimensions. The algorithm first subtracts the mean on each axis separately, then all values are adjusted so that the maximum magnitude becomes scale. The result is finally translated back to the old center. This procedure preserves the aspect ratio.
Author:
Dimitrios Michail
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.util.function.Function<V,​Point2D> initializer
    A model initializer
  • Constructor Summary

    Constructors 
    Constructor Description
    RescaleLayoutAlgorithm2D​(double scale)
    Create a new layout algorithm
  • Method Summary

    Modifier and Type Method Description
    java.util.function.Function<V,​Point2D> getInitializer()
    Get the initializer
    protected void init​(Graph<V,​E> graph, LayoutModel2D<V> model)
    Initialize a model using the initializer.
    void layout​(Graph<V,​E> graph, LayoutModel2D<V> model)
    Layout a graph.
    void setInitializer​(java.util.function.Function<V,​Point2D> initializer)
    Set the initializer

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • initializer

      protected java.util.function.Function<V,​Point2D> initializer
      A model initializer
  • Constructor Details

    • RescaleLayoutAlgorithm2D

      public RescaleLayoutAlgorithm2D​(double scale)
      Create a new layout algorithm
      Parameters:
      scale - the scale parameter
  • Method Details

    • layout

      public void layout​(Graph<V,​E> graph, LayoutModel2D<V> model)
      Description copied from interface: LayoutAlgorithm2D
      Layout a graph.
      Parameters:
      graph - the graph
      model - the layout model to use
    • getInitializer

      public java.util.function.Function<V,​Point2D> getInitializer()
      Get the initializer
      Returns:
      the initializer
    • setInitializer

      public void setInitializer​(java.util.function.Function<V,​Point2D> initializer)
      Set the initializer
      Parameters:
      initializer - the initializer
    • init

      protected void init​(Graph<V,​E> graph, LayoutModel2D<V> model)
      Initialize a model using the initializer.
      Parameters:
      graph - the graph
      model - the model