S2PolygonLayer

A layer type that assembles edges (directed or undirected) into an S2Polygon. Returns an error if the edges cannot be assembled into loops.

If the input edges are directed, they must be oriented such that the polygon interior is to the left of all edges. Directed edges are always preferred (see S2Builder::EdgeType).

Before the edges are assembled into loops, "sibling pairs" consisting of an edge and its reverse edge are automatically removed. Such edge pairs represent zero-area degenerate regions, which S2Polygon does not allow. (If you need to build polygons with degeneracies, use LaxPolygonLayer instead.)

S2PolygonLayer is implemented such that if the input to S2Builder is a polygon and is not modified, then the output has the same cyclic ordering of loop vertices and the same loop ordering as the input polygon.

CAVEAT: Because polygons are constructed from their boundaries, this method cannot distinguish between the empty and full polygons. An empty boundary always yields an empty polygon. If the result should sometimes be the full polygon, such logic must be implemented outside of this class (and will need to consider factors other than the polygon's boundary).

Constructors

this
this(S2Polygon polygon, Options options)

Specifies that a polygon should be constructed using the given options.

this
this(S2Polygon polygon, LabelSetIds label_set_ids, IdSetLexicon label_set_lexicon, Options options)

Specifies that a polygon should be constructed using the given options, and that any labels attached to the input edges should be returned in "label_set_ids" and "label_set_lexicion".

Members

Aliases

LabelSetIds
alias LabelSetIds = LabelSetId[][]
Undocumented in source.

Functions

build
void build(Graph g, S2Error error)
Undocumented in source. Be warned that the author may not have intended to support it.
graphOptions
GraphOptions graphOptions()
Undocumented in source. Be warned that the author may not have intended to support it.

Structs

Options
struct Options
Undocumented in source.

Inherited Members

From Layer

EdgeType
alias EdgeType = S2Builder.EdgeType
Undocumented in source.
GraphOptions
alias GraphOptions = .GraphOptions
Undocumented in source.
Graph
alias Graph = .Graph
Undocumented in source.
Label
alias Label = S2Builder.Label
Undocumented in source.
LabelSetId
alias LabelSetId = S2Builder.LabelSetId
Undocumented in source.
graphOptions
GraphOptions graphOptions()

Defines options for building the edge graph that is passed to Build().

build
void build(Graph g, S2Error error)

Assembles a graph of snapped edges into the geometry type implemented by this layer. If an error is encountered, sets "error" appropriately.

Meta