Exemplo n.º 1
0
        public void GetQueryBlocks_SingleCell()
        {
            var q1        = ZCurve.Encode(6, 4);           // 52
            var blocks1   = ZCurve.GetQueryBlocks(q1, q1); // single cell, all levels
            var expected1 = Blocks(52, 0);

            Assert.Equal(expected1, blocks1);

            var q2        = ZCurve.Encode(11, 11);         // 207
            var blocks2   = ZCurve.GetQueryBlocks(q2, q2); // single cell, all levels
            var expected2 = Blocks(207, 0);

            Assert.Equal(expected2, blocks2);

            var q3        = ZCurve.Encode(5, 1);                        // 19
            var blocks3   = ZCurve.GetQueryBlocks(q3, q3, new[] { 2 }); // single cell, specific levels
            var expected3 = Blocks(16, 2);

            Assert.Equal(expected3, blocks3);

            var q4        = ZCurve.Encode(uint.MaxValue, uint.MaxValue);      // ulong.MaxValue
            var blocks4   = ZCurve.GetQueryBlocks(q4, q4, new[] { 3 });
            var expected4 = Blocks(ulong.MaxValue - 63, 3);

            Assert.Equal(expected4, blocks4);
        }
Exemplo n.º 2
0
        public void GetQueryBlocks_General()
        {
            var blocks1   = ZCurve.GetQueryBlocks(1, 1, 5, 4);           //3..49
            var expected1 = Blocks(3, 0, 6, 0, 7, 0, 9, 0, 11, 0, 12, 1, 18, 0, 19, 0, 24, 1, 33, 0, 36, 0, 37, 0, 48, 0, 49, 0);

            Assert.Equal(expected1, blocks1);

            var blocks2   = ZCurve.GetQueryBlocks(4, 3, 8, 7);           //26..106
            var expected2 = Blocks(26, 0, 27, 0, 30, 0, 31, 0, 48, 2, 74, 0, 96, 0, 98, 0, 104, 0, 106, 0);

            Assert.Equal(expected2, blocks2);

            var blocks3   = ZCurve.GetQueryBlocks(0, 0, 15, 15);
            var expected3 = Blocks(0, 4);

            Assert.Equal(expected3, blocks3);

            var blocks4   = ZCurve.GetQueryBlocks(0, 0, 15, 15, new[] { 1, 3 });
            var expected4 = Blocks(0, 3, 64, 3, 128, 3, 192, 3);

            Assert.Equal(expected4, blocks4);

            var blocks5   = ZCurve.GetQueryBlocks(7, 3, 13, 7, new[] { 1, 2, 3 });        // 31..123
            var expected5 = Blocks(28, 1, 52, 1, 60, 1, 72, 1, 76, 1, 88, 1, 96, 2, 112, 1, 120, 1);

            Assert.Equal(expected5, blocks5);
        }
Exemplo n.º 3
0
        public void GetQueryBlocks_AcrossBlock()
        {
            var qlo = ZCurve.Encode(7, 7);                   // 63
            var qhi = ZCurve.Encode(8, 8);                   // 192

            var blocks1   = ZCurve.GetQueryBlocks(qlo, qhi); // all levels
            var expected1 = Blocks(63, 0, 106, 0, 149, 0, 192, 0);

            Assert.Equal(expected1, blocks1);

            var blocks2   = ZCurve.GetQueryBlocks(qlo, qhi, new[] { 1, 2 });
            var expected2 = Blocks(60, 1, 104, 1, 148, 1, 192, 1);

            Assert.Equal(expected2, blocks2);

            var blocks3   = ZCurve.GetQueryBlocks(qlo, qhi, new[] { 2 });
            var expected3 = Blocks(48, 2, 96, 2, 144, 2, 192, 2);

            Assert.Equal(expected3, blocks3);
        }
Exemplo n.º 4
0
        public void GetQueryBlocks_WithinBlock()
        {
            var q = ZCurve.Encode(7, 10);             // 157

            var blocks1 = ZCurve.GetQueryBlocks(q, q, new[] { 0, 1, 2, 3 });

            Assert.Equal(Blocks(157, 0), blocks1);

            var blocks2 = ZCurve.GetQueryBlocks(q, q, new[] { 1, 2, 3 });

            Assert.Equal(Blocks(156, 1), blocks2);

            var blocks3 = ZCurve.GetQueryBlocks(q, q, new[] { 2, 3 });

            Assert.Equal(Blocks(144, 2), blocks3);

            var blocks4 = ZCurve.GetQueryBlocks(q, q, new[] { 3 });

            Assert.Equal(Blocks(128, 3), blocks4);
        }