S2ShapeIndex.IteratorBase

Each subtype of S2ShapeIndex should define an Iterator type derived from the following base class.

Constructors

this
this(IteratorBase other)
Undocumented in source.
this
this()
Undocumented in source.

Members

Functions

begin
void begin()

Positions the iterator at the first index cell (if any).

cell
inout(S2ShapeIndexCell) cell()

Returns a reference to the contents of the current index cell.

center
S2Point center()

Returns the center point of the cell.

clone
IteratorBase clone()

Returns an exact copy of this iterator.

copy
void copy(IteratorBase other)

Makes a copy of the given source iterator. REQUIRES: "other" has the same concrete type as "this".

done
bool done()

Returns true if the iterator is positioned past the last index cell.

finish
void finish()

Positions the iterator past the last index cell.

getCell
const(S2ShapeIndexCell) getCell()

This method is called to decode the contents of the current cell, if set_state() was previously called with a nullptr "cell" argument. This allows decoding on demand for subtypes that keep the cell contents in an encoded state. It does not need to be implemented at all if set_state() is always called with (cell != nullptr).

locate
bool locate(S2Point target)

Positions the iterator at the cell containing "target". If no such cell exists, returns false and leaves the iterator positioned arbitrarily. The returned index cell is guaranteed to contain all edges that might intersect the line segment between "target" and the cell center.

locate
CellRelation locate(S2CellId target)

Let T be the target S2CellId. If T is contained by some index cell I (including equality), this method positions the iterator at I and returns INDEXED. Otherwise if T contains one or more (smaller) index cells, it positions the iterator at the first such cell I and returns SUBDIVIDED. Otherwise it returns DISJOINT and leaves the iterator positioned arbitrarily.

next
void next()

Positions the iterator at the next index cell.

prev
bool prev()

If the iterator is already positioned at the beginning, returns false. Otherwise positions the iterator at the previous entry and returns true.

rawCell
inout(S2ShapeIndexCell) rawCell()

Returns the current contents of the "cell_" field, which may be null if the cell contents have not been decoded yet.

seek
void seek(S2CellId target)

Positions the iterator at the first cell with id() >= target, or at the end of the index if no such cell exists.

setFinished
void setFinished()

Sets the iterator state so that done() is true.

setState
void setState(S2CellId id, S2ShapeIndexCell cell)

Sets the iterator state. "cell" typically points to the cell contents, but may also be given as "nullptr" in order to implement decoding on demand. In that situation, the first that the client attempts to access the cell contents, the GetCell() method is called and "cell_" is updated in a thread-safe way.

Properties

id
S2CellId id [@property getter]

Returns the S2CellId of the current index cell. If done() is true, returns a value larger than any valid S2CellId (S2CellId::Sentinel()).

Static functions

locateImpl
bool locateImpl(S2Point target_point, IterT it)

The default implementation of Locate(S2Point). It is instantiated by each subtype in order to (1) minimize the number of virtual method calls (since subtypes are typically "final") and (2) ensure that the correct versions of non-virtual methods such as cell() are called.

locateImpl
CellRelation locateImpl(S2CellId target, IterT it)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta