コード例 #1
0
        public void Test_S2CellUnion_DefaultConstructor()
        {
            var ids   = new List <S2CellId>();
            var empty = new S2CellUnion(ids);

            Assert.True(empty.IsEmpty());
        }
コード例 #2
0
        public void Test_S2CellUnion_FromBeginEnd()
        {
            // Since FromMinMax() is implemented in terms of FromBeginEnd(), we
            // focus on test cases that generate an empty range.
            S2CellId initial_id = S2CellId.FromFace(3);

            // Test an empty range before the minimum S2CellId.
            S2CellUnion cell_union = new(new List <S2CellId> {
                initial_id
            });
            S2CellId id_begin      = S2CellId.Begin(S2.kMaxCellLevel);

            cell_union.InitFromBeginEnd(id_begin, id_begin);
            Assert.True(cell_union.IsEmpty());

            // Test an empty range after the maximum S2CellId.
            cell_union = new S2CellUnion(new List <S2CellId> {
                initial_id
            });
            S2CellId id_end = S2CellId.End(S2.kMaxCellLevel);

            cell_union.InitFromBeginEnd(id_end, id_end);
            Assert.True(cell_union.IsEmpty());

            // Test the full sphere.
            cell_union = S2CellUnion.FromBeginEnd(id_begin, id_end);
            Assert.Equal(6, cell_union.Size());
            foreach (S2CellId id in cell_union)
            {
                Assert.True(id.IsFace());
            }
        }
コード例 #3
0
    public void Test_S2ShapeIndexBufferedRegion_EmptyIndex()
    {
        // Test buffering an empty S2ShapeIndex.
        var         index    = new MutableS2ShapeIndex();
        var         radius   = new S1ChordAngle(S1Angle.FromDegrees(2));
        var         region   = new S2ShapeIndexBufferedRegion(index, radius);
        var         coverer  = new S2RegionCoverer();
        S2CellUnion covering = coverer.GetCovering(region);

        Assert.True(covering.IsEmpty());
    }