Package org.cytoscape.view.model.spacial
Interface SpacialIndex2D<K>
-
- Type Parameters:
K- The key type.
public interface SpacialIndex2D<K>Stores the location and rectangular boundary of objects (typicallyView<CyNode>objects) in 2D space. Coordinates are stored as floats.- Since:
- 3.8
Module:
viewmodel-apiTo use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>viewmodel-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 Summary
Fields Modifier and Type Field Description static intX_MAXConstants for indexing into extents arrays.static intX_MINConstants for indexing into extents arrays.static intY_MAXConstants for indexing into extents arrays.static intY_MINConstants for indexing into extents arrays.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanexists(K key)Returns true if an object with the given key is stored in this SpacialIndex2D.booleanget(K key, double[] extents)Retrieves the extents of the rectangle with the given key.booleanget(K key, float[] extents)Retrieves the extents of the rectangle with the given key.voidgetMBR(double[] extents)Returns the "Minimum Bounding Rectangle", the smallest rectangle that contains all the objects stored in this SpacialIndex2D.voidgetMBR(float[] extents)Returns the "Minimum Bounding Rectangle", the smallest rectangle that contains all the objects stored in this SpacialIndex2D.SpacialIndex2DEnumerator<K>queryAll()Returns an enumerator of all the objects stored in this SpacialIndex2D.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.intsize()Returns the number of objects stored in this SpacialIndex2D.
-
-
-
Field Detail
-
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 Detail
-
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 4NullPointerException- 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 4NullPointerException- 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 4NullPointerException- 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 4NullPointerException- 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
SpacialIndex2DEnumerator<K> queryAll()
Returns an enumerator of all the objects stored in this SpacialIndex2D.
-
-