Package org.cytoscape.view.model.spacial
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
Modifier and TypeFieldDescriptionstatic final int
Constants for indexing into extents arrays.static final int
Constants for indexing into extents arrays.static final int
Constants for indexing into extents arrays.static final int
Constants for indexing into extents arrays. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if an object with the given key is stored in this SpacialIndex2D.boolean
Retrieves the extents of the rectangle with the given key.boolean
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.queryAll()
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
size()
Returns the number of objects stored in this SpacialIndex2D.
-
Field Details
-
X_MIN
static final int X_MINConstants for indexing into extents arrays.- See Also:
-
Y_MIN
static final int Y_MINConstants for indexing into extents arrays.- See Also:
-
X_MAX
static final int X_MAXConstants for indexing into extents arrays.- See Also:
-
Y_MAX
static final int Y_MAXConstants for indexing into extents arrays.- See Also:
-
-
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 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
Returns true if an object with the given key is stored in this SpacialIndex2D. -
get
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
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
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.
-