public void testCellOps(S2LatLngRect r, S2Cell cell, int level)
        {
            // Test the relationship between the given rectangle and cell:
            // 0 == no intersection, 1 == MayIntersect, 2 == Intersects,
            // 3 == Vertex Containment, 4 == Contains

            var vertexContained = false;
            for (var i = 0; i < 4; ++i)
            {
                if (r.Contains(cell.GetVertexRaw(i))
                    || (!r.IsEmpty && cell.Contains(r.GetVertex(i).ToPoint())))
                {
                    vertexContained = true;
                }
            }
            assertEquals(r.MayIntersect(cell), level >= 1);
            assertEquals(r.Intersects(cell), level >= 2);
            assertEquals(vertexContained, level >= 3);
            assertEquals(r.Contains(cell), level >= 4);
        }
示例#2
0
    private static void TestCellOps(S2LatLngRect r, S2Cell cell, int level)
    {
        // Test the relationship between the given rectangle and cell:
        // 0 == no intersection, 1 == MayIntersect, 2 == Intersects,
        // 3 == Vertex Containment, 4 == Contains

        bool vertex_contained = false;

        for (int i = 0; i < 4; ++i)
        {
            if (r.Contains(cell.VertexRaw(i)) ||
                (!r.IsEmpty() && cell.Contains(r.Vertex(i).ToPoint())))
            {
                vertex_contained = true;
            }
        }
        Assert.Equal(r.MayIntersect(cell), level >= 1);
        Assert.Equal(r.Intersects(cell), level >= 2);
        Assert.Equal(vertex_contained, level >= 3);
        Assert.Equal(r.Contains(cell), level >= 4);
    }
        public void testCellOps(S2LatLngRect r, S2Cell cell, int level)
        {
            // Test the relationship between the given rectangle and cell:
            // 0 == no intersection, 1 == MayIntersect, 2 == Intersects,
            // 3 == Vertex Containment, 4 == Contains

            var vertexContained = false;

            for (var i = 0; i < 4; ++i)
            {
                if (r.Contains(cell.GetVertexRaw(i)) ||
                    (!r.IsEmpty && cell.Contains(r.GetVertex(i).ToPoint())))
                {
                    vertexContained = true;
                }
            }
            assertEquals(r.MayIntersect(cell), level >= 1);
            assertEquals(r.Intersects(cell), level >= 2);
            assertEquals(vertexContained, level >= 3);
            assertEquals(r.Contains(cell), level >= 4);
        }