Class CachingLayout<V,E>

java.lang.Object
edu.uci.ics.jung.algorithms.layout.LayoutDecorator<V,E>
edu.uci.ics.jung.visualization.layout.CachingLayout<V,E>
All Implemented Interfaces:
com.google.common.base.Function<V,Point2D>, Layout<V,E>, IterativeContext, Caching, Function<V,Point2D>

public class CachingLayout<V,E> extends LayoutDecorator<V,E> implements Caching
A LayoutDecorator that caches locations in a clearable Map. This can be used to ensure that edge endpoints are always the same as vertex locations when they are drawn in the render loop during the time that the layout's relaxer thread is changing the locations.
See Also:
  • Field Details

    • locations

      protected com.google.common.cache.LoadingCache<V,Point2D> locations
  • Constructor Details

    • CachingLayout

      public CachingLayout(Layout<V,E> delegate)
  • Method Details

    • setGraph

      public void setGraph(Graph<V,E> graph)
      Specified by:
      setGraph in interface Layout<V,E>
      Overrides:
      setGraph in class LayoutDecorator<V,E>
      Parameters:
      graph - the graph that this algorithm is to operate on
    • clear

      public void clear()
      Description copied from interface: Caching
      clear cache
      Specified by:
      clear in interface Caching
    • init

      public void init()
      Description copied from interface: Caching
      ititialize resources for a cache
      Specified by:
      init in interface Caching
    • apply

      public Point2D apply(V v)
      Specified by:
      apply in interface com.google.common.base.Function<V,E>
      Specified by:
      apply in interface Function<V,E>