|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nasa.worldwind.util.BitSetQuadTreeFilter
public abstract class BitSetQuadTreeFilter
This abstract class filters items through a quad tree to perform an operation on those items that intersect the
tree's cells. For each submitted item, this class' doOperation(int, int, double[], double[]) method is called for each leaf or
intermediate cell that intersects the item. That method typically stores the item's association with the intersecting
cell, either to populate a quadtree membership list or to mark it as a visible item.
| Nested Class Summary | |
|---|---|
static class |
BitSetQuadTreeFilter.FindIntersectingBitsOp
A quadtree filter that determines the bit positions of cells associated with items and intersecting a specified region. |
| Field Summary | |
|---|---|
protected BitSet |
bits
|
protected int[] |
levelSizes
|
protected int |
maxLevel
|
protected int |
numLevels
|
protected int[] |
path
|
protected int[] |
powersOf4
|
protected boolean |
stopped
|
| Constructor Summary | |
|---|---|
BitSetQuadTreeFilter(int numLevels,
BitSet bitSet)
Constructs an instance of this class. |
|
| Method Summary | |
|---|---|
protected int |
computeBitPosition(int level,
int position)
Computes the bit position of a quadtree cell. |
protected static int[] |
computeLevelSizes(int numLevels)
An internal method that computes the number of ancestor cells at each level. |
protected abstract boolean |
doOperation(int level,
int position,
double[] cellRegion,
double[] itemCoords)
A method implemented by subclasses and called during tree traversal to perform an operation on an intersecting item. |
int |
getNumLevels()
Returns the number of levels in the filter. |
protected int |
intersects(double[] cellRegion,
double[] itemCoords)
Determines whether an item intersects a cell. |
boolean |
isStopped()
Indicates whether traversal has been stopped. |
void |
start()
Re-initialize for traversal. |
void |
stop()
Stop the current traversal of the quadtree. |
protected void |
testAndDo(int level,
int position,
double[] cellRegion,
double[] itemCoords)
The main, recursive traversal method. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected BitSet bits
protected int[] levelSizes
protected int maxLevel
protected int numLevels
protected int[] path
protected int[] powersOf4
protected boolean stopped
| Constructor Detail |
|---|
public BitSetQuadTreeFilter(int numLevels,
BitSet bitSet)
numLevels - the number of levels in the quadtree.bitSet - a BitSet to use as the quadtree index. If null, a new set is created. Depending on the
operation, the bit-set is modified or only read.
IllegalArgumentException - if numLevels is less than 1.| Method Detail |
|---|
protected int computeBitPosition(int level,
int position)
level - the quadtree level currently being traversed.position - the position of the cell in its parent cell, either 0, 1, 2, or 3. Cell positions starts with 0
at the southwest corner of the parent cell and increment counter-clockwise: cell 1 is SE, cell 2
is NE and cell 3 is NW.
protected static int[] computeLevelSizes(int numLevels)
numLevels - the number of quadtree levels.
numLevels + 1 elements containing the sums of ancestor-level cell counts for
each quadtree level. The last element in the array contains the total number of cells in the tree.
protected abstract boolean doOperation(int level,
int position,
double[] cellRegion,
double[] itemCoords)
BasicQuadTree and BitSetQuadTreeFilter.FindIntersectingBitsOp.
level - the quadtree level currently being traversed.position - the position of the cell in its parent cell, either 0, 1, 2, or 3. Cell positions starts with 0
at the southwest corner of the parent cell and increment counter-clockwise: cell 1 is SE, cell
2 is NE and cell 3 is NW.cellRegion - an array specifying the coordinates of the cell's region. The first two entries are the minimum
and maximum values on the Y axis (typically latitude). The last two entries are the minimum and
maximum values on the X axis, (typically longitude).itemCoords - an array specifying the region or location of the intersecting item. If the array's length is 2
it represents a location in [latitude, longitude]. If its length is 4 it represents a region,
with the same layout as the nodeRegion argument.
public int getNumLevels()
protected int intersects(double[] cellRegion,
double[] itemCoords)
cellRegion - an array specifying the coordinates of the cell's region. The first two entries are the minimum
and maximum values on the Y axis (typically latitude). The last two entries are the minimum and
maximum values on the X axis, (typically longitude).itemCoords - an array specifying the region or location of the item. If the array's length is 2 it
represents a location in [latitude, longitude]. If its length is 4 it represents a region, with
the same layout as the nodeRegion argument.
public boolean isStopped()
true if traversal has been stopped, otherwise false.public void start()
stop().
public void stop()
start() must be called before attempting a subsequent
traversal.
protected void testAndDo(int level,
int position,
double[] cellRegion,
double[] itemCoords)
doOperation(int, int, double[], double[]) method returns false.
level - the quadtree level currently being traversed.position - the position o f the cell in its parent cell, either 0, 1, 2, or 3. Cell positions starts with
0 at the southwest corner of the parent cell and increment counter-clockwise: cell 1 is SE,
cell 2 is NE and cell 3 is NW.cellRegion - an array specifying the coordinates of the cell's region. The first two entries are the minimum
and maximum values on the Y axis (typically latitude). The last two entries are the minimum and
maximum values on the X axis, (typically longitude).itemCoords - an array specifying the region or location of the item. If the array's length is 2 it
represents a location in [latitude, longitude]. If its length is 4 it represents a region, with
the same layout as the nodeRegion argument.
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||