NASA World Wind

gov.nasa.worldwind.util
Class BitSetQuadTreeFilter.FindIntersectingBitsOp

java.lang.Object
  extended by gov.nasa.worldwind.util.BitSetQuadTreeFilter
      extended by gov.nasa.worldwind.util.BitSetQuadTreeFilter.FindIntersectingBitsOp
Enclosing class:
BitSetQuadTreeFilter

public static class BitSetQuadTreeFilter.FindIntersectingBitsOp
extends BitSetQuadTreeFilter

A quadtree filter that determines the bit positions of cells associated with items and intersecting a specified region. Typically used to traverse the bit-set index of a populated quadtree to determine potentially visible items.

This class requires a previously populated filter and determines which of its cells intersect a specified sector.


Nested Class Summary
 
Nested classes/interfaces inherited from class gov.nasa.worldwind.util.BitSetQuadTreeFilter
BitSetQuadTreeFilter.FindIntersectingBitsOp
 
Field Summary
protected  List<Integer> intersectingBits
           
 
Fields inherited from class gov.nasa.worldwind.util.BitSetQuadTreeFilter
bits, levelSizes, maxLevel, numLevels, path, powersOf4, stopped
 
Constructor Summary
BitSetQuadTreeFilter.FindIntersectingBitsOp(BitSetQuadTreeFilter filter)
          Constructs a filter instance.
 
Method Summary
protected  boolean doOperation(int level, int position, double[] cellRegion, double[] testSector)
          Assembles the output bit-list during traversal.
 List<Integer> getOnBits(List<double[]> topRegions, double[] testRegion, List<Integer> outIds)
          Returns the bit positions of significant cells that intersect a specified sector.
 List<Integer> getOnBits(List<double[]> topRegions, Sector testSector, List<Integer> outIds)
          Returns the bit positions of significant cells that intersect a specified sector.
 
Methods inherited from class gov.nasa.worldwind.util.BitSetQuadTreeFilter
computeBitPosition, computeLevelSizes, getNumLevels, intersects, isStopped, start, stop, testAndDo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

intersectingBits

protected List<Integer> intersectingBits
Constructor Detail

BitSetQuadTreeFilter.FindIntersectingBitsOp

public BitSetQuadTreeFilter.FindIntersectingBitsOp(BitSetQuadTreeFilter filter)
Constructs a filter instance.

Parameters:
filter - a filter identifying significant cells in a quadtree, typically produced by applying a filter that identifies quadtree cells associated with items.
Throws:
NullPointerException - if filter is null.
IllegalArgumentException - if filter is invalid.
Method Detail

doOperation

protected boolean doOperation(int level,
                              int position,
                              double[] cellRegion,
                              double[] testSector)
Assembles the output bit-list during traversal. Implements the abstract method BitSetQuadTreeFilter.doOperation(int, int, double[], double[]). See the description of that method for further detail.

Specified by:
doOperation in class BitSetQuadTreeFilter
Parameters:
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).
testSector - an array specifying the region or location of the intersecting item. If the array's length is 2 then it represents a location in [latitude, longitude]. If its length is 4 it represents a region, with the same layout as the nodeRegion argument.
Returns:
true if traversal should continue to the cell's descendants, false if traversal should not continue to the cell's descendants.

getOnBits

public List<Integer> getOnBits(List<double[]> topRegions,
                               double[] testRegion,
                               List<Integer> outIds)
Returns the bit positions of significant cells that intersect a specified sector. Significant cells are those identified by the filter specified to the constructor.

Parameters:
topRegions - the zeroth-level regions of a quadtree.
testRegion - the sector of interest, specified as a four-element array containing minimum latitude, maximum latitude, minimum longitude and maximum longitude, in that order. Significant cells that intersect this sector are returned.
outIds - a list in which to place the bit positions of intersecting significant cells. May be null, in which case a new list is created. In either case the list is the return value of the method.
Returns:
the bit positions of intersecting significant cells. This is the list specified as the non-null outIds argument, or a new list if that argument is null.
Throws:
IllegalArgumentException - if either topRegions or testSector is null.

getOnBits

public List<Integer> getOnBits(List<double[]> topRegions,
                               Sector testSector,
                               List<Integer> outIds)
Returns the bit positions of significant cells that intersect a specified sector. Significant cells are those identified by the filter specified to the constructor.

Parameters:
topRegions - the zeroth-level regions of a quadtree.
testSector - the sector of interest. Significant cells that intersect this sector are returned.
outIds - a list in which to place the bit positions of intersecting significant cells. May be null, in which case a new list is created. In either case the list is the return value of the method.
Returns:
the bit positions of intersecting significant cells. This is the list specified as the non-null outIds argument, or a new list if that argument is null.
Throws:
IllegalArgumentException - if either topRegions or testSector is null.

NASA World Wind