Class S2RegionCoverer.ActiveCovering

java.lang.Object
com.google.common.geometry.S2RegionCoverer.ActiveCovering
Enclosing class:
S2RegionCoverer

final class S2RegionCoverer.ActiveCovering extends Object
This class tracks the state of a covering while it is underway.
  • Field Details

    • interiorCovering

      final boolean interiorCovering
      True if we're covering the interior.
    • region

      final S2Region region
      The region being covered.
    • candidatesCreatedCounter

      int candidatesCreatedCounter
      Counter of number of candidates created, for performance evaluation.
    • result

      final ArrayList<S2CellId> 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

      private S2RegionCoverer.Candidate newCandidate(S2Cell cell)
      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

      private 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. Passing a null argument does nothing.
    • expandChildren

      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. 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.