Ejemplo n.º 1
0
        public void TestQueryTime(string sbnFile)
        {
            if (!File.Exists(sbnFile))
            {
                throw new IgnoreException("File '" + sbnFile + "' not found!");
            }

            var     sw  = new Stopwatch();
            SbnTree sbn = null;

            sw.Start();
            Assert.DoesNotThrow(() => sbn = SbnTree.Load(sbnFile));
            sw.Stop();
            Console.WriteLine("SbnTree read in {0:N0} ticks", sw.ElapsedTicks);

            var fullExtent = sbn.Extent;

            for (var i = 0; i < 10; i++)
            {
                sw.Restart();
                var fids = new List <uint>(sbn.QueryFids(fullExtent));
                sw.Stop();
                Console.WriteLine("Querying full in {0:N0} ticks ({1} ids)", sw.ElapsedTicks, fids.Count);
            }

            var partialExtent = ToSbn(new Envelope(
                                          fullExtent.MinX + 0.4 * fullExtent.Width,
                                          fullExtent.MaxX - 0.4 * fullExtent.Width,
                                          fullExtent.MinY + 0.3 * fullExtent.Height,
                                          fullExtent.MaxY - 0.3 * fullExtent.Height));

            for (var i = 0; i < 10; i++)
            {
                sw.Restart();
                var fids = new List <uint>(sbn.QueryFids(partialExtent));
                sw.Stop();
                Console.WriteLine("Querying part in {0:N0} ticks ({1} ids)", sw.ElapsedTicks, fids.Count);
            }
        }
Ejemplo n.º 2
0
            public Collection <uint> Search(Envelope e)
            {
                var list = new List <uint>();

                foreach (var queryFid in _sbnTree.QueryFids(e))
                {
                    var oid = queryFid - 1;
                    if (oid < _sbnTree.FeatureCount)
                    {
                        list.Add(oid);
                    }
                }
                return(new Collection <uint>(list));
            }