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) int
Counter of number of candidates created, for performance evaluation.(package private) final boolean
True if we're covering the interior.(package private) final S2Region
The region being covered.Cell ids that have been added to the covering so far. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addCandidate
(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 int
expandChildren
(S2RegionCoverer.Candidate candidate, S2Cell cell, int numLevels) Populate the children of "candidate" by expanding the given number of levels from the given cell.private void
Generates a covering and stores it in result.private void
Computes a set of initial candidates that cover the given region.private int
Return the log base 2 of the maximum number of children of a candidate.private S2RegionCoverer.Candidate
newCandidate
(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.
-