Package com.google.common.geometry
Class S2RegionCoverer.ActiveCovering
java.lang.Object
com.google.common.geometry.S2RegionCoverer.ActiveCovering
- Enclosing class:
S2RegionCoverer
This class tracks the state of a covering while it is underway.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final PriorityQueue<S2RegionCoverer.QueueEntry> Prioritized candidates to explore next.(package private) intCounter of number of candidates created, for performance evaluation.(package private) final booleanTrue if we're covering the interior.(package private) final S2RegionThe region being covered.Cell ids that have been added to the covering so far. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddCandidate(S2RegionCoverer.Candidate candidate) Process a candidate by either adding it to the result list or expanding its children and inserting it into the priority queue.private intexpandChildren(S2RegionCoverer.Candidate candidate, S2Cell cell, int numLevels) Populate the children of "candidate" by expanding the given number of levels from the given cell.private voidGenerates a covering and stores it in result.private voidComputes a set of initial candidates that cover the given region.private intReturn the log base 2 of the maximum number of children of a candidate.private S2RegionCoverer.CandidatenewCandidate(S2Cell cell) If the cell intersects the given region, return a new candidate with no children, otherwise return null.
-
Field Details
-
interiorCovering
final boolean interiorCoveringTrue if we're covering the interior. -
region
The region being covered. -
candidatesCreatedCounter
int candidatesCreatedCounterCounter of number of candidates created, for performance evaluation. -
result
Cell ids that have been added to the covering so far. -
candidateQueue
Prioritized candidates to explore next.
-
-
Constructor Details
-
ActiveCovering
ActiveCovering(boolean interior, S2Region region)
-
-
Method Details
-
newCandidate
If the cell intersects the given region, return a new candidate with no children, otherwise return null. Also marks the candidate as "terminal" if it should not be expanded further. -
maxChildrenShift
private int maxChildrenShift()Return the log base 2 of the maximum number of children of a candidate. -
addCandidate
Process a candidate by either adding it to the result list or expanding its children and inserting it into the priority queue. Passing a null argument does nothing. -
expandChildren
Populate the children of "candidate" by expanding the given number of levels from the given cell. Returns the number of children that were marked "terminal". -
getInitialCandidates
private void getInitialCandidates()Computes a set of initial candidates that cover the given region. -
getCoveringInternal
private void getCoveringInternal()Generates a covering and stores it in result.
-