예제 #1
0
        public override void Store(MaptileData data)
        {
            m_MaptileService.Store(data);
            int        zoomlevel = data.ZoomLevel;
            GridVector location  = data.Location;

            while (++zoomlevel < MaxZoomLevel)
            {
                location = location.AlignToZoomlevel(zoomlevel);
                m_MaptileService.Remove(location, zoomlevel);
            }
        }
예제 #2
0
        public bool Run()
        {
            var         location = new GridVector(256000, 256000);
            MaptileData result;

            m_Log.Info("Testing non-existence 1");
            if (m_MaptileService.TryGetValue(location, 1, out result))
            {
                return(false);
            }

            m_Log.Info("Testing non-existence 2");
            if (m_MaptileService.GetUpdateTimes(location, location, 1).Count != 0)
            {
                return(false);
            }

            var testData = new MaptileData
            {
                ContentType = "application/octet-stream",
                Data        = new byte[] { 1, 2, 3, 4 },
                Location    = location,
                ZoomLevel   = 1,
                LastUpdate  = Date.Now
            };

            m_Log.Info("Store maptile");
            m_MaptileService.Store(testData);

            m_Log.Info("Testing existence 1");
            if (!m_MaptileService.TryGetValue(location, 1, out result))
            {
                return(false);
            }

            m_Log.Info("Testing equality");
            if (!IsEqual(testData, result))
            {
                return(false);
            }

            m_Log.Info("Testing existence 2");
            List <MaptileInfo> reslist;

            reslist = m_MaptileService.GetUpdateTimes(location, location, 1);
            if (reslist.Count != 1)
            {
                return(false);
            }
            m_Log.Info("Testing equality");
            if (!IsEqual(testData, reslist[0]))
            {
                return(false);
            }

            m_Log.Info("Remove maptile");
            m_MaptileService.Remove(location, 1);

            m_Log.Info("Testing non-existence 1");
            if (m_MaptileService.TryGetValue(location, 1, out result))
            {
                return(false);
            }

            m_Log.Info("Testing non-existence 2");
            if (m_MaptileService.GetUpdateTimes(location, location, 1).Count != 0)
            {
                return(false);
            }

            return(true);
        }