Package gov.nasa.worldwind.util
Class BitSetQuadTreeFilter.FindIntersectingBitsOp
- java.lang.Object
-
- gov.nasa.worldwind.util.BitSetQuadTreeFilter
-
- 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
Fields Modifier and Type Field Description protected java.util.List<java.lang.Integer>
intersectingBits
-
Fields inherited from class gov.nasa.worldwind.util.BitSetQuadTreeFilter
bits, levelSizes, maxLevel, numLevels, path, powersOf4, stopped
-
-
Constructor Summary
Constructors Constructor Description FindIntersectingBitsOp(BitSetQuadTreeFilter filter)
Constructs a filter instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
doOperation(int level, int position, double[] cellRegion, double[] testSector)
Assembles the output bit-list during traversal.java.util.List<java.lang.Integer>
getOnBits(java.util.List<double[]> topRegions, double[] testRegion, java.util.List<java.lang.Integer> outIds)
Returns the bit positions of significant cells that intersect a specified sector.java.util.List<java.lang.Integer>
getOnBits(java.util.List<double[]> topRegions, Sector testSector, java.util.List<java.lang.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
-
-
-
-
Constructor Detail
-
FindIntersectingBitsOp
public 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:
java.lang.NullPointerException
- iffilter
is null.java.lang.IllegalArgumentException
- iffilter
is invalid.
-
-
Method Detail
-
getOnBits
public java.util.List<java.lang.Integer> getOnBits(java.util.List<double[]> topRegions, Sector testSector, java.util.List<java.lang.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:
java.lang.IllegalArgumentException
- if eithertopRegions
ortestSector
is null.
-
getOnBits
public java.util.List<java.lang.Integer> getOnBits(java.util.List<double[]> topRegions, double[] testRegion, java.util.List<java.lang.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:
java.lang.IllegalArgumentException
- if eithertopRegions
ortestSector
is null.
-
doOperation
protected boolean doOperation(int level, int position, double[] cellRegion, double[] testSector)
Assembles the output bit-list during traversal. Implements the abstract methodBitSetQuadTreeFilter.doOperation(int, int, double[], double[])
. See the description of that method for further detail.- Specified by:
doOperation
in classBitSetQuadTreeFilter
- 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 thenodeRegion
argument.- Returns:
- true if traversal should continue to the cell's descendants, false if traversal should not continue to the cell's descendants.
-
-