Interface LayoutModel2D<V>

  • Type Parameters:
    V - the vertex type
    All Superinterfaces:
    java.lang.Iterable<java.util.Map.Entry<V,​Point2D>>
    All Known Implementing Classes:
    ListenableLayoutModel2D, MapLayoutModel2D

    public interface LayoutModel2D<V>
    extends java.lang.Iterable<java.util.Map.Entry<V,​Point2D>>
    A general interface for the 2D layout model. The layout model provides the necessary components to a LayoutAlgorithm2D in order to draw a graph. Its responsibility is to provide the available drawable area, to be able to store and answer queries about vertex coordinates, and to allow someone to fix (make permanent) a vertex location.
    Author:
    Dimitrios Michail
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default java.util.Map<V,​Point2D> collect()
      Collect a map of all vertices locations.
      Point2D get​(V vertex)
      Get the last location of a particular vertex in the model.
      Box2D getDrawableArea()
      Get the drawable area of the model.
      boolean isFixed​(V vertex)
      Check whether a vertex is a fixed point.
      java.util.Iterator<java.util.Map.Entry<V,​Point2D>> iterator()
      Get an iterator with all vertices' locations.
      Point2D put​(V vertex, Point2D point)
      Set the location of a vertex.
      void setDrawableArea​(Box2D drawableArea)
      Set the drawable area of the model.
      void setFixed​(V vertex, boolean fixed)
      Set a point as being a "fixed-point" or not.
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Method Detail

      • getDrawableArea

        Box2D getDrawableArea()
        Get the drawable area of the model.
        Returns:
        the drawable area of the model
      • setDrawableArea

        void setDrawableArea​(Box2D drawableArea)
        Set the drawable area of the model.
        Parameters:
        drawableArea - the drawable area to use
      • get

        Point2D get​(V vertex)
        Get the last location of a particular vertex in the model. May return null if the vertex has not been assigned a location or if the particular implementation does not store the coordinates.
        Parameters:
        vertex - the graph vertex
        Returns:
        the last location of the vertex
      • put

        Point2D put​(V vertex,
                    Point2D point)
        Set the location of a vertex.
        Parameters:
        vertex - the graph vertex
        point - the location
        Returns:
        the previous location or null if the vertex did not have a previous location or if the model does not store locations
      • setFixed

        void setFixed​(V vertex,
                      boolean fixed)
        Set a point as being a "fixed-point" or not. It is the model's responsibility to make sure that changing the coordinates of a fixed point by calling put(Object, Point2D) has no effect.
        Parameters:
        vertex - a vertex
        fixed - whether it is a fixed point or not.
      • isFixed

        boolean isFixed​(V vertex)
        Check whether a vertex is a fixed point. It is the model's responsibility to make sure that changing the coordinates of a fixed point by calling put(Object, Point2D) has no effect.
        Parameters:
        vertex - the vertex
        Returns:
        true if a fixed point, false otherwise
      • collect

        default java.util.Map<V,​Point2D> collect()
        Collect a map of all vertices locations. May return null if the model does not store locations.
        Returns:
        a map with all the locations
      • iterator

        java.util.Iterator<java.util.Map.Entry<V,​Point2D>> iterator()
        Get an iterator with all vertices' locations. May return an empty iterator if the model does not store locations.
        Specified by:
        iterator in interface java.lang.Iterable<V>
        Returns:
        an iterator which returns all vertices with their locations. May return an empty iterator if the model does not store locations.