상속: IEnvelope
예제 #1
0
        public void TestMethod1()
        {
            int percent = 0;

            var repository = new SdeRepository("srvprodist", "5151", "bdgd", "bdgd", "sde.DEFAULT");
            var cache = new InMemoryCache(repository, repository.GetFullExtent("admgid.Switch_PT"), "admgid.Switch_PT");

            cache.OnProgress += delegate(int i)
                {
                    percent = i;
                };

            cache.BuildAllCache();

            IList<IGeometry> list = new List<IGeometry>();

            var envelop = new Envelope(325017, 320003, 7392018, 7391712);
            IEnvelope affected = null;

            var inicio = DateTime.Now;
            var result = cache.RetriveData(envelop, ref list, ref affected);
            var tempo1 = (DateTime.Now - inicio).TotalMilliseconds;

            inicio = DateTime.Now;
            var fromSde = repository.GetByEnvelope("admgid.Switch_PT", envelop);
            var tempo2 = (DateTime.Now - inicio).TotalMilliseconds;

            Assert.AreEqual(list.Count, fromSde.Count());
            Assert.IsTrue(tempo1 < tempo2);
            Assert.AreEqual(percent, 100);
        }
예제 #2
0
        public void TestMethod1()
        {
            var manager = new CacheManager();
            var envelop = new Envelope(325017, 320003, 7392018, 7391712);
            
            IList<IGeometry> list = new List<IGeometry>();

            var start = DateTime.Now;
            manager.RetriveData(envelop, ref list);
            var first = (DateTime.Now - start).TotalMilliseconds;

            start = DateTime.Now;
            manager.RetriveData(envelop, ref list);
            var second = (DateTime.Now - start).TotalMilliseconds;

            Assert.IsTrue(first > second);
        }
예제 #3
0
        public void Method01()
        {
            var sde = new SdeRepository("srvprodist", "5151", "bdgd", "bdgd", "sde.DEFAULT");
            var nosql = new MongoRepository();

            var cache = new NoSqlCache(sde, nosql, "admgid.Switch_PT");
            cache.BuildAllCache();

            IList<IGeometry> list = new List<IGeometry>();

            var envelop = new Envelope(325017, 320003, 7392018, 7391712);
            IEnvelope affected = null;

            var inicio = DateTime.Now;
            var result = cache.RetriveData(envelop, ref list, ref affected);
            var tempo1 = (DateTime.Now - inicio).TotalMilliseconds;

            inicio = DateTime.Now;
            var fromSde = sde.GetByEnvelope("admgid.Switch_PT", envelop);
            var tempo2 = (DateTime.Now - inicio).TotalMilliseconds;

            Assert.AreEqual(list.Count, fromSde.Count());
            Assert.IsTrue(tempo1 < tempo2);
        }
예제 #4
0
        /// <summary>
        /// Retrive data from cache
        /// </summary>
        /// <param name="envelop">Envelope for search</param>
        /// <param name="outerData">Output data</param>
        /// <param name="affectedEnvelop">Affected envelop in the grid</param>
        /// <returns>True if data exists in cache</returns>
        public bool RetriveData(IEnvelope envelop, ref IList<IGeometry> outerData, ref IEnvelope affectedEnvelop)
        {
            affectedEnvelop = new Envelope(envelop.MaxX, envelop.MinX, envelop.MaxY, envelop.MinY);

            var result = this._noSqlRepository.GetByEnvelope(this._featureName, envelop);

            outerData = result.ToList();

            return result.Count() > 0;
        }
예제 #5
0
        /// <summary>
        /// Retrive data from cache
        /// </summary>
        /// <param name="envelop">Envelope for search</param>
        /// <param name="outerData">Output data</param>
        /// <param name="affectedEnvelop">Affected envelop in the grid</param>
        /// <returns>True if data exists in cache</returns>
        public bool RetriveData(IEnvelope envelop, ref IList<IGeometry> outerData, ref IEnvelope affectedEnvelop)
        {
            if(outerData == null)
            {
                outerData = new List<IGeometry>();
            }

            outerData.Clear();

            var box = new BoundingBox(envelop.MinX, envelop.MinY, envelop.MaxX, envelop.MaxY);
            var quad = this._indexBound.SearchData(box);

            foreach (var frame in quad)
            {
                var entry = frame as IndexEntry;
                var tree = entry.Data as DynamicRTree;

                if (tree != null)
                {
                    var result = tree.Search(box);
                    foreach (var item in result)
                    {
                        outerData.Add(item as IGeometry);
                    }
                }
            }

            var fullBox = new BoundingBox(quad.Select(x => ((IndexEntry)x).Box).ToArray());
            affectedEnvelop = new Envelope(fullBox.Max.X, fullBox.Min.X, fullBox.Max.Y, fullBox.Min.Y);

            return outerData.Count > 0;
        }