Cytoscape 2.8.0 API

cytoscape.geom.spacial
Interface SpacialIndex2D

All Known Subinterfaces:
MutableSpacialIndex2D
All Known Implementing Classes:
RTree

public interface SpacialIndex2D

A spacial index for objects in two dimensions.


Method Summary
 boolean exists(int objKey, float[] extentsArr, int offset)
          Determines whether or not a given entry exists and conditionally retrieves the extents of that entry.
 SpacialEntry2DEnumerator queryOverlap(float xMin, float yMin, float xMax, float yMax, float[] extentsArr, int offset, boolean reverse)
          Returns an enumeration of entries whose extents intersect the specified axis-aligned rectangular area.
 int size()
          Returns the number of entries (objKeys) currently in this structure.
 

Method Detail

size

int size()
Returns the number of entries (objKeys) currently in this structure.

NOTE: To retrieve an enumeration of all entries in this structure, call queryOverlap() with Float.NEGATIVE_INFINITY minimum values and Float.POSITIVE_INFINITY maximum values.


exists

boolean exists(int objKey,
               float[] extentsArr,
               int offset)
Determines whether or not a given entry exists and conditionally retrieves the extents of that entry. The parameter extentsArr is written into by this method only if it is not null and if objKey exists. The information written into extentsArr consists of the minimum bounding rectangle (MBR) of objKey:
array index value if objKey exists
offset xMin of MBR
offset+1 yMin of MBR
offset+2 xMax of MBR
offset+3 yMax of MBR

Parameters:
objKey - the entry to query.
extentsArr - an array to which extent values will be written by this method; may be null.
offset - specifies the beginning index of where to write extent values into extentsArr; exactly four entries are written starting at this index (see above table); if extentsArr is null then this offset is ignored.
Returns:
true if and only if objKey exists as an entry in this structure.
Throws:
ArrayIndexOutOfBoundsException - if objKey exists, if extentsArr is not null, and if extentsArr cannot be written to in the index range [offset, offset+3].

queryOverlap

SpacialEntry2DEnumerator queryOverlap(float xMin,
                                      float yMin,
                                      float xMax,
                                      float yMax,
                                      float[] extentsArr,
                                      int offset,
                                      boolean reverse)
Returns an enumeration of entries whose extents intersect the specified axis-aligned rectangular area. By "axis-aligned" I mean that the query rectangle's sides are parallel to the axes of the data space.

The parameter extentsArr is written into by this method if it is not null. It provides a way for this method to communicate additional information to the caller of this method. If not null, extentsArr is populated with information regarding the minimum bounding rectangle (MBR) that contains all returned entries. The following table describes what is written to extentsArr if it is not null:

array index value if query generates results value if query does not generate results
offset xMin of MBR Float.POSITIVE_INFINITY
offset+1 yMin of MBR Float.POSITIVE_INFINITY
offset+2 xMax of MBR Float.NEGATIVE_INFINITY
offset+3 yMax of MBR Float.NEGATIVE_INFINITY

Note that the order of query results, as returned in the enumeration, may be completely random as a function of the query rectangle. However, any two subsequent, identical queries should produce an identical result order, provided that this structure does not undergo modification between those two queries (by modification I mean the possibility of entry shift, deletion of an entry, or insertion of an entry).

Parameters:
xMin - the minimum X coordinate of the query rectangle.
yMin - the minimum Y coordinate of the query rectangle.
xMax - the maximum X coordinate of the query rectangle.
yMax - the maximum Y coordinate of the query rectangle.
extentsArr - an array to which extent values will be written by this method; may be null.
offset - specifies the beginning index of where to write extent values into extentsArr; exactly four entries are written starting at this index (see table above); if extentsArr is null then this offset is ignored.
reverse - if true, the order in which the query hits are returned is reversed.
Returns:
a non-null enumeration of all [distinct] entries (objKeys) whose extents intersect the specified rectangular query area.
Throws:
IllegalArgumentException - if xMin is not less than or equal to xMax or if yMin is not less than or equal to yMax.
ArrayIndexOutOfBoundsException - if extentsArr is not null and if it cannot be written to in the index range [offset, offset+3].

Cytoscape 2.8.0 API

Copyright 2010 Cytoscape Consortium. All rights reserved.