Class GraphOptions

This class is only needed by S2Builder::Layer implementations. A layer is responsible for assembling an S2Builder::Graph of snapped edges into the desired output format (e.g., an S2Polygon). The GraphOptions class allows each Layer type to specify requirements on its input graph: for example, if

class GraphOptions ;

Constructors

NameDescription
this (edge_type, degenerate_edges, duplicate_edges, sibling_pairs) All S2Builder::Layer subtypes should specify GraphOptions explicitly using this constructor, rather than relying on default values.
this () The default options specify that all edges should be kept, since this produces the least surprising output and makes it easier to diagnose the problem when an option is left unspecified.

Methods

NameDescription
allowVertexFiltering () This is a specialized option that is only needed by clients want to work with the graphs for multiple layers at the same time (e.g., in order to check whether the same edge is present in two different graphs). [Note that if you need to do this, usually it is easier just to build a single graph with suitable edge labels.]
edgeType () Specifies whether the S2Builder input edges should be treated as undirected. If true, then all input edges are duplicated into pairs consisting of an edge and a sibling (reverse) edge. The layer implementation is responsible for ensuring that exactly one edge from each pair is used in the output, i.e. *only half* of the graph edges will be used. (Note that some values of the sibling_pairs() option automatically take care of this issue by removing half of the edges and changing edge_type() to DIRECTED.)

Enums

NameDescription
DegenerateEdges Controls how degenerate edges (i.e., an edge from a vertex to itself) are handled. Such edges may be present in the input, or they may be created when both endpoints of an edge are snapped to the same output vertex. The options available are:
DuplicateEdges Controls how duplicate edges (i.e., edges that are present multiple times) are handled. Such edges may be present in the input, or they can be created when vertices are snapped together. When several edges are merged, the result is a single edge labelled with all of the original input edge ids.
SiblingPairs Controls how sibling edge pairs (i.e., pairs consisting of an edge and its reverse edge) are handled. Layer types that define an interior (e.g., polygons) normally discard such edge pairs since they do not affect the result (i.e., they define a "loop" with no interior). The various options include:

DegenerateEdges

:DISCARD is specified, then S2Builder will ensure that all degenerate edges are removed before passing the graph to the S2Layer::Build method.