Class BalloonLayout<V,​E>

  • All Implemented Interfaces:
    com.google.common.base.Function<V,​java.awt.geom.Point2D>, Layout<V,​E>, java.util.function.Function<V,​java.awt.geom.Point2D>

    public class BalloonLayout<V,​E>
    extends TreeLayout<V,​E>
    A Layout implementation that assigns positions to Tree or Forest vertices using associations with nested circles ("balloons"). A balloon is nested inside another balloon if the first balloon's subtree is a subtree of the second balloon's subtree.
    Author:
    Tom Nelson
    • Field Detail

      • polarLocations

        protected com.google.common.cache.LoadingCache<V,​PolarPoint> polarLocations
      • radii

        protected java.util.Map<V,​java.lang.Double> radii
    • Constructor Detail

      • BalloonLayout

        public BalloonLayout​(Forest<V,​E> g)
        Creates an instance based on the input forest.
        Parameters:
        g - the forest on which this layout will operate
    • Method Detail

      • setRootPolars

        protected void setRootPolars()
      • setRootPolar

        protected void setRootPolar​(V root)
      • setPolars

        protected void setPolars​(java.util.List<V> kids,
                                 java.awt.geom.Point2D parentLocation,
                                 double parentRadius)
      • setSize

        public void setSize​(java.awt.Dimension size)
        Description copied from class: TreeLayout
        This method is not supported by this class. The size of the layout is determined by the topology of the tree, and by the horizontal and vertical spacing (optionally set by the constructor).
        Specified by:
        setSize in interface Layout<V,​E>
        Overrides:
        setSize in class TreeLayout<V,​E>
        Parameters:
        size - the space to use to lay out this graph
      • getCenter

        public java.awt.geom.Point2D getCenter​(V v)
        Parameters:
        v - the vertex whose center is to be returned
        Returns:
        the coordinates of v's parent, or the center of this layout's area if it's a root.
      • setLocation

        public void setLocation​(V v,
                                java.awt.geom.Point2D location)
        Description copied from interface: Layout
        Changes the layout coordinates of v to location.
        Specified by:
        setLocation in interface Layout<V,​E>
        Overrides:
        setLocation in class TreeLayout<V,​E>
        Parameters:
        v - the vertex whose location is to be specified
        location - the coordinates of the specified location
      • apply

        public java.awt.geom.Point2D apply​(V v)
        Specified by:
        apply in interface com.google.common.base.Function<V,​E>
        Specified by:
        apply in interface java.util.function.Function<V,​E>
        Overrides:
        apply in class TreeLayout<V,​E>
      • getRadii

        public java.util.Map<V,​java.lang.Double> getRadii()
        Returns:
        the radii