// Use "query" to find the closest edge(s) to the given target. Verify that // the results satisfy the search criteria. private static void GetClosestEdges(Target target, S2ClosestEdgeQuery query, List <Result> edges) { query.FindClosestEdges(target, edges); Assert.True(edges.Count <= query.Options_.MaxResults); if (query.Options_.MaxDistance == Distance.Infinity) { int min_expected = Math.Min(query.Options_.MaxResults, query.Index().GetCountEdges()); if (!query.Options_.IncludeInteriors) { // We can predict exactly how many edges should be returned. Assert.Equal(min_expected, edges.Count); } else { // All edges should be returned, and possibly some shape interiors. Assert.True(min_expected <= edges.Count); } } foreach (var edge in edges) { // Check that the edge satisfies the max_distance() condition. Assert.True(edge.Distance < query.Options_.MaxDistance); } }
public S2ShapeIndex Index() => query_.Index();