Interface SpacialIndex2D<K>

Type Parameters:
K - The key type.
All Known Subinterfaces:
NetworkSpacialIndex2D

public interface SpacialIndex2D<K>
Stores the location and rectangular boundary of objects (typically View<CyNode> objects) in 2D space. Coordinates are stored as floats.

Note: Since 3.9 you will typically be using NetworkSpacialIndex2D instead.

Since:
3.8

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>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static int
    Constants for indexing into extents arrays.
    static int
    Constants for indexing into extents arrays.
    static int
    Constants for indexing into extents arrays.
    static int
    Constants for indexing into extents arrays.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    exists​(K key)
    Returns true if an object with the given key is stored in this SpacialIndex2D.
    boolean
    get​(K key, double[] extents)
    Retrieves the extents of the rectangle with the given key.
    boolean
    get​(K key, float[] extents)
    Retrieves the extents of the rectangle with the given key.
    void
    getMBR​(double[] extents)
    Returns the "Minimum Bounding Rectangle", the smallest rectangle that contains all the objects stored in this SpacialIndex2D.
    void
    getMBR​(float[] extents)
    Returns the "Minimum Bounding Rectangle", the smallest rectangle that contains all the objects stored in this SpacialIndex2D.
    Returns an enumerator of all the objects stored in this SpacialIndex2D.
    queryOverlap​(float xMin, float yMin, float xMax, float yMax)
    Returns an enumerator of all the rectangular objects that are contained within or intersecting the given rectangle.
    int
    Returns the number of objects stored in this SpacialIndex2D.
  • Field Details

    • X_MIN

      static final int X_MIN
      Constants for indexing into extents arrays.
      See Also:
      Constant Field Values
    • Y_MIN

      static final int Y_MIN
      Constants for indexing into extents arrays.
      See Also:
      Constant Field Values
    • X_MAX

      static final int X_MAX
      Constants for indexing into extents arrays.
      See Also:
      Constant Field Values
    • Y_MAX

      static final int Y_MAX
      Constants for indexing into extents arrays.
      See Also:
      Constant Field Values
  • Method Details

    • getMBR

      void getMBR(float[] extents)
      Returns the "Minimum Bounding Rectangle", the smallest rectangle that contains all the objects stored in this SpacialIndex2D.
      Parameters:
      extents - The first 4 elements of this array will be overwritten to contain the extents of the minimum bounding rectangle.
      Throws:
      ArrayIndexOutOfBoundsException - if extents.length is less than 4
      NullPointerException - if extents is null
    • getMBR

      void getMBR(double[] extents)
      Returns the "Minimum Bounding Rectangle", the smallest rectangle that contains all the objects stored in this SpacialIndex2D. This data structure stores floats, this is just a convenience method that takes a double[] instead of a float[].
      Parameters:
      extents - The first 4 elements of this array will be overwritten to contain the extents of the minimum bounding rectangle.
      Throws:
      ArrayIndexOutOfBoundsException - if extents.length is less than 4
      NullPointerException - if extents is null
    • exists

      boolean exists(K key)
      Returns true if an object with the given key is stored in this SpacialIndex2D.
    • get

      boolean get(K key, float[] extents)
      Retrieves the extents of the rectangle with the given key.
      Parameters:
      extents - The first 4 elements of this array will be overwritten to contain the extents of the minimum bounding rectangle.
      Throws:
      ArrayIndexOutOfBoundsException - if extents.length is less than 4
      NullPointerException - if extents is null
    • get

      boolean get(K key, double[] extents)
      Retrieves the extents of the rectangle with the given key. This data structure stores floats, this is just a convenience method that takes a double[] instead of a float[].
      Parameters:
      extents - The first 4 elements of this array will be overwritten to contain the extents of the minimum bounding rectangle.
      Throws:
      ArrayIndexOutOfBoundsException - if extents.length is less than 4
      NullPointerException - if extents is null
    • size

      int size()
      Returns the number of objects stored in this SpacialIndex2D.
    • queryOverlap

      SpacialIndex2DEnumerator<K> queryOverlap(float xMin, float yMin, float xMax, float yMax)
      Returns an enumerator of all the rectangular objects that are contained within or intersecting the given rectangle.
    • queryAll

      Returns an enumerator of all the objects stored in this SpacialIndex2D.