Пример #1
0
        public void SaveIndexTest()
        {
            DynamicRTree <BoundedInt32> rTree = new DynamicRTree <BoundedInt32>(
                _factories.GeoFactory,
                new GuttmanQuadraticInsert <BoundedInt32>(_factories.GeoFactory),
                new GuttmanQuadraticSplit <BoundedInt32>(_factories.GeoFactory),
                new DynamicRTreeBalanceHeuristic());

            addRandomEntries(rTree);
            MemoryStream s = new MemoryStream();

            rTree.SaveIndex(s);
            rTree.Dispose();

            s.Position = 0;
            DynamicRTree <BoundedInt32> rTree2 = DynamicRTree <BoundedInt32> .FromStream(s, _factories.GeoFactory);

            List <Int32> results = new List <Int32>();

            results.AddRange(rTree2.Query(rTree2.Root.Bounds, (Func <BoundedInt32, Int32>) delegate(BoundedInt32 item)
            {
                return(item.Value);
            }));
            Assert.Equal(99990, results.Count);
        }