private static void AddPolylineWithLabels(S2Polyline polyline, EdgeType edge_type, Int32 label_begin, S2Builder builder, EdgeLabelMap edge_label_map) { for (int i = 0; i + 1 < polyline.NumVertices(); ++i) { Int32 label = label_begin + i; builder.SetLabel(label); // With undirected edges, reverse the direction of every other input edge. int dir = edge_type == EdgeType.DIRECTED ? 1 : (i & 1); builder.AddEdge(polyline.Vertex(i + (1 - dir)), polyline.Vertex(i + dir)); S2Point key = polyline.Vertex(i) + polyline.Vertex(i + 1); edge_label_map[key].Add(label); } }
// Add a polyline to the input geometry. public void AddPolyline(S2Polyline polyline) { bound_ = bound_.Union(polyline.GetRectBound()); for (int i = 0; i < polyline.NumVertices(); ++i) { points_.Add(polyline.Vertex(i)); } }