Interface CyLayoutAlgorithm

  • All Known Implementing Classes:
    AbstractLayoutAlgorithm

    public interface CyLayoutAlgorithm
    A task factory specifically for layout algorithms.

    Module: layout-api

    To use this in your app, include the following dependency in your POM:

    <dependency>
        <groupId>org.cytoscape</groupId>
        <artifactId>layout-api</artifactId>
    </dependency>

    Cytoscape Backwards Compatibility (SPI Interface): We expect that this interface will be implemented. Therefore to maintain backwards compatibility this interface will only be modified for major version updates.
    • Field Detail

      • ALL_NODE_VIEWS

        static final Set<View<CyNode>> ALL_NODE_VIEWS
        A convenience declaration for an empty set signifying that all node views should be laid out when creating the task iterator.
    • Method Detail

      • createTaskIterator

        TaskIterator createTaskIterator​(CyNetworkView networkView,
                                        Object layoutContext,
                                        Set<View<CyNode>> nodesToLayOut,
                                        String layoutAttribute)
        Creates a task iterator containing the layout tasks.
        Parameters:
        networkView - The network view that the layout algorithm should be applied to.
        layoutContext - The layout context for this layout algorithm.
        nodesToLayOut - The set of node views to layout.
        layoutAttribute - The possibly null name of the attribute to use for this layout.
        Returns:
        taskIterator contains layout tasks.
      • isReady

        boolean isReady​(CyNetworkView networkView,
                        Object layoutContext,
                        Set<View<CyNode>> nodesToLayOut,
                        String layoutAttribute)
        Returns true if the task factory is ready to produce a task iterator.
        Parameters:
        networkView - The network view that the layout algorithm should be applied to.
        layoutContext - The layout context for this layout algorithm.
        nodesToLayOut - The set of node views to layout.
        layoutAttribute - The possibly null name of the attribute to use for this layout.
        Returns:
        true if the task factory is ready to produce a task iterator.
      • createLayoutContext

        Object createLayoutContext()
        Returns a new layout context object. This method can be used to create custom configurations for layouts.
        Returns:
        a new layout context object.
      • getDefaultLayoutContext

        Object getDefaultLayoutContext()
        Returns the default instance of the layout context. This is the default layout configuration used in most cases.
        Returns:
        the default instance of the layout context.
      • getSupportedNodeAttributeTypes

        Set<Class<?>> getSupportedNodeAttributeTypes()
        Returns the set of node attribute types potentially used by this layout algorithm. May (and frequently will) return an empty set.
        Returns:
        types of allowable attribute types.
      • getSupportedEdgeAttributeTypes

        Set<Class<?>> getSupportedEdgeAttributeTypes()
        Returns the set of node attribute types potentially used by this layout algorithm. May (and frequently will) return an empty set.
        Returns:
        types of allowable attribute types.
      • getSupportsSelectedOnly

        boolean getSupportsSelectedOnly()
        Returns true if this algorithm supports being applied to only the currently selected nodes.
        Returns:
        true if this algorithm supports being applied to only the currently selected nodes.
      • getName

        String getName()
        Returns the computer-readable name of the layout. To get a human readable name, use toString().
        Returns:
        The computer-readable name of the layout.
      • toString

        String toString()
        Returns the human-readable name of the layout.
        Overrides:
        toString in class Object
        Returns:
        The human-readable name of the layout.