Interface SpacialIndex2DEnumerator<K>

Type Parameters:
K - The key type, inherited from the SpacialIndex2D
All Known Subinterfaces:
NodeSpacialIndex2DEnumerator

public interface SpacialIndex2DEnumerator<K>
Enumerator returned when querying a SpacialIndex2D, used to iterate over the results of the query.

Example usage:

 SpacialIndex2D spacialIndex = networkViewSnapshot.getSpacialIndex2D();
 SpacialIndex2DEnumerator<Long> enumerator = spacialIndex.queryAll();
 float[] extents = new float[4];
 while(enumerator.hasNext()) {
     // extents will contain the coordinates of the bottom left and top right corners of the rectangle
     Long suid = enumerator.nextExtents(extents);
     float bottomLeftX = extents[SpacialIndex2D.X_MIN];
     float bottomLeftY = extents[SpacialIndex2D.Y_MIN];
     float topRightX = extents[SpacialIndex2D.X_MAX];
     float topRightY = extents[SpacialIndex2D.Y_MAX];
     // suid can be used to look up the View from CyNetworkView or CyNetworkViewSnapshot
     View<CyNode> nodeView = networkViewSnapshot.getNodeView(suid);
 }
 
Since:
3.8
See Also:
SpacialIndex2D.queryOverlap(float, float, float, float), SpacialIndex2D.queryAll()

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.

Module: viewmodel-api

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

<dependency>
    <groupId>org.cytoscape</groupId>
    <artifactId>viewmodel-api</artifactId>
</dependency>
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if this enumerator contains more elements.
    default K
    Returns then next element.
    nextExtents​(float[] extents)
    Returns then next element.
    int
    Number of elements to be returned by the enumerator.
  • Method Details

    • size

      int size()
      Number of elements to be returned by the enumerator.
    • hasNext

      boolean hasNext()
      Returns true if this enumerator contains more elements.
    • nextExtents

      K nextExtents(float[] extents)
      Returns then next element.
      Parameters:
      extents - Output parameter that will be loaded with the extents of the 2D object. Must have size at least 4. May be null.
      Returns:
      The key associated with the 2D object.
      See Also:
      SpacialIndex2D.X_MIN, SpacialIndex2D.X_MAX, SpacialIndex2D.Y_MIN, SpacialIndex2D.Y_MAX
    • next

      default K next()
      Returns then next element.
      Returns:
      The key associated with the 2D object.