Function S2Builder.startLayer
Starts a new output layer. This method must be called before adding any edges to the S2Builder. You may call this method multiple times to build multiple geometric objects that are snapped to the same set of sites.
void startLayer
(
s2 .builder .layer .Layer layer
);
For example, if you have a set of contour lines, then you could put each contour line in a separate layer. This keeps the contour lines separate from each other, while also ensuring that no crossing edges are created when they are snapped and/or simplified. \(This is not true if the contour lines are snapped or simplified independently.\)
Similarly, if you have a set of polygons that share common boundaries \(e.g., countries\), you can snap and/or simplify them at the same time by putting them in different layers, while ensuring that their boundaries remain consistent \(i.e., no crossing edges or T-vertices are introduced\).
Ownership of the layer is transferred to the S2Builder. Example usage:
auto line1 = new S2Polyline();
auto line2 = new S2Polyline();
builder .startLayer(new S2PolylineLayer(line1));
// Add edges using builder.addEdge(), etc ...
builder .startLayer(new S2PolylineLayer(line2));
// Add edges using builder.addEdge(), etc ...
S2Error error;
enforce(builder .build(error), error .toString()); // Builds "line1" & "line2"